/gaia-test-strategy
user-facingWhat it does
/gaia-test-strategy is the unified entry point for test strategy and test framework setup. It operates in two modes: --plan designs a test strategy document with risk assessment, test levels, and quality gates; --scaffold generates framework configuration, directory structure, and runner scripts for your detected stack.
When to use it
- Your project needs a test strategy document before implementation begins.
- You want to scaffold test infrastructure (config files, directories, fixtures) for a new or existing project.
- You are adding a new test type (performance, contract, accessibility) to an existing setup.
Prerequisites
- Project configuration must exist.
.gaia/config/project-config.yamlis required. Run/gaia-initor/gaia-brownfieldfirst.
How to invoke
/gaia-test-strategy --plan
/gaia-test-strategy --scaffold
/gaia-test-strategy --scaffold --service backend
/gaia-test-strategy --scaffold --service all
/gaia-test-strategy --scaffold --add perf
/gaia-test-strategy --scaffold --cross-service
/gaia-test-strategyWith no arguments, an interactive menu appears to choose the mode.
What it does step by step
Plan mode
- Load project context Reads architecture, PRD, and existing test strategy for incremental updates.
- Risk assessment Identifies high-risk areas and rates them using probability-impact scoring.
- Test strategy Defines test levels per component, coverage targets, and quality gates.
- Write output Saves the strategy to
.gaia/artifacts/planning-artifacts/test-strategy.md(the canonical home for docs-about-testing). For projects pre-dating the migration, writes to.gaia/artifacts/test-artifacts/strategy/test-strategy.md(legacy read-compat) and surfaces amigrate-planning-vs-test.shadvisory.
Scaffold mode
- Detect stacks Reads
project-config.yamlstacks. Single-stack projects skip the service picker. - Select framework Recommends the appropriate test framework for the detected stack (Vitest, pytest, JUnit 5, etc.).
- Generate scaffolding Creates config files, directory structure, and test runner scripts.
- Update config Updates the
test_executionsection and offers CI regeneration.
Inputs
| Input | Source | Description | Example |
|---|---|---|---|
--plan | Argument (optional) | Author or update a test strategy document. | /gaia-test-strategy --plan |
--scaffold | Argument (optional) | Generate framework scaffolding (config, directories, fixtures). | /gaia-test-strategy --scaffold |
--service | Argument (optional, scaffold only) | Restrict scaffolding to a single service, or use all/root. | /gaia-test-strategy --scaffold --service backend |
--add | Argument (optional, scaffold only) | Add a new test type to an existing service scaffold. | /gaia-test-strategy --scaffold --add perf |
--cross-service | Argument (optional, scaffold only) | Generate cross-service E2E tests at tests/e2e/. | /gaia-test-strategy --scaffold --cross-service |
| Project config | .gaia/config/project-config.yaml | Stack definitions and test execution settings. | -- |
| Architecture | .gaia/artifacts/planning-artifacts/architecture.md | System components and risk areas (plan mode). | -- |
Outputs
| Output | Location | Description |
|---|---|---|
| Test strategy | .gaia/artifacts/planning-artifacts/test-strategy.md (canonical) | Risk assessment, test levels, quality gates (plan mode). Legacy .gaia/artifacts/test-artifacts/strategy/test-strategy.md is read-compat for projects pre-dating the migration. |
| Test-plan alias | .gaia/artifacts/planning-artifacts/test-plan.md (sibling alias) | Written next to test-strategy.md as a downstream-gate mitigation — downstream gates that read test-plan.md (e.g. /gaia-create-epics) find it without a manual copy. |
| Config files | Project root | Test runner configuration (scaffold mode). |
| Directory structure | tests/unit/, tests/integration/, etc. | Test directory skeleton (scaffold mode). |
Example session
> /gaia-test-strategy --scaffold
Detected stack: typescript (from package.json).
Recommended framework: Vitest for unit/integration, Playwright for E2E.
Scaffolding:
Created vitest.config.ts
Created tests/unit/
Created tests/integration/
Created tests/e2e/
Added npm scripts: test, test:unit, test:int, test:e2e
Updated test_execution in project-config.yaml.
Regenerate CI config now? [y/n]What to run next
/gaia-dev-story-- implement stories using the scaffolded test infrastructure./gaia-atdd-- generate acceptance test skeletons for high-risk stories.
Troubleshooting
"project-config.yaml not found"
Run /gaia-init or /gaia-brownfield first.
"--plan and --scaffold are mutually exclusive"
Choose one mode per invocation, or run with no arguments for the interactive menu.