qaa-agent 1.6.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/.mcp.json +8 -8
  2. package/CHANGELOG.md +93 -71
  3. package/CLAUDE.md +553 -553
  4. package/agents/qa-pipeline-orchestrator.md +1378 -1378
  5. package/agents/qaa-analyzer.md +539 -524
  6. package/agents/qaa-bug-detective.md +479 -446
  7. package/agents/qaa-codebase-mapper.md +935 -935
  8. package/agents/qaa-discovery.md +384 -0
  9. package/agents/qaa-e2e-runner.md +416 -415
  10. package/agents/qaa-executor.md +651 -651
  11. package/agents/qaa-planner.md +405 -390
  12. package/agents/qaa-project-researcher.md +319 -319
  13. package/agents/qaa-scanner.md +424 -424
  14. package/agents/qaa-testid-injector.md +643 -585
  15. package/agents/qaa-validator.md +490 -452
  16. package/bin/install.cjs +200 -198
  17. package/bin/lib/commands.cjs +709 -709
  18. package/bin/lib/config.cjs +307 -307
  19. package/bin/lib/core.cjs +497 -497
  20. package/bin/lib/frontmatter.cjs +299 -299
  21. package/bin/lib/init.cjs +989 -989
  22. package/bin/lib/milestone.cjs +241 -241
  23. package/bin/lib/model-profiles.cjs +60 -60
  24. package/bin/lib/phase.cjs +911 -911
  25. package/bin/lib/roadmap.cjs +306 -306
  26. package/bin/lib/state.cjs +748 -748
  27. package/bin/lib/template.cjs +222 -222
  28. package/bin/lib/verify.cjs +842 -842
  29. package/bin/qaa-tools.cjs +607 -607
  30. package/commands/qa-audit.md +119 -0
  31. package/commands/qa-create-test.md +288 -0
  32. package/commands/qa-fix.md +147 -0
  33. package/commands/qa-map.md +137 -0
  34. package/{.claude/commands → commands}/qa-pr.md +23 -23
  35. package/{.claude/commands → commands}/qa-start.md +22 -22
  36. package/{.claude/commands → commands}/qa-testid.md +19 -19
  37. package/docs/COMMANDS.md +341 -341
  38. package/docs/DEMO.md +182 -182
  39. package/docs/TESTING.md +156 -156
  40. package/package.json +6 -7
  41. package/{.claude/settings.json → settings.json} +1 -2
  42. package/templates/failure-classification.md +391 -391
  43. package/templates/gap-analysis.md +409 -409
  44. package/templates/pr-template.md +48 -48
  45. package/templates/qa-analysis.md +381 -381
  46. package/templates/qa-audit-report.md +465 -465
  47. package/templates/qa-repo-blueprint.md +636 -636
  48. package/templates/scan-manifest.md +312 -312
  49. package/templates/test-inventory.md +582 -582
  50. package/templates/testid-audit-report.md +354 -354
  51. package/templates/validation-report.md +243 -243
  52. package/workflows/qa-analyze.md +296 -296
  53. package/workflows/qa-from-ticket.md +536 -536
  54. package/workflows/qa-gap.md +309 -303
  55. package/workflows/qa-pr.md +389 -389
  56. package/workflows/qa-start.md +1192 -1168
  57. package/workflows/qa-testid.md +384 -356
  58. package/workflows/qa-validate.md +299 -295
  59. package/.claude/commands/create-test.md +0 -164
  60. package/.claude/commands/qa-audit.md +0 -37
  61. package/.claude/commands/qa-blueprint.md +0 -54
  62. package/.claude/commands/qa-fix.md +0 -36
  63. package/.claude/commands/qa-from-ticket.md +0 -24
  64. package/.claude/commands/qa-gap.md +0 -20
  65. package/.claude/commands/qa-map.md +0 -47
  66. package/.claude/commands/qa-pom.md +0 -36
  67. package/.claude/commands/qa-pyramid.md +0 -37
  68. package/.claude/commands/qa-report.md +0 -38
  69. package/.claude/commands/qa-research.md +0 -33
  70. package/.claude/commands/qa-validate.md +0 -42
  71. package/.claude/commands/update-test.md +0 -58
  72. package/.claude/skills/qa-learner/SKILL.md +0 -150
  73. /package/{.claude/skills → skills}/qa-bug-detective/SKILL.md +0 -0
  74. /package/{.claude/skills → skills}/qa-repo-analyzer/SKILL.md +0 -0
  75. /package/{.claude/skills → skills}/qa-self-validator/SKILL.md +0 -0
  76. /package/{.claude/skills → skills}/qa-template-engine/SKILL.md +0 -0
  77. /package/{.claude/skills → skills}/qa-testid-injector/SKILL.md +0 -0
  78. /package/{.claude/skills → skills}/qa-workflow-documenter/SKILL.md +0 -0
@@ -1,390 +1,405 @@
1
- <purpose>
2
- Read TEST_INVENTORY.md and QA_ANALYSIS.md to produce a structured generation plan that maps every test case to an output file, grouped by feature domain with explicit task dependencies. This agent is the bridge between "what tests are needed" (from the analyzer) and "tests exist on disk" (from the executor). It is spawned by the orchestrator after the analyzer completes successfully via Task(subagent_type='qaa-planner'). The planner does NOT produce test files -- it produces a plan that the executor consumes. The generation plan is an internal artifact with no template; the planner defines its own output format documented in the <output> section below.
3
- </purpose>
4
-
5
- <required_reading>
6
- Read ALL of the following files BEFORE producing any output. Do NOT skip any file or section listed here.
7
-
8
- - **TEST_INVENTORY.md** -- Path provided by orchestrator in files_to_read. This is the analyzer's output containing every test case with unique ID, target, concrete inputs, explicit expected outcome, and priority. Read the entire file. Extract: all test case IDs grouped by pyramid tier (UT-*, INT-*, API-*, E2E-*), their targets (file paths and function names), and their priorities (P0, P1, P2).
9
-
10
- - **QA_ANALYSIS.md** -- Path provided by orchestrator in files_to_read. This is the analyzer's output containing architecture overview, external dependencies, risk assessment, top 10 unit test targets, API/contract test targets, and testing pyramid distribution. Read the entire file. Extract: architecture type, framework, detected features/modules, API resource groupings, and the recommended pyramid percentages.
11
-
12
- - **CLAUDE.md** -- QA automation standards. Read these sections:
13
- - **Module Boundaries** -- qa-planner reads TEST_INVENTORY.md, QA_ANALYSIS.md; produces Generation plan (internal). Planner MUST NOT produce any other artifact.
14
- - **Naming Conventions** -- Test file naming patterns: unit `[module].unit.spec.[ext]`, API `[resource].api.spec.[ext]`, E2E `[feature].e2e.spec.[ext]`, POM `[PageName]Page.[ext]`, fixture `[domain]-data.[ext]`. The planner assigns file paths following these conventions.
15
- - **Verification Commands** -- Generation plan: "Test cases mapped to output files, no unassigned cases, no duplicate assignments."
16
- - **Testing Pyramid** -- Target distribution (60-70% unit, 10-15% integration, 20-25% API, 3-5% E2E). The planner preserves the pyramid balance from QA_ANALYSIS.md.
17
- - **Quality Gates** -- Every test case has explicit expected outcome, test IDs unique, priority assigned. The planner carries forward these guarantees from TEST_INVENTORY.md into the plan.
18
- - **Repo Structure** -- Recommended directory layout: tests/e2e/smoke/, tests/e2e/regression/, tests/api/, tests/unit/, pages/base/, pages/{feature}/, pages/components/, fixtures/. The planner uses this structure for file path assignments.
19
- - **POM File Structure** -- pages/base/BasePage, pages/{feature}/{Feature}Page, pages/components/{Component}. The planner must include POM file creation tasks in the plan.
20
-
21
- - **templates/qa-repo-blueprint.md** -- Optional reference for folder structure. If the orchestrator indicates that QA_REPO_BLUEPRINT.md was produced by the analyzer, read it for the exact folder structure to use when assigning file paths. If no blueprint exists, use the CLAUDE.md Repo Structure defaults.
22
-
23
- - **~/.claude/qaa/MY_PREFERENCES.md** (optional -- read if exists). User's personal QA preferences saved by the qa-learner skill. If a preference conflicts with CLAUDE.md, the preference wins (it is a user override). Check for rules about: framework choices, naming conventions, file structure, workflow preferences.
24
-
25
- - **Codebase map documents** (optional -- read if they exist in `{codebase_map_dir}/` or `.qa-output/codebase/`):
26
- - **TESTABILITY.md** -- Pure functions vs stateful code, mock boundaries. Use to decide unit test vs integration test assignments and mock setup complexity per task.
27
- - **TEST_SURFACE.md** -- Exhaustive list of testable entry points with signatures. Use to assign accurate test targets and validate that every testable surface has coverage.
28
- - **CRITICAL_PATHS.md** -- User flows for E2E smoke tests. Use to group E2E test cases by critical business flow.
29
- - **COVERAGE_GAPS.md** -- Uncovered modules and functions. Use to prioritize task ordering (cover gaps first).
30
- If these files exist, they provide deep codebase knowledge that improves task grouping, dependency analysis, and complexity estimation.
31
-
32
- Note: Read these files in full. The planner's output quality depends entirely on how thoroughly it reads and cross-references the input artifacts. Every test case ID in TEST_INVENTORY.md MUST appear in exactly one task in the generation plan.
33
- </required_reading>
34
-
35
- <process>
36
-
37
- <step name="read_inputs" priority="first">
38
- Read TEST_INVENTORY.md and QA_ANALYSIS.md completely. These are the two primary inputs that drive all planning.
39
-
40
- 1. **Read TEST_INVENTORY.md** (path from orchestrator's files_to_read):
41
- - Extract the Summary section: total test count, per-tier counts (unit, integration, API, E2E), per-priority counts (P0, P1, P2)
42
- - Extract every test case ID across all sections:
43
- - Unit tests: UT-MODULE-NNN with target file:function
44
- - Integration tests: INT-MODULE-NNN with components_involved
45
- - API tests: API-RESOURCE-NNN with method_endpoint
46
- - E2E smoke tests: E2E-FLOW-NNN with user_journey and pages_involved
47
- - Build a master list: `{test_id, tier, target, priority}` for every test case
48
- - Verify: count of extracted IDs matches the Summary total_tests value
49
-
50
- 2. **Read QA_ANALYSIS.md** (path from orchestrator's files_to_read):
51
- - Extract Architecture Overview: system_type, language, framework, runtime
52
- - Extract Top 10 Unit Test Targets: module paths and function names (these are highest-priority generation targets)
53
- - Extract API/Contract Test Targets: endpoint groupings by resource (these define API test file groupings)
54
- - Extract Testing Pyramid: recommended percentages per tier
55
- - Extract feature/module domains: identify distinct features from the architecture (auth, products, orders, users, etc.)
56
-
57
- 3. **Read CLAUDE.md** -- focus on Module Boundaries (confirms planner reads/produces), Naming Conventions (file naming table), Verification Commands (generation plan checks), Repo Structure (directory layout), POM File Structure (BasePage, feature pages, components).
58
-
59
- 4. **Read QA_REPO_BLUEPRINT.md** (if path provided by orchestrator in files_to_read):
60
- - Extract the Folder Structure section for exact directory layout
61
- - Extract the Recommended Stack for framework and file extensions
62
- - If no blueprint exists, use CLAUDE.md Repo Structure defaults
63
-
64
- 5. **Read codebase map documents** (if they exist -- check `{codebase_map_dir}/` or `.qa-output/codebase/`):
65
- - **TESTABILITY.md** -- Extract pure functions (cheap unit tests) vs stateful code (integration setup needed). Use for mock complexity estimation per task.
66
- - **TEST_SURFACE.md** -- Extract testable entry points with function signatures, parameter types, return types. Cross-reference with TEST_INVENTORY.md targets to validate coverage completeness.
67
- - **CRITICAL_PATHS.md** -- Extract critical user flows. Use to group E2E test cases into logical flow-based tasks.
68
- - **COVERAGE_GAPS.md** -- Extract uncovered modules. Prioritize tasks that fill critical gaps first in the execution order.
69
- If any of these files do not exist, proceed without them.
70
-
71
- 6. **Determine file extension** from the detected framework:
72
- - TypeScript + Playwright: `.spec.ts` for tests, `.ts` for POMs
73
- - TypeScript + Cypress: `.cy.ts` for E2E, `.spec.ts` for unit/API, `.ts` for POMs
74
- - TypeScript + Jest/Vitest: `.test.ts` for unit, `.spec.ts` for API/E2E, `.ts` for POMs
75
- - JavaScript: replace `.ts` with `.js` in all patterns above
76
- - Python + pytest: `.py` for all files
77
- - Other: match the conventions from QA_ANALYSIS.md framework detection
78
-
79
- If file extension cannot be determined (no framework detected in QA_ANALYSIS.md and no QA_REPO_BLUEPRINT.md):
80
-
81
- ```
82
- CHECKPOINT_RETURN:
83
- completed: "Read TEST_INVENTORY.md and QA_ANALYSIS.md, extracted all test case IDs"
84
- blocking: "Cannot determine test file extension -- no framework detected"
85
- details: "QA_ANALYSIS.md framework: [value]. QA_REPO_BLUEPRINT.md: [exists/not found]. Cannot assign file paths without knowing the target framework and file extension convention."
86
- awaiting: "User specifies the test framework (Playwright, Cypress, Jest, Vitest, pytest, etc.) and language (TypeScript, JavaScript, Python)"
87
- ```
88
- </step>
89
-
90
- <step name="analyze_features">
91
- Extract feature domains from test case IDs and targets. The planner groups by FEATURE, not by pyramid tier.
92
-
93
- **Feature extraction strategy:**
94
-
95
- 1. **From test case IDs:** Extract the MODULE/RESOURCE/FLOW segment from each ID:
96
- - `UT-AUTH-001` -> feature: "auth"
97
- - `API-USERS-003` -> feature: "users"
98
- - `INT-PAYMENT-002` -> feature: "payment"
99
- - `E2E-LOGIN-001` -> feature: "login" (map to parent feature "auth" if applicable)
100
- - `UT-ORDER-005` -> feature: "order"
101
-
102
- 2. **From test targets:** Cross-reference file paths to confirm feature groupings:
103
- - `src/services/auth.service.ts:validateToken` -> confirms "auth" feature
104
- - `src/controllers/product.controller.ts:createProduct` -> confirms "product" feature
105
- - `src/routes/order.routes.ts` -> confirms "order" feature
106
-
107
- 3. **Merge related features:** Combine closely related feature domains:
108
- - "login" + "auth" + "session" -> "auth" (if they share code paths)
109
- - "product" + "catalog" -> "product" (if they share the same service layer)
110
- - Keep separate if they have distinct service layers and route files
111
-
112
- 4. **Build feature domain list:** For each feature, record:
113
- - Feature name (lowercase, kebab-case for multi-word: e.g., "auth", "product", "shopping-cart")
114
- - Source modules involved (file paths from targets)
115
- - Test case count per tier (how many UT, INT, API, E2E belong to this feature)
116
-
117
- **Critical rule (from CONTEXT.md locked decision):**
118
- Groups test files by feature (auth tests together: unit+API+E2E), not by pyramid level. This means the "auth" group contains UT-AUTH-*, API-AUTH-*, INT-AUTH-*, and E2E-LOGIN-* -- all tiers together for the same feature.
119
- </step>
120
-
121
- <step name="create_feature_groups">
122
- For each feature domain identified in the previous step, create a feature group containing all test cases across all pyramid tiers.
123
-
124
- **For each feature group, collect:**
125
-
126
- | Field | Description |
127
- |-------|-------------|
128
- | feature_name | Lowercase feature name (e.g., "auth", "product", "order") |
129
- | test_case_ids | Complete list of all test IDs belonging to this feature, across all tiers |
130
- | unit_tests | List of UT-* IDs in this feature |
131
- | integration_tests | List of INT-* IDs in this feature |
132
- | api_tests | List of API-* IDs in this feature |
133
- | e2e_tests | List of E2E-* IDs in this feature |
134
- | estimated_file_count | How many output files this feature will produce (unit spec, API spec, E2E spec, POM, fixture) |
135
- | complexity | LOW / MEDIUM / HIGH based on: test case count, number of tiers involved, number of distinct source modules |
136
-
137
- **Complexity classification:**
138
- - **HIGH:** 10+ test cases, 3+ tiers involved, 3+ source modules, includes E2E tests requiring POMs
139
- - **MEDIUM:** 5-9 test cases, 2+ tiers involved, 2+ source modules
140
- - **LOW:** 1-4 test cases, 1-2 tiers involved, 1-2 source modules
141
-
142
- **Validation:** Every test case ID from the master list (step 1) must appear in exactly one feature group. No test case should be unassigned. No test case should appear in multiple groups.
143
-
144
- **Cross-tier verification:** For each HIGH-priority feature (features with P0 test cases), verify that the feature group has coverage across multiple tiers. A feature with only unit tests but P0 API endpoints in QA_ANALYSIS.md indicates a potential gap -- the test cases should already exist in TEST_INVENTORY.md, but if the grouping reveals an imbalance, note it in the plan output.
145
- </step>
146
-
147
- <step name="determine_dependencies">
148
- Identify task ordering within and across features. Dependencies determine the execution order for the executor agent.
149
-
150
- **Dependency rules (in priority order):**
151
-
152
- 1. **Infrastructure tasks first:**
153
- - BasePage creation (if no existing BasePage detected) must complete before ANY feature POM task
154
- - Test framework config file (playwright.config.ts, jest.config.ts, etc.) must exist before any test execution
155
- - Fixture directory creation before any test that references fixtures
156
-
157
- 2. **POM before E2E:**
158
- - Feature POM files (e.g., LoginPage.ts) must be created before E2E specs that import them
159
- - Shared component POMs (e.g., NavigationBar.ts) must be created before any E2E spec that uses them
160
-
161
- 3. **Fixtures before consumers:**
162
- - Fixture data files (e.g., auth-data.ts, product-data.ts) must be created before test specs that import them
163
-
164
- 4. **Unit and API tests are independent:**
165
- - Unit tests typically have no dependencies on other generated files (they test existing source code)
166
- - API tests typically have no dependencies on other generated files (they call existing endpoints)
167
- - These can be generated in any order relative to each other
168
-
169
- 5. **Within a feature, recommended order:**
170
- - Fixture data file (if needed)
171
- - Feature POM (if E2E tests exist for this feature)
172
- - Unit test spec
173
- - API test spec
174
- - Integration test spec
175
- - E2E test spec (depends on POM)
176
-
177
- **Record dependencies as pairs:**
178
- ```
179
- task_id: "auth-pom"
180
- depends_on: ["infrastructure-basepage"]
181
-
182
- task_id: "auth-e2e"
183
- depends_on: ["auth-pom", "auth-fixture"]
184
- ```
185
-
186
- **Validate: dependency graph MUST be acyclic.** No circular dependencies allowed. If task A depends on task B, then task B cannot depend on task A (directly or transitively). To verify: perform a topological sort of the task graph. If topological sort fails, there is a cycle -- resolve it by breaking the cycle at the least critical dependency.
187
- </step>
188
-
189
- <step name="assign_files">
190
- Map each task to concrete output file paths following CLAUDE.md Naming Conventions.
191
-
192
- **File path assignment rules:**
193
-
194
- | Test Type | Path Pattern | Example (TypeScript + Playwright) |
195
- |-----------|-------------|-----------------------------------|
196
- | Unit test | `tests/unit/{feature}.unit.spec.{ext}` | `tests/unit/auth.unit.spec.ts` |
197
- | Integration test | `tests/integration/{feature}.integration.spec.{ext}` | `tests/integration/auth.integration.spec.ts` |
198
- | API test | `tests/api/{resource}.api.spec.{ext}` | `tests/api/users.api.spec.ts` |
199
- | E2E smoke test | `tests/e2e/smoke/{feature}.e2e.spec.{ext}` | `tests/e2e/smoke/login.e2e.spec.ts` |
200
- | Feature POM | `pages/{feature}/{Feature}Page.{ext}` | `pages/auth/LoginPage.ts` |
201
- | Component POM | `pages/components/{Component}.{ext}` | `pages/components/NavigationBar.ts` |
202
- | BasePage | `pages/base/BasePage.{ext}` | `pages/base/BasePage.ts` |
203
- | Fixture | `fixtures/{domain}-data.{ext}` | `fixtures/auth-data.ts` |
204
- | Test config | root or `config/` | `playwright.config.ts` |
205
-
206
- **If QA_REPO_BLUEPRINT.md exists:** Use its folder structure instead of the defaults above. The blueprint takes precedence.
207
-
208
- **File extension:** Use the extension determined in step 1 (read_inputs).
209
-
210
- **E2E test files and POMs:**
211
- - Each E2E test spec gets a corresponding POM for the primary page it tests
212
- - If multiple E2E tests share a page, they share a single POM
213
- - E2E-LOGIN-* and E2E-REGISTER-* might share an AuthPage POM, or have separate LoginPage and RegisterPage POMs depending on the page structure described in the test cases
214
-
215
- **Multiple test cases per file:**
216
- - All unit tests for the same feature go in ONE unit spec file (e.g., all UT-AUTH-* go in `auth.unit.spec.ts`)
217
- - All API tests for the same resource go in ONE API spec file (e.g., all API-USERS-* go in `users.api.spec.ts`)
218
- - Each E2E flow typically gets its own spec file, but closely related flows for the same page can share a file
219
-
220
- **Validation:** Every file path must follow the naming convention. No duplicate file paths. Every test case ID must be assigned to exactly one file.
221
- </step>
222
-
223
- <step name="produce_plan">
224
- Write the generation plan markdown to the output path specified by the orchestrator.
225
-
226
- **Generation plan structure:**
227
-
228
- ```markdown
229
- # Generation Plan
230
-
231
- ## Summary
232
-
233
- | Metric | Value |
234
- |--------|-------|
235
- | Total tasks | {N} |
236
- | Total files | {N} |
237
- | Feature groups | {N} |
238
- | Test cases covered | {N} |
239
- | Dependency depth | {N} (longest chain of dependent tasks) |
240
- | Framework | {detected framework} |
241
- | File extension | {ext} |
242
-
243
- ## Dependency Graph
244
-
245
- {ASCII visualization of task dependencies}
246
- Example:
247
- infrastructure-basepage
248
- -> auth-pom -> auth-e2e
249
- -> product-pom -> product-e2e
250
- auth-fixture -> auth-e2e
251
- auth-unit (independent)
252
- auth-api (independent)
253
-
254
- ## Tasks
255
-
256
- ### Task: {task_id}
257
-
258
- | Field | Value |
259
- |-------|-------|
260
- | task_id | {unique task identifier, e.g., "auth-unit"} |
261
- | feature_group | {feature name, e.g., "auth"} |
262
- | files_to_create | {list of file paths this task produces} |
263
- | test_case_ids | {list of test case IDs from TEST_INVENTORY this task implements} |
264
- | depends_on | {list of task_ids that must complete before this task, or "none"} |
265
- | estimated_complexity | {LOW / MEDIUM / HIGH} |
266
-
267
- [... repeat for each task ...]
268
-
269
- ## Test Case Assignment Map
270
-
271
- | Test Case ID | Task ID | Output File |
272
- |--------------|---------|-------------|
273
- | UT-AUTH-001 | auth-unit | tests/unit/auth.unit.spec.ts |
274
- | UT-AUTH-002 | auth-unit | tests/unit/auth.unit.spec.ts |
275
- | API-USERS-001 | users-api | tests/api/users.api.spec.ts |
276
- [... every test case from TEST_INVENTORY.md ...]
277
-
278
- ## Unassigned Test Cases
279
-
280
- {List any test cases not assigned -- this section should be EMPTY if the plan is correct}
281
- ```
282
-
283
- **Commit the output:**
284
- ```bash
285
- node bin/qaa-tools.cjs commit "qa(planner): produce generation plan for {project_name}" --files {output_path}
286
- ```
287
-
288
- Replace `{project_name}` with the project name from QA_ANALYSIS.md architecture overview.
289
- Replace `{output_path}` with the actual path where the generation plan was written.
290
- </step>
291
-
292
- <step name="validate_plan">
293
- Verify the generation plan is complete and correct before committing.
294
-
295
- **Validation checks:**
296
-
297
- 1. **Complete coverage:** Every test case ID from TEST_INVENTORY.md appears in exactly one task in the generation plan. Count the test case IDs in the Test Case Assignment Map and verify it matches TEST_INVENTORY.md's total_tests count.
298
-
299
- 2. **No duplicate assignments:** No test case ID appears in more than one task. Scan the Test Case Assignment Map for duplicate test_case_ids.
300
-
301
- 3. **No unassigned cases:** The "Unassigned Test Cases" section is empty. If any test case is unassigned, add it to the appropriate feature group and task.
302
-
303
- 4. **Acyclic dependencies:** Perform a topological sort of the task dependency graph. If the sort succeeds, dependencies are acyclic. If it fails, there is a cycle that must be resolved.
304
-
305
- 5. **File path conventions:** Every file path in files_to_create follows CLAUDE.md Naming Conventions:
306
- - Unit tests match `[module].unit.spec.[ext]` pattern
307
- - API tests match `[resource].api.spec.[ext]` pattern
308
- - E2E tests match `[feature].e2e.spec.[ext]` pattern
309
- - POMs match `[PageName]Page.[ext]` pattern
310
- - Fixtures match `[domain]-data.[ext]` pattern
311
-
312
- 6. **Feature groups have coverage:** Every feature group that contains P0 test cases has tasks spanning at least 2 pyramid tiers (e.g., unit + API, or API + E2E). Single-tier groups are acceptable only for features that genuinely warrant only one tier of testing (e.g., a pure utility module with only unit tests).
313
-
314
- 7. **BasePage dependency:** If any task creates a feature POM, verify that the task depends on the BasePage infrastructure task (either directly or transitively through another POM task).
315
-
316
- 8. **Summary counts match:** The Summary table's total_tasks, total_files, and test_cases_covered values match the actual task list.
317
-
318
- **If any validation check fails:** Fix the issue in the generation plan, then re-validate. Do not proceed to commit until all checks pass.
319
- </step>
320
-
321
- </process>
322
-
323
- <output>
324
- The planner agent produces a single artifact:
325
-
326
- - **Generation plan** markdown file at the output path specified by the orchestrator prompt
327
-
328
- The generation plan contains:
329
- 1. **Summary** -- Total tasks, total files, feature group count, test case count, dependency depth, framework, extension
330
- 2. **Dependency Graph** -- ASCII visualization of task ordering
331
- 3. **Tasks** -- Per-task details: task_id, feature_group, files_to_create, test_case_ids, depends_on, estimated_complexity
332
- 4. **Test Case Assignment Map** -- Complete mapping of every test case ID to its task and output file
333
- 5. **Unassigned Test Cases** -- Should be empty; any remaining unassigned IDs listed here
334
-
335
- **Return to orchestrator:**
336
-
337
- After writing and committing, return these values to the orchestrator:
338
-
339
- ```
340
- PLANNER_COMPLETE:
341
- file_path: "{output_path}"
342
- total_tasks: {N}
343
- total_files: {N}
344
- feature_count: {N}
345
- dependency_depth: {N}
346
- test_case_count: {N}
347
- commit_hash: "{hash}"
348
- ```
349
- </output>
350
-
351
- <quality_gate>
352
- Before considering the plan complete, verify ALL of the following.
353
-
354
- **From CLAUDE.md Verification Commands (generation plan checks -- verbatim):**
355
-
356
- - [ ] Test cases mapped to output files
357
- - [ ] No unassigned cases
358
- - [ ] No duplicate assignments
359
-
360
- **Additional planner-specific checks:**
361
-
362
- - [ ] Groups organized by feature, not by pyramid level (feature groups contain mixed tiers: UT-* + API-* + E2E-* for the same feature)
363
- - [ ] Dependencies are acyclic (topological sort succeeds)
364
- - [ ] File paths follow CLAUDE.md naming conventions (unit: `[module].unit.spec.[ext]`, API: `[resource].api.spec.[ext]`, E2E: `[feature].e2e.spec.[ext]`, POM: `[PageName]Page.[ext]`, fixture: `[domain]-data.[ext]`)
365
- - [ ] Every feature group has unit + API or E2E coverage (not single-tier groups unless the feature only warrants one tier of testing)
366
- - [ ] BasePage listed as dependency for all POM tasks (directly or transitively)
367
- - [ ] Output path matches orchestrator specification (not hardcoded)
368
- - [ ] Summary counts (total_tasks, total_files, test_cases_covered) match actual task list
369
- - [ ] Test Case Assignment Map contains every test case ID from TEST_INVENTORY.md
370
- - [ ] Feature extraction is by domain (auth, product, order), not by pyramid level (unit, API, E2E)
371
- - [ ] Every task has a unique task_id
372
- - [ ] Every task specifies at least one file_to_create
373
- - [ ] Every task specifies at least one test_case_id
374
-
375
- If any check fails, fix the issue before writing the final output. Do not proceed with a failing quality gate.
376
- </quality_gate>
377
-
378
- <success_criteria>
379
- The planner agent has completed successfully when:
380
-
381
- 1. Generation plan exists at the output path specified by the orchestrator
382
- 2. Every test case ID from TEST_INVENTORY.md is assigned to exactly one task (no unassigned, no duplicates)
383
- 3. Feature groups contain test cases across multiple pyramid tiers (grouped by feature, not by tier)
384
- 4. Dependency graph is acyclic (topological sort succeeds)
385
- 5. All file paths follow CLAUDE.md naming conventions
386
- 6. BasePage dependency enforced for all POM tasks
387
- 7. Generation plan is committed via `node bin/qaa-tools.cjs commit`
388
- 8. Return values provided to orchestrator: file_path, total_tasks, total_files, feature_count, dependency_depth, test_case_count, commit_hash
389
- 9. All quality gate checks pass
390
- </success_criteria>
1
+ <purpose>
2
+ Read TEST_INVENTORY.md and QA_ANALYSIS.md to produce a structured generation plan that maps every test case to an output file, grouped by feature domain with explicit task dependencies. This agent is the bridge between "what tests are needed" (from the analyzer) and "tests exist on disk" (from the executor). It is spawned by the orchestrator after the analyzer completes successfully via Task(subagent_type='qaa-planner'). The planner does NOT produce test files -- it produces a plan that the executor consumes. The generation plan is an internal artifact with no template; the planner defines its own output format documented in the <output> section below.
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read ALL of the following files BEFORE producing any output. Do NOT skip any file or section listed here.
7
+
8
+ - **TEST_INVENTORY.md** -- Path provided by orchestrator in files_to_read. This is the analyzer's output containing every test case with unique ID, target, concrete inputs, explicit expected outcome, and priority. Read the entire file. Extract: all test case IDs grouped by pyramid tier (UT-*, INT-*, API-*, E2E-*), their targets (file paths and function names), and their priorities (P0, P1, P2).
9
+
10
+ - **QA_ANALYSIS.md** -- Path provided by orchestrator in files_to_read. This is the analyzer's output containing architecture overview, external dependencies, risk assessment, top 10 unit test targets, API/contract test targets, and testing pyramid distribution. Read the entire file. Extract: architecture type, framework, detected features/modules, API resource groupings, and the recommended pyramid percentages.
11
+
12
+ - **CLAUDE.md** -- QA automation standards. Read these sections:
13
+ - **Module Boundaries** -- qa-planner reads TEST_INVENTORY.md, QA_ANALYSIS.md; produces Generation plan (internal). Planner MUST NOT produce any other artifact.
14
+ - **Naming Conventions** -- Test file naming patterns: unit `[module].unit.spec.[ext]`, API `[resource].api.spec.[ext]`, E2E `[feature].e2e.spec.[ext]`, POM `[PageName]Page.[ext]`, fixture `[domain]-data.[ext]`. The planner assigns file paths following these conventions.
15
+ - **Verification Commands** -- Generation plan: "Test cases mapped to output files, no unassigned cases, no duplicate assignments."
16
+ - **Testing Pyramid** -- Target distribution (60-70% unit, 10-15% integration, 20-25% API, 3-5% E2E). The planner preserves the pyramid balance from QA_ANALYSIS.md.
17
+ - **Quality Gates** -- Every test case has explicit expected outcome, test IDs unique, priority assigned. The planner carries forward these guarantees from TEST_INVENTORY.md into the plan.
18
+ - **Repo Structure** -- Recommended directory layout: tests/e2e/smoke/, tests/e2e/regression/, tests/api/, tests/unit/, pages/base/, pages/{feature}/, pages/components/, fixtures/. The planner uses this structure for file path assignments.
19
+ - **POM File Structure** -- pages/base/BasePage, pages/{feature}/{Feature}Page, pages/components/{Component}. The planner must include POM file creation tasks in the plan.
20
+
21
+ - **templates/qa-repo-blueprint.md** -- Optional reference for folder structure. If the orchestrator indicates that QA_REPO_BLUEPRINT.md was produced by the analyzer, read it for the exact folder structure to use when assigning file paths. If no blueprint exists, use the CLAUDE.md Repo Structure defaults.
22
+
23
+ - **~/.claude/qaa/MY_PREFERENCES.md** (optional -- read if exists). User's personal QA preferences saved by the qa-learner skill. If a preference conflicts with CLAUDE.md, the preference wins (it is a user override). Check for rules about: framework choices, naming conventions, file structure, workflow preferences.
24
+
25
+ - **Locator Registry** (optional -- read if it exists):
26
+ - **`.qa-output/locators/LOCATOR_REGISTRY.md`** -- Central index of all locators extracted from the live app.
27
+ - **`.qa-output/locators/{feature}.locators.md`** -- Per-feature locator files.
28
+
29
+ When locator registry files exist:
30
+ - Use them to assess E2E test feasibility: features with rich locator coverage (many Tier 1 locators) are good candidates for E2E tests. Features with no locators may need testid-injection first.
31
+ - Include locator availability as a factor in complexity estimation: E2E tasks with no registry entries = HIGH complexity (locators must be proposed). E2E tasks with full registry coverage = LOWER complexity (locators are known).
32
+ - Record which features have locator coverage in the generation plan output, so the executor knows which features can use real locators vs. proposed ones.
33
+
34
+ - **Codebase map documents** (optional -- read if they exist in `{codebase_map_dir}/` or `.qa-output/codebase/`):
35
+ - **TESTABILITY.md** -- Pure functions vs stateful code, mock boundaries. Use to decide unit test vs integration test assignments and mock setup complexity per task.
36
+ - **TEST_SURFACE.md** -- Exhaustive list of testable entry points with signatures. Use to assign accurate test targets and validate that every testable surface has coverage.
37
+ - **CRITICAL_PATHS.md** -- User flows for E2E smoke tests. Use to group E2E test cases by critical business flow.
38
+ - **COVERAGE_GAPS.md** -- Uncovered modules and functions. Use to prioritize task ordering (cover gaps first).
39
+ If these files exist, they provide deep codebase knowledge that improves task grouping, dependency analysis, and complexity estimation.
40
+
41
+ Note: Read these files in full. The planner's output quality depends entirely on how thoroughly it reads and cross-references the input artifacts. Every test case ID in TEST_INVENTORY.md MUST appear in exactly one task in the generation plan.
42
+ </required_reading>
43
+
44
+ <process>
45
+
46
+ <step name="read_inputs" priority="first">
47
+ Read TEST_INVENTORY.md and QA_ANALYSIS.md completely. These are the two primary inputs that drive all planning.
48
+
49
+ 1. **Read TEST_INVENTORY.md** (path from orchestrator's files_to_read):
50
+ - Extract the Summary section: total test count, per-tier counts (unit, integration, API, E2E), per-priority counts (P0, P1, P2)
51
+ - Extract every test case ID across all sections:
52
+ - Unit tests: UT-MODULE-NNN with target file:function
53
+ - Integration tests: INT-MODULE-NNN with components_involved
54
+ - API tests: API-RESOURCE-NNN with method_endpoint
55
+ - E2E smoke tests: E2E-FLOW-NNN with user_journey and pages_involved
56
+ - Build a master list: `{test_id, tier, target, priority}` for every test case
57
+ - Verify: count of extracted IDs matches the Summary total_tests value
58
+
59
+ 2. **Read QA_ANALYSIS.md** (path from orchestrator's files_to_read):
60
+ - Extract Architecture Overview: system_type, language, framework, runtime
61
+ - Extract Top 10 Unit Test Targets: module paths and function names (these are highest-priority generation targets)
62
+ - Extract API/Contract Test Targets: endpoint groupings by resource (these define API test file groupings)
63
+ - Extract Testing Pyramid: recommended percentages per tier
64
+ - Extract feature/module domains: identify distinct features from the architecture (auth, products, orders, users, etc.)
65
+
66
+ 3. **Read CLAUDE.md** -- focus on Module Boundaries (confirms planner reads/produces), Naming Conventions (file naming table), Verification Commands (generation plan checks), Repo Structure (directory layout), POM File Structure (BasePage, feature pages, components).
67
+
68
+ 4. **Read QA_REPO_BLUEPRINT.md** (if path provided by orchestrator in files_to_read):
69
+ - Extract the Folder Structure section for exact directory layout
70
+ - Extract the Recommended Stack for framework and file extensions
71
+ - If no blueprint exists, use CLAUDE.md Repo Structure defaults
72
+
73
+ 5. **Read codebase map documents** (if they exist -- check `{codebase_map_dir}/` or `.qa-output/codebase/`):
74
+ - **TESTABILITY.md** -- Extract pure functions (cheap unit tests) vs stateful code (integration setup needed). Use for mock complexity estimation per task.
75
+ - **TEST_SURFACE.md** -- Extract testable entry points with function signatures, parameter types, return types. Cross-reference with TEST_INVENTORY.md targets to validate coverage completeness.
76
+ - **CRITICAL_PATHS.md** -- Extract critical user flows. Use to group E2E test cases into logical flow-based tasks.
77
+ - **COVERAGE_GAPS.md** -- Extract uncovered modules. Prioritize tasks that fill critical gaps first in the execution order.
78
+ If any of these files do not exist, proceed without them.
79
+
80
+ 6. **Read Locator Registry** (if it exists):
81
+ - Check for `.qa-output/locators/LOCATOR_REGISTRY.md` (central index)
82
+ - Check for `.qa-output/locators/{feature}.locators.md` (feature-specific)
83
+ - Extract which features/pages have locator coverage and which do not
84
+ - Record locator availability per feature for complexity estimation and E2E feasibility assessment
85
+
86
+ 7. **Determine file extension** from the detected framework:
87
+ - TypeScript + Playwright: `.spec.ts` for tests, `.ts` for POMs
88
+ - TypeScript + Cypress: `.cy.ts` for E2E, `.spec.ts` for unit/API, `.ts` for POMs
89
+ - TypeScript + Jest/Vitest: `.test.ts` for unit, `.spec.ts` for API/E2E, `.ts` for POMs
90
+ - JavaScript: replace `.ts` with `.js` in all patterns above
91
+ - Python + pytest: `.py` for all files
92
+ - Other: match the conventions from QA_ANALYSIS.md framework detection
93
+
94
+ If file extension cannot be determined (no framework detected in QA_ANALYSIS.md and no QA_REPO_BLUEPRINT.md):
95
+
96
+ ```
97
+ CHECKPOINT_RETURN:
98
+ completed: "Read TEST_INVENTORY.md and QA_ANALYSIS.md, extracted all test case IDs"
99
+ blocking: "Cannot determine test file extension -- no framework detected"
100
+ details: "QA_ANALYSIS.md framework: [value]. QA_REPO_BLUEPRINT.md: [exists/not found]. Cannot assign file paths without knowing the target framework and file extension convention."
101
+ awaiting: "User specifies the test framework (Playwright, Cypress, Jest, Vitest, pytest, etc.) and language (TypeScript, JavaScript, Python)"
102
+ ```
103
+ </step>
104
+
105
+ <step name="analyze_features">
106
+ Extract feature domains from test case IDs and targets. The planner groups by FEATURE, not by pyramid tier.
107
+
108
+ **Feature extraction strategy:**
109
+
110
+ 1. **From test case IDs:** Extract the MODULE/RESOURCE/FLOW segment from each ID:
111
+ - `UT-AUTH-001` -> feature: "auth"
112
+ - `API-USERS-003` -> feature: "users"
113
+ - `INT-PAYMENT-002` -> feature: "payment"
114
+ - `E2E-LOGIN-001` -> feature: "login" (map to parent feature "auth" if applicable)
115
+ - `UT-ORDER-005` -> feature: "order"
116
+
117
+ 2. **From test targets:** Cross-reference file paths to confirm feature groupings:
118
+ - `src/services/auth.service.ts:validateToken` -> confirms "auth" feature
119
+ - `src/controllers/product.controller.ts:createProduct` -> confirms "product" feature
120
+ - `src/routes/order.routes.ts` -> confirms "order" feature
121
+
122
+ 3. **Merge related features:** Combine closely related feature domains:
123
+ - "login" + "auth" + "session" -> "auth" (if they share code paths)
124
+ - "product" + "catalog" -> "product" (if they share the same service layer)
125
+ - Keep separate if they have distinct service layers and route files
126
+
127
+ 4. **Build feature domain list:** For each feature, record:
128
+ - Feature name (lowercase, kebab-case for multi-word: e.g., "auth", "product", "shopping-cart")
129
+ - Source modules involved (file paths from targets)
130
+ - Test case count per tier (how many UT, INT, API, E2E belong to this feature)
131
+
132
+ **Critical rule (from CONTEXT.md locked decision):**
133
+ Groups test files by feature (auth tests together: unit+API+E2E), not by pyramid level. This means the "auth" group contains UT-AUTH-*, API-AUTH-*, INT-AUTH-*, and E2E-LOGIN-* -- all tiers together for the same feature.
134
+ </step>
135
+
136
+ <step name="create_feature_groups">
137
+ For each feature domain identified in the previous step, create a feature group containing all test cases across all pyramid tiers.
138
+
139
+ **For each feature group, collect:**
140
+
141
+ | Field | Description |
142
+ |-------|-------------|
143
+ | feature_name | Lowercase feature name (e.g., "auth", "product", "order") |
144
+ | test_case_ids | Complete list of all test IDs belonging to this feature, across all tiers |
145
+ | unit_tests | List of UT-* IDs in this feature |
146
+ | integration_tests | List of INT-* IDs in this feature |
147
+ | api_tests | List of API-* IDs in this feature |
148
+ | e2e_tests | List of E2E-* IDs in this feature |
149
+ | estimated_file_count | How many output files this feature will produce (unit spec, API spec, E2E spec, POM, fixture) |
150
+ | complexity | LOW / MEDIUM / HIGH based on: test case count, number of tiers involved, number of distinct source modules |
151
+
152
+ **Complexity classification:**
153
+ - **HIGH:** 10+ test cases, 3+ tiers involved, 3+ source modules, includes E2E tests requiring POMs
154
+ - **MEDIUM:** 5-9 test cases, 2+ tiers involved, 2+ source modules
155
+ - **LOW:** 1-4 test cases, 1-2 tiers involved, 1-2 source modules
156
+
157
+ **Validation:** Every test case ID from the master list (step 1) must appear in exactly one feature group. No test case should be unassigned. No test case should appear in multiple groups.
158
+
159
+ **Cross-tier verification:** For each HIGH-priority feature (features with P0 test cases), verify that the feature group has coverage across multiple tiers. A feature with only unit tests but P0 API endpoints in QA_ANALYSIS.md indicates a potential gap -- the test cases should already exist in TEST_INVENTORY.md, but if the grouping reveals an imbalance, note it in the plan output.
160
+ </step>
161
+
162
+ <step name="determine_dependencies">
163
+ Identify task ordering within and across features. Dependencies determine the execution order for the executor agent.
164
+
165
+ **Dependency rules (in priority order):**
166
+
167
+ 1. **Infrastructure tasks first:**
168
+ - BasePage creation (if no existing BasePage detected) must complete before ANY feature POM task
169
+ - Test framework config file (playwright.config.ts, jest.config.ts, etc.) must exist before any test execution
170
+ - Fixture directory creation before any test that references fixtures
171
+
172
+ 2. **POM before E2E:**
173
+ - Feature POM files (e.g., LoginPage.ts) must be created before E2E specs that import them
174
+ - Shared component POMs (e.g., NavigationBar.ts) must be created before any E2E spec that uses them
175
+
176
+ 3. **Fixtures before consumers:**
177
+ - Fixture data files (e.g., auth-data.ts, product-data.ts) must be created before test specs that import them
178
+
179
+ 4. **Unit and API tests are independent:**
180
+ - Unit tests typically have no dependencies on other generated files (they test existing source code)
181
+ - API tests typically have no dependencies on other generated files (they call existing endpoints)
182
+ - These can be generated in any order relative to each other
183
+
184
+ 5. **Within a feature, recommended order:**
185
+ - Fixture data file (if needed)
186
+ - Feature POM (if E2E tests exist for this feature)
187
+ - Unit test spec
188
+ - API test spec
189
+ - Integration test spec
190
+ - E2E test spec (depends on POM)
191
+
192
+ **Record dependencies as pairs:**
193
+ ```
194
+ task_id: "auth-pom"
195
+ depends_on: ["infrastructure-basepage"]
196
+
197
+ task_id: "auth-e2e"
198
+ depends_on: ["auth-pom", "auth-fixture"]
199
+ ```
200
+
201
+ **Validate: dependency graph MUST be acyclic.** No circular dependencies allowed. If task A depends on task B, then task B cannot depend on task A (directly or transitively). To verify: perform a topological sort of the task graph. If topological sort fails, there is a cycle -- resolve it by breaking the cycle at the least critical dependency.
202
+ </step>
203
+
204
+ <step name="assign_files">
205
+ Map each task to concrete output file paths following CLAUDE.md Naming Conventions.
206
+
207
+ **File path assignment rules:**
208
+
209
+ | Test Type | Path Pattern | Example (TypeScript + Playwright) |
210
+ |-----------|-------------|-----------------------------------|
211
+ | Unit test | `tests/unit/{feature}.unit.spec.{ext}` | `tests/unit/auth.unit.spec.ts` |
212
+ | Integration test | `tests/integration/{feature}.integration.spec.{ext}` | `tests/integration/auth.integration.spec.ts` |
213
+ | API test | `tests/api/{resource}.api.spec.{ext}` | `tests/api/users.api.spec.ts` |
214
+ | E2E smoke test | `tests/e2e/smoke/{feature}.e2e.spec.{ext}` | `tests/e2e/smoke/login.e2e.spec.ts` |
215
+ | Feature POM | `pages/{feature}/{Feature}Page.{ext}` | `pages/auth/LoginPage.ts` |
216
+ | Component POM | `pages/components/{Component}.{ext}` | `pages/components/NavigationBar.ts` |
217
+ | BasePage | `pages/base/BasePage.{ext}` | `pages/base/BasePage.ts` |
218
+ | Fixture | `fixtures/{domain}-data.{ext}` | `fixtures/auth-data.ts` |
219
+ | Test config | root or `config/` | `playwright.config.ts` |
220
+
221
+ **If QA_REPO_BLUEPRINT.md exists:** Use its folder structure instead of the defaults above. The blueprint takes precedence.
222
+
223
+ **File extension:** Use the extension determined in step 1 (read_inputs).
224
+
225
+ **E2E test files and POMs:**
226
+ - Each E2E test spec gets a corresponding POM for the primary page it tests
227
+ - If multiple E2E tests share a page, they share a single POM
228
+ - E2E-LOGIN-* and E2E-REGISTER-* might share an AuthPage POM, or have separate LoginPage and RegisterPage POMs depending on the page structure described in the test cases
229
+
230
+ **Multiple test cases per file:**
231
+ - All unit tests for the same feature go in ONE unit spec file (e.g., all UT-AUTH-* go in `auth.unit.spec.ts`)
232
+ - All API tests for the same resource go in ONE API spec file (e.g., all API-USERS-* go in `users.api.spec.ts`)
233
+ - Each E2E flow typically gets its own spec file, but closely related flows for the same page can share a file
234
+
235
+ **Validation:** Every file path must follow the naming convention. No duplicate file paths. Every test case ID must be assigned to exactly one file.
236
+ </step>
237
+
238
+ <step name="produce_plan">
239
+ Write the generation plan markdown to the output path specified by the orchestrator.
240
+
241
+ **Generation plan structure:**
242
+
243
+ ```markdown
244
+ # Generation Plan
245
+
246
+ ## Summary
247
+
248
+ | Metric | Value |
249
+ |--------|-------|
250
+ | Total tasks | {N} |
251
+ | Total files | {N} |
252
+ | Feature groups | {N} |
253
+ | Test cases covered | {N} |
254
+ | Dependency depth | {N} (longest chain of dependent tasks) |
255
+ | Framework | {detected framework} |
256
+ | File extension | {ext} |
257
+
258
+ ## Dependency Graph
259
+
260
+ {ASCII visualization of task dependencies}
261
+ Example:
262
+ infrastructure-basepage
263
+ -> auth-pom -> auth-e2e
264
+ -> product-pom -> product-e2e
265
+ auth-fixture -> auth-e2e
266
+ auth-unit (independent)
267
+ auth-api (independent)
268
+
269
+ ## Tasks
270
+
271
+ ### Task: {task_id}
272
+
273
+ | Field | Value |
274
+ |-------|-------|
275
+ | task_id | {unique task identifier, e.g., "auth-unit"} |
276
+ | feature_group | {feature name, e.g., "auth"} |
277
+ | files_to_create | {list of file paths this task produces} |
278
+ | test_case_ids | {list of test case IDs from TEST_INVENTORY this task implements} |
279
+ | depends_on | {list of task_ids that must complete before this task, or "none"} |
280
+ | estimated_complexity | {LOW / MEDIUM / HIGH} |
281
+
282
+ [... repeat for each task ...]
283
+
284
+ ## Test Case Assignment Map
285
+
286
+ | Test Case ID | Task ID | Output File |
287
+ |--------------|---------|-------------|
288
+ | UT-AUTH-001 | auth-unit | tests/unit/auth.unit.spec.ts |
289
+ | UT-AUTH-002 | auth-unit | tests/unit/auth.unit.spec.ts |
290
+ | API-USERS-001 | users-api | tests/api/users.api.spec.ts |
291
+ [... every test case from TEST_INVENTORY.md ...]
292
+
293
+ ## Unassigned Test Cases
294
+
295
+ {List any test cases not assigned -- this section should be EMPTY if the plan is correct}
296
+ ```
297
+
298
+ **Commit the output:**
299
+ ```bash
300
+ node bin/qaa-tools.cjs commit "qa(planner): produce generation plan for {project_name}" --files {output_path}
301
+ ```
302
+
303
+ Replace `{project_name}` with the project name from QA_ANALYSIS.md architecture overview.
304
+ Replace `{output_path}` with the actual path where the generation plan was written.
305
+ </step>
306
+
307
+ <step name="validate_plan">
308
+ Verify the generation plan is complete and correct before committing.
309
+
310
+ **Validation checks:**
311
+
312
+ 1. **Complete coverage:** Every test case ID from TEST_INVENTORY.md appears in exactly one task in the generation plan. Count the test case IDs in the Test Case Assignment Map and verify it matches TEST_INVENTORY.md's total_tests count.
313
+
314
+ 2. **No duplicate assignments:** No test case ID appears in more than one task. Scan the Test Case Assignment Map for duplicate test_case_ids.
315
+
316
+ 3. **No unassigned cases:** The "Unassigned Test Cases" section is empty. If any test case is unassigned, add it to the appropriate feature group and task.
317
+
318
+ 4. **Acyclic dependencies:** Perform a topological sort of the task dependency graph. If the sort succeeds, dependencies are acyclic. If it fails, there is a cycle that must be resolved.
319
+
320
+ 5. **File path conventions:** Every file path in files_to_create follows CLAUDE.md Naming Conventions:
321
+ - Unit tests match `[module].unit.spec.[ext]` pattern
322
+ - API tests match `[resource].api.spec.[ext]` pattern
323
+ - E2E tests match `[feature].e2e.spec.[ext]` pattern
324
+ - POMs match `[PageName]Page.[ext]` pattern
325
+ - Fixtures match `[domain]-data.[ext]` pattern
326
+
327
+ 6. **Feature groups have coverage:** Every feature group that contains P0 test cases has tasks spanning at least 2 pyramid tiers (e.g., unit + API, or API + E2E). Single-tier groups are acceptable only for features that genuinely warrant only one tier of testing (e.g., a pure utility module with only unit tests).
328
+
329
+ 7. **BasePage dependency:** If any task creates a feature POM, verify that the task depends on the BasePage infrastructure task (either directly or transitively through another POM task).
330
+
331
+ 8. **Summary counts match:** The Summary table's total_tasks, total_files, and test_cases_covered values match the actual task list.
332
+
333
+ **If any validation check fails:** Fix the issue in the generation plan, then re-validate. Do not proceed to commit until all checks pass.
334
+ </step>
335
+
336
+ </process>
337
+
338
+ <output>
339
+ The planner agent produces a single artifact:
340
+
341
+ - **Generation plan** markdown file at the output path specified by the orchestrator prompt
342
+
343
+ The generation plan contains:
344
+ 1. **Summary** -- Total tasks, total files, feature group count, test case count, dependency depth, framework, extension
345
+ 2. **Dependency Graph** -- ASCII visualization of task ordering
346
+ 3. **Tasks** -- Per-task details: task_id, feature_group, files_to_create, test_case_ids, depends_on, estimated_complexity
347
+ 4. **Test Case Assignment Map** -- Complete mapping of every test case ID to its task and output file
348
+ 5. **Unassigned Test Cases** -- Should be empty; any remaining unassigned IDs listed here
349
+
350
+ **Return to orchestrator:**
351
+
352
+ After writing and committing, return these values to the orchestrator:
353
+
354
+ ```
355
+ PLANNER_COMPLETE:
356
+ file_path: "{output_path}"
357
+ total_tasks: {N}
358
+ total_files: {N}
359
+ feature_count: {N}
360
+ dependency_depth: {N}
361
+ test_case_count: {N}
362
+ commit_hash: "{hash}"
363
+ ```
364
+ </output>
365
+
366
+ <quality_gate>
367
+ Before considering the plan complete, verify ALL of the following.
368
+
369
+ **From CLAUDE.md Verification Commands (generation plan checks -- verbatim):**
370
+
371
+ - [ ] Test cases mapped to output files
372
+ - [ ] No unassigned cases
373
+ - [ ] No duplicate assignments
374
+
375
+ **Additional planner-specific checks:**
376
+
377
+ - [ ] Groups organized by feature, not by pyramid level (feature groups contain mixed tiers: UT-* + API-* + E2E-* for the same feature)
378
+ - [ ] Dependencies are acyclic (topological sort succeeds)
379
+ - [ ] File paths follow CLAUDE.md naming conventions (unit: `[module].unit.spec.[ext]`, API: `[resource].api.spec.[ext]`, E2E: `[feature].e2e.spec.[ext]`, POM: `[PageName]Page.[ext]`, fixture: `[domain]-data.[ext]`)
380
+ - [ ] Every feature group has unit + API or E2E coverage (not single-tier groups unless the feature only warrants one tier of testing)
381
+ - [ ] BasePage listed as dependency for all POM tasks (directly or transitively)
382
+ - [ ] Output path matches orchestrator specification (not hardcoded)
383
+ - [ ] Summary counts (total_tasks, total_files, test_cases_covered) match actual task list
384
+ - [ ] Test Case Assignment Map contains every test case ID from TEST_INVENTORY.md
385
+ - [ ] Feature extraction is by domain (auth, product, order), not by pyramid level (unit, API, E2E)
386
+ - [ ] Every task has a unique task_id
387
+ - [ ] Every task specifies at least one file_to_create
388
+ - [ ] Every task specifies at least one test_case_id
389
+
390
+ If any check fails, fix the issue before writing the final output. Do not proceed with a failing quality gate.
391
+ </quality_gate>
392
+
393
+ <success_criteria>
394
+ The planner agent has completed successfully when:
395
+
396
+ 1. Generation plan exists at the output path specified by the orchestrator
397
+ 2. Every test case ID from TEST_INVENTORY.md is assigned to exactly one task (no unassigned, no duplicates)
398
+ 3. Feature groups contain test cases across multiple pyramid tiers (grouped by feature, not by tier)
399
+ 4. Dependency graph is acyclic (topological sort succeeds)
400
+ 5. All file paths follow CLAUDE.md naming conventions
401
+ 6. BasePage dependency enforced for all POM tasks
402
+ 7. Generation plan is committed via `node bin/qaa-tools.cjs commit`
403
+ 8. Return values provided to orchestrator: file_path, total_tasks, total_files, feature_count, dependency_depth, test_case_count, commit_hash
404
+ 9. All quality gate checks pass
405
+ </success_criteria>