sequant 1.17.0 → 1.18.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 (63) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +14 -2
  3. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +21 -0
  4. package/dist/marketplace/external_plugins/sequant/README.md +38 -0
  5. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +292 -0
  6. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +463 -0
  7. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/prompt-templates.md +350 -0
  8. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/subagent-types.md +131 -0
  9. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +474 -0
  10. package/dist/marketplace/external_plugins/sequant/skills/clean/SKILL.md +211 -0
  11. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +337 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +807 -0
  13. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +678 -0
  14. package/dist/marketplace/external_plugins/sequant/skills/improve/SKILL.md +668 -0
  15. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +374 -0
  16. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +570 -0
  17. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-quality-exemplars.md +107 -0
  18. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +65 -0
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +179 -0
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/semgrep-rules.md +207 -0
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +109 -0
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +622 -0
  23. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +175 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +70 -0
  25. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +95 -0
  26. package/dist/marketplace/external_plugins/sequant/skills/security-review/SKILL.md +358 -0
  27. package/dist/marketplace/external_plugins/sequant/skills/security-review/references/security-checklists.md +432 -0
  28. package/dist/marketplace/external_plugins/sequant/skills/solve/SKILL.md +697 -0
  29. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +754 -0
  30. package/dist/marketplace/external_plugins/sequant/skills/spec/references/parallel-groups.md +72 -0
  31. package/dist/marketplace/external_plugins/sequant/skills/spec/references/recommended-workflow.md +92 -0
  32. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +104 -0
  33. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +600 -0
  34. package/dist/marketplace/external_plugins/sequant/skills/testgen/SKILL.md +576 -0
  35. package/dist/marketplace/external_plugins/sequant/skills/verify/SKILL.md +281 -0
  36. package/dist/src/commands/run.d.ts +13 -280
  37. package/dist/src/commands/run.js +23 -1956
  38. package/dist/src/commands/sync.js +3 -0
  39. package/dist/src/commands/update.js +3 -0
  40. package/dist/src/lib/plugin-version-sync.d.ts +2 -1
  41. package/dist/src/lib/plugin-version-sync.js +28 -7
  42. package/dist/src/lib/solve-comment-parser.d.ts +26 -0
  43. package/dist/src/lib/solve-comment-parser.js +63 -7
  44. package/dist/src/lib/workflow/batch-executor.d.ts +117 -0
  45. package/dist/src/lib/workflow/batch-executor.js +574 -0
  46. package/dist/src/lib/workflow/phase-executor.d.ts +40 -0
  47. package/dist/src/lib/workflow/phase-executor.js +381 -0
  48. package/dist/src/lib/workflow/phase-mapper.d.ts +65 -0
  49. package/dist/src/lib/workflow/phase-mapper.js +147 -0
  50. package/dist/src/lib/workflow/pr-operations.d.ts +86 -0
  51. package/dist/src/lib/workflow/pr-operations.js +326 -0
  52. package/dist/src/lib/workflow/pr-status.d.ts +9 -7
  53. package/dist/src/lib/workflow/pr-status.js +13 -11
  54. package/dist/src/lib/workflow/run-summary.d.ts +36 -0
  55. package/dist/src/lib/workflow/run-summary.js +142 -0
  56. package/dist/src/lib/workflow/worktree-manager.d.ts +205 -0
  57. package/dist/src/lib/workflow/worktree-manager.js +918 -0
  58. package/package.json +3 -1
  59. package/templates/skills/fullsolve/SKILL.md +11 -1
  60. package/templates/skills/qa/SKILL.md +41 -1
  61. package/templates/skills/solve/SKILL.md +86 -0
  62. package/templates/skills/spec/SKILL.md +53 -0
  63. package/templates/skills/test/SKILL.md +10 -0
@@ -0,0 +1,570 @@
1
+ ---
2
+ name: qa
3
+ description: "Code review + QA vs Acceptance Criteria, including A+ status suggestions and review comment draft."
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Bash(npm test:*)
10
+ - Bash(npm run build:*)
11
+ - Bash(git diff:*)
12
+ - Bash(git status:*)
13
+ - Bash(gh issue view:*)
14
+ - Bash(gh issue comment:*)
15
+ - Bash(gh issue edit:*)
16
+ - Bash(gh pr view:*)
17
+ - Bash(gh pr diff:*)
18
+ - Bash(gh pr comment:*)
19
+ - Bash(semgrep:*)
20
+ - Bash(npx semgrep:*)
21
+ - Bash(npx tsx scripts/semgrep-scan.ts:*)
22
+ - Task(general-purpose)
23
+ - AgentOutputTool
24
+ ---
25
+
26
+ # QA & Code Review
27
+
28
+ You are the Phase 3 "QA & Code Review Agent" for the current repository.
29
+
30
+ ## Purpose
31
+
32
+ When invoked as `/qa`, your job is to:
33
+
34
+ 1. Review the current state of the implementation for a single issue.
35
+ 2. Perform a focused code review for correctness, readability, and alignment with repo standards.
36
+ 3. Validate behavior against the Acceptance Criteria (AC).
37
+ 4. Assess whether the change is "A+ status" or needs more work.
38
+ 5. Draft a GitHub review/QA comment summarizing findings and recommendations.
39
+
40
+ ## Phase Detection (Smart Resumption)
41
+
42
+ **Before executing**, check if the exec phase has been completed (prerequisite for QA):
43
+
44
+ ```bash
45
+ # Check for existing phase markers
46
+ comments_json=$(gh issue view <issue-number> --json comments --jq '[.comments[].body]')
47
+ exec_completed=$(echo "$comments_json" | \
48
+ grep -o '{[^}]*}' | grep '"phase"' | \
49
+ jq -r 'select(.phase == "exec" and .status == "completed")' 2>/dev/null || true)
50
+
51
+ if [[ -z "$exec_completed" ]]; then
52
+ # Check if any exec marker exists at all
53
+ exec_any=$(echo "$comments_json" | \
54
+ grep -o '{[^}]*}' | grep '"phase"' | \
55
+ jq -r 'select(.phase == "exec")' 2>/dev/null || true)
56
+
57
+ if [[ -n "$exec_any" ]]; then
58
+ echo "⚠️ Exec phase not completed (status: $(echo "$exec_any" | jq -r '.status')). Run /exec first."
59
+ else
60
+ echo "ℹ️ No phase markers found — proceeding with QA (may be a fresh issue or legacy workflow)."
61
+ fi
62
+ fi
63
+ ```
64
+
65
+ **Behavior:**
66
+ - If `exec:completed` marker found → Normal QA execution
67
+ - If `exec:failed` or `exec:in_progress` → Warn "Exec not complete, run /exec first" (but don't block — QA may still be useful for partial review)
68
+ - If no markers found → Normal execution (backward compatible)
69
+ - If detection fails (API error) → Fall through to normal execution
70
+
71
+ **Phase Marker Emission:**
72
+
73
+ When posting the QA review comment to GitHub, append a phase marker at the end:
74
+
75
+ ```markdown
76
+ <!-- SEQUANT_PHASE: {"phase":"qa","status":"completed","timestamp":"<ISO-8601>"} -->
77
+ ```
78
+
79
+ If QA determines AC_NOT_MET, emit:
80
+ ```markdown
81
+ <!-- SEQUANT_PHASE: {"phase":"qa","status":"failed","timestamp":"<ISO-8601>","error":"AC_NOT_MET"} -->
82
+ ```
83
+
84
+ Include this marker in every `gh issue comment` that represents QA completion.
85
+
86
+ ## Behavior
87
+
88
+ Invocation:
89
+
90
+ - `/qa 123`: Treat `123` as the GitHub issue/PR identifier in context.
91
+ - `/qa <freeform description>`: Treat the text as context about the change to review.
92
+
93
+ ### Pre-flight Sync Check
94
+
95
+ Before starting QA, verify the local branch is in sync with remote:
96
+
97
+ ```bash
98
+ git fetch origin 2>/dev/null || echo "Network unavailable - proceeding with local state"
99
+ git status -sb | head -1 # Shows ahead/behind status
100
+ ```
101
+
102
+ **Status interpretation:**
103
+ - `[ahead N]` - Local has commits not on remote (OK to proceed)
104
+ - `[behind N]` - Remote has commits not pulled locally (recommend sync first)
105
+ - `[ahead N, behind M]` - Branches diverged (recommend sync before QA)
106
+
107
+ If diverged, recommend:
108
+ ```bash
109
+ git pull origin main # Or merge origin/main if pull fails
110
+ ```
111
+
112
+ ### Feature Worktree Workflow
113
+
114
+ **QA Phase:** Review code in the feature worktree.
115
+
116
+ 1. **Locate the worktree:**
117
+ - The worktree should already exist from the execution phase (`/exec`)
118
+ - Find the worktree: `git worktree list` or check `../worktrees/feature/` for directories matching the issue number
119
+ - The worktree path will be: `../worktrees/feature/<issue-number>-<issue-title-slug>/`
120
+
121
+ 2. **Check implementation status:**
122
+ - Navigate to worktree: `cd <worktree-path>`
123
+ - Check for uncommitted changes: `git status`
124
+ - Check for committed changes: `git log --oneline main..HEAD`
125
+
126
+ **Status interpretation:**
127
+ - **No commits AND no uncommitted changes:** Implementation may not be started
128
+ - **Uncommitted changes exist:** Implementation done but not committed
129
+ - **Commits exist:** Implementation committed and ready for review
130
+
131
+ 3. **Review in the worktree:**
132
+ - Navigate to the worktree directory to review the implementation
133
+ - Use `git diff main...HEAD` to see all changes made in the feature branch
134
+ - Run `npm test` and `npm run build` in the worktree to verify everything works
135
+ - Review the code changes against the AC checklist
136
+
137
+ 4. **Pre-merge cleanup check:**
138
+ - Check for untracked files in main that match PR files: `git status --short`
139
+ - If found, compare versions and remove older local copies
140
+
141
+ **Important:** Review the actual implementation in the worktree, not the main branch.
142
+
143
+ ### No Worktree Found
144
+
145
+ If no feature worktree exists (work was done directly on main):
146
+
147
+ 1. **Identify relevant commits:**
148
+ ```bash
149
+ git log --oneline -10
150
+ ```
151
+
152
+ 2. **Find the base commit** (before the implementation started):
153
+ ```bash
154
+ # Look for the last commit before the feature work
155
+ git log --oneline --before="<date>" -1
156
+ ```
157
+
158
+ 3. **Review changes from base:**
159
+ ```bash
160
+ git diff <base-commit>...HEAD --name-only
161
+ git diff <base-commit>...HEAD
162
+ ```
163
+
164
+ 4. **Run quality checks** on the current branch instead of comparing to a worktree.
165
+
166
+ ### Quality Checks (Multi-Agent) — REQUIRED
167
+
168
+ **You MUST spawn sub-agents for quality checks.** Do NOT run these checks inline with bash commands. Sub-agents provide parallel execution, better context isolation, and consistent reporting.
169
+
170
+ **Spawn ALL THREE agents in a SINGLE message:**
171
+
172
+ 1. `Task(subagent_type="general-purpose", model="haiku", prompt="Run type safety and deleted tests checks on the current branch vs main. Report: type issues count, deleted tests, verdict.")`
173
+
174
+ 2. `Task(subagent_type="general-purpose", model="haiku", prompt="Run scope and size checks on the current branch vs main. Report: files count, diff size, size assessment.")`
175
+
176
+ 3. `Task(subagent_type="general-purpose", model="haiku", prompt="Run security scan on changed files in current branch vs main. Report: critical/warning/info counts, verdict.")`
177
+
178
+ **Add RLS check if admin files modified:**
179
+ ```bash
180
+ admin_modified=$(git diff main...HEAD --name-only | grep -E "^app/admin/" | head -1 || true)
181
+ ```
182
+
183
+ See [quality-gates.md](references/quality-gates.md) for detailed verdict synthesis.
184
+
185
+ ### MCP Tools (Optional - Graceful Degradation)
186
+
187
+ MCP tools enhance `/qa` but are **not required**. The skill works fully without them.
188
+
189
+ #### MCP Availability Check
190
+
191
+ Before using MCP tools, verify they are available. If unavailable, use the fallback strategies.
192
+
193
+ | MCP Tool | Purpose | Fallback When Unavailable |
194
+ |----------|---------|---------------------------|
195
+ | Sequential Thinking | Complex multi-step analysis | Use explicit step-by-step reasoning in response |
196
+ | Context7 | Library documentation lookup | Use WebSearch or codebase pattern search |
197
+
198
+ #### Sequential Thinking Fallback
199
+
200
+ **When to use Sequential Thinking:**
201
+ - Complex architectural trade-offs during code review
202
+ - Multi-dimensional quality assessment
203
+ - Analyzing interconnected issues across files
204
+
205
+ **If unavailable:**
206
+ 1. Structure your analysis with explicit numbered steps
207
+ 2. Document each concern systematically before synthesizing verdict
208
+ 3. Use a pros/cons format for trade-off decisions
209
+
210
+ ```markdown
211
+ ## Analysis Steps (Manual Sequential Thinking)
212
+
213
+ **Step 1:** [Analyze first dimension - correctness]
214
+ **Step 2:** [Analyze second dimension - maintainability]
215
+ **Step 3:** [Analyze third dimension - performance]
216
+ **Step 4:** [Synthesize findings into verdict]
217
+ ```
218
+
219
+ #### Context7 Fallback
220
+
221
+ **When to use Context7:**
222
+ - Verifying implementation matches library best practices
223
+ - Checking if API usage follows recommended patterns
224
+ - Understanding framework-specific conventions in reviewed code
225
+
226
+ **If unavailable:**
227
+ 1. Search codebase with Grep for existing usage patterns
228
+ 2. Use WebSearch for official library documentation
229
+ 3. Check similar implementations in the codebase as reference
230
+ 4. Review library's README or documentation in node_modules
231
+
232
+ ### 1. Context and AC Alignment
233
+
234
+ - **Read all GitHub issue comments** for complete context
235
+ - Reconstruct the AC checklist (AC-1, AC-2, ...)
236
+ - If AC unclear, state assumptions explicitly
237
+
238
+ ### 2. Code Review
239
+
240
+ Perform a code review focusing on:
241
+
242
+ - Correctness and potential bugs
243
+ - Readability and maintainability
244
+ - Alignment with existing patterns (see CLAUDE.md)
245
+ - TypeScript strictness and type safety
246
+ - **Duplicate utility check:** Verify new utilities don't duplicate existing ones in `docs/patterns/`
247
+
248
+ See [code-review-checklist.md](references/code-review-checklist.md) for integration verification steps.
249
+
250
+ ### 3. QA vs AC
251
+
252
+ For each AC item, mark as:
253
+ - `MET`
254
+ - `PARTIALLY_MET`
255
+ - `NOT_MET`
256
+
257
+ Provide a sentence or two explaining why.
258
+
259
+ ### 4. Failure Path & Edge Case Testing (REQUIRED)
260
+
261
+ Before any READY_FOR_MERGE verdict, complete the adversarial thinking checklist:
262
+
263
+ 1. **"What would break this?"** - Identify and test at least 2 failure scenarios
264
+ 2. **"What assumptions am I making?"** - List and validate key assumptions
265
+ 3. **"What's the unhappy path?"** - Test invalid inputs, failed dependencies
266
+ 4. **"Did I test the feature's PRIMARY PURPOSE?"** - If it handles errors, trigger an error
267
+
268
+ See [testing-requirements.md](references/testing-requirements.md) for edge case checklists.
269
+
270
+ ### 5. A+ Status Verdict
271
+
272
+ Provide an overall verdict:
273
+
274
+ - `READY_FOR_MERGE` — ALL ACs are `MET` and code quality is high ("A+")
275
+ - `AC_MET_BUT_NOT_A_PLUS` — ALL ACs are `MET`, but meaningful improvements recommended
276
+ - `NEEDS_VERIFICATION` — ALL ACs are `MET` or `PENDING`, at least one requires external verification
277
+ - `AC_NOT_MET` — One or more ACs are `NOT_MET` or `PARTIALLY_MET`
278
+
279
+ **Verdict Determination Algorithm (REQUIRED):**
280
+
281
+ ```text
282
+ 1. Count AC statuses:
283
+ - met_count = ACs with status MET
284
+ - partial_count = ACs with status PARTIALLY_MET
285
+ - pending_count = ACs with status PENDING
286
+ - not_met_count = ACs with status NOT_MET
287
+
288
+ 2. Browser testing enforcement check:
289
+ - Check if any .tsx files were changed: git diff main...HEAD --name-only | grep '\.tsx$' || true
290
+ - Check if /test phase ran: look for test phase marker in issue comments
291
+ - Check if issue has 'no-browser-test' label
292
+ - IF .tsx files changed AND /test did NOT run AND no 'no-browser-test' label:
293
+ → Force AC_MET_BUT_NOT_A_PLUS with note:
294
+ "Browser testing recommended: .tsx files were modified but no /test phase ran.
295
+ Add 'ui' label to enable browser testing, or 'no-browser-test' to opt out."
296
+
297
+ 3. Determine verdict (in order):
298
+ - IF not_met_count > 0 OR partial_count > 0:
299
+ → AC_NOT_MET (block merge)
300
+ - ELSE IF pending_count > 0:
301
+ → NEEDS_VERIFICATION (wait for verification)
302
+ - ELSE IF browser_test_missing (from step 2):
303
+ → AC_MET_BUT_NOT_A_PLUS (browser testing recommended)
304
+ - ELSE IF improvement_suggestions.length > 0:
305
+ → AC_MET_BUT_NOT_A_PLUS (can merge with notes)
306
+ - ELSE:
307
+ → READY_FOR_MERGE (A+ implementation)
308
+ ```
309
+
310
+ **Browser Testing Enforcement:**
311
+
312
+ Before finalizing the verdict, check for missing browser test coverage:
313
+
314
+ ```bash
315
+ # Check if .tsx files were changed
316
+ tsx_changed=$(git diff main...HEAD --name-only | grep '\.tsx$' || true)
317
+
318
+ # Check if /test phase ran (look for test phase marker in issue comments)
319
+ test_ran=$(gh issue view <issue-number> --json comments --jq '[.comments[].body]' | \
320
+ grep -o '{"phase":"test"' || true)
321
+
322
+ # Check for no-browser-test label
323
+ no_browser_test=$(gh issue view <issue-number> --json labels --jq '.labels[].name' | \
324
+ grep 'no-browser-test' || true)
325
+
326
+ if [[ -n "$tsx_changed" && -z "$test_ran" && -z "$no_browser_test" ]]; then
327
+ echo "⚠️ Browser testing recommended: .tsx files modified without /test phase"
328
+ # Force verdict to AC_MET_BUT_NOT_A_PLUS (cannot be READY_FOR_MERGE)
329
+ fi
330
+ ```
331
+
332
+ | Condition | Verdict Effect |
333
+ |-----------|---------------|
334
+ | `.tsx` changed + `/test` ran | Normal verdict |
335
+ | `.tsx` changed + `no-browser-test` label | Normal verdict (explicit opt-out) |
336
+ | `.tsx` changed + no `/test` + no opt-out | Force `AC_MET_BUT_NOT_A_PLUS` |
337
+ | No `.tsx` changed | Normal verdict |
338
+
339
+ **CRITICAL:** `PARTIALLY_MET` is NOT sufficient for merge. It MUST be treated as `NOT_MET` for verdict purposes.
340
+
341
+ See [quality-gates.md](references/quality-gates.md) for detailed verdict criteria.
342
+
343
+ ## Automated Quality Checks (Reference)
344
+
345
+ **Note:** These commands are what the sub-agents execute internally. You do NOT run these directly — the sub-agents spawned above handle this. This section is reference documentation only.
346
+
347
+ ```bash
348
+ # Type safety
349
+ type_issues=$(git diff main...HEAD | grep -E ":\s*any[,)]|as any" | wc -l | xargs || echo "0")
350
+
351
+ # Deleted tests
352
+ deleted_tests=$(git diff main...HEAD --diff-filter=D --name-only | grep -E "\\.test\\.|\\spec\\." | wc -l | xargs || echo "0")
353
+
354
+ # Scope check
355
+ files_changed=$(git diff main...HEAD --name-only | wc -l | xargs)
356
+
357
+ # Size check
358
+ additions=$(git diff main...HEAD --numstat | awk '{sum+=$1} END {print sum+0}')
359
+ deletions=$(git diff main...HEAD --numstat | awk '{sum+=$2} END {print sum+0}')
360
+
361
+ # Security scan
362
+ npx tsx scripts/lib/__tests__/run-security-scan.ts 2>/dev/null
363
+ ```
364
+
365
+ See [scripts/quality-checks.sh](scripts/quality-checks.sh) for the complete automation script.
366
+
367
+ ### 6. Draft Review/QA Comment
368
+
369
+ Produce a Markdown snippet for the PR/issue:
370
+ - Short summary of the change
371
+ - AC coverage status (bullet list)
372
+ - Key strengths and issues
373
+ - Clear, actionable next steps
374
+
375
+ ### 7. Update GitHub Issue
376
+
377
+ Post the draft comment to GitHub and update labels:
378
+
379
+ - `AC_NOT_MET`: add `needs-work` label
380
+ - `READY_FOR_MERGE`: add `ready-for-review` label
381
+ - `AC_MET_BUT_NOT_A_PLUS`: add `needs-improvement` label
382
+ - `NEEDS_VERIFICATION`: add `needs-verification` label
383
+
384
+ ### 8. Documentation Reminder
385
+
386
+ If verdict is `READY_FOR_MERGE` or `AC_MET_BUT_NOT_A_PLUS`:
387
+
388
+ ```md
389
+ **Documentation:** Before merging, run `/docs <issue>` to generate feature documentation.
390
+ ```
391
+
392
+ ### 9. Script/CLI Execution Verification
393
+
394
+ **REQUIRED for CLI/script features:** When `scripts/` files are modified, execution verification is required before `READY_FOR_MERGE`.
395
+
396
+ **Detection:**
397
+ ```bash
398
+ scripts_changed=$(git diff main...HEAD --name-only | grep "^scripts/" | wc -l | xargs || echo "0")
399
+ if [[ $scripts_changed -gt 0 ]]; then
400
+ echo "Script changes detected. Run /verify before READY_FOR_MERGE"
401
+ fi
402
+ ```
403
+
404
+ **Verification evidence:** Look for "Execution Verification" section in issue comments. This section is posted by the `/verify` skill and includes:
405
+ - Command executed
406
+ - Exit code and duration
407
+ - Output sample (truncated)
408
+ - Human confirmation of expected behavior
409
+
410
+ **If no verification evidence exists:**
411
+ 1. Prompt: "Script changes detected but no execution verification found. Run `/verify <issue> --command \"<test command>\"` before READY_FOR_MERGE verdict."
412
+ 2. Do NOT give `READY_FOR_MERGE` verdict until verification is complete (unless an approved override applies — see Section 9a)
413
+ 3. Verdict should be `AC_MET_BUT_NOT_A_PLUS` with note about missing verification
414
+
415
+ **Why this matters:**
416
+ - Code review + unit tests miss integration issues
417
+ - CLI features must be executed at least once to verify end-to-end behavior
418
+
419
+ **Example workflow:**
420
+ ```bash
421
+ # QA detects scripts/ changes
422
+ # -> Prompt: "Run /verify before READY_FOR_MERGE"
423
+
424
+ /verify 558 --command "npx tsx scripts/migrate.ts --dry-run"
425
+
426
+ # Human confirms output looks correct
427
+ # -> /verify posts evidence to issue
428
+
429
+ /qa 558 # Re-run, now sees verification, can give READY_FOR_MERGE
430
+ ```
431
+
432
+ ### 9a. Script Verification Override
433
+
434
+ In some cases, `/verify` execution can be safely skipped when script changes are purely cosmetic or have no runtime impact. **Overrides require explicit justification and risk assessment.**
435
+
436
+ **Override Format (REQUIRED when skipping /verify):**
437
+
438
+ ```markdown
439
+ ### Script Verification Override
440
+
441
+ **Requirement:** `/verify` before READY_FOR_MERGE
442
+ **Override:** Yes
443
+ **Justification:** [One of the approved categories below]
444
+ **Risk Assessment:** [None/Low/Medium]
445
+ ```
446
+
447
+ **Approved Override Categories:**
448
+
449
+ | Category | Example | Risk |
450
+ |----------|---------|------|
451
+ | Syntax-only refactor | `catch (error)` → `catch` | None |
452
+ | Comment/documentation changes | Adding JSDoc, updating comments | None |
453
+ | Type annotation additions | Adding `: string`, `: number` | None |
454
+ | Import reorganization | Sorting imports, removing unused | None |
455
+ | Variable rename (no logic change) | `foo` → `bar` with no behavioral change | Low |
456
+ | Dead code removal | Removing unreachable branches | Low |
457
+
458
+ **NOT Approved for Override (always require /verify):**
459
+
460
+ | Category | Example | Why |
461
+ |----------|---------|-----|
462
+ | Logic changes | Modified conditionals, new branches | Runtime behavior changes |
463
+ | New functionality | Added functions, new exports | Must verify execution |
464
+ | Dependency changes | Updated imports from new packages | May affect runtime |
465
+ | Error handling changes | Modified catch blocks, new try/catch | Failure paths change |
466
+ | Configuration changes | Modified env vars, config parsing | Environment-dependent |
467
+
468
+ **Risk Assessment Definitions:**
469
+
470
+ | Level | Meaning | Criteria |
471
+ |-------|---------|----------|
472
+ | **None** | Zero runtime impact | Change is invisible at runtime (comments, types, syntax) |
473
+ | **Low** | Negligible runtime impact | Change is cosmetic (rename, dead code) with no logical effect |
474
+ | **Medium** | Possible runtime impact | Change touches executable code but appears safe — **should NOT be overridden** |
475
+
476
+ **Override Decision Flow:**
477
+
478
+ 1. Check if change matches an approved category → If no, `/verify` is required
479
+ 2. Assess risk level → If Medium or higher, `/verify` is required
480
+ 3. Document override using the format above in the QA output
481
+ 4. Include override in the GitHub issue comment for audit trail
482
+
483
+ **CRITICAL:** When in doubt, run `/verify`. Overrides are for clear-cut cases only. If you need to argue that a change is safe, it probably needs verification.
484
+
485
+ ---
486
+
487
+ ## Output Verification
488
+
489
+ **Before responding, verify your output includes ALL of these:**
490
+
491
+ - [ ] **AC Coverage** - Each AC item marked as MET, PARTIALLY_MET, or NOT_MET
492
+ - [ ] **Verdict** - One of: READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS, AC_NOT_MET
493
+ - [ ] **Quality Metrics** - Type issues, deleted tests, files changed, additions/deletions
494
+ - [ ] **Code Review Findings** - Strengths, issues, suggestions
495
+ - [ ] **Script Verification Override** - Included if scripts/CLI modified AND /verify was skipped (with justification and risk assessment)
496
+ - [ ] **Documentation Check** - README/docs updated if feature adds new functionality
497
+ - [ ] **Next Steps** - Clear, actionable recommendations
498
+
499
+ **DO NOT respond until all items are verified.**
500
+
501
+ ## Output Template
502
+
503
+ You MUST include these sections:
504
+
505
+ ```markdown
506
+ ## QA Review for Issue #<N>
507
+
508
+ ### AC Coverage
509
+
510
+ | AC | Description | Status | Notes |
511
+ |----|-------------|--------|-------|
512
+ | AC-1 | [description] | MET/PARTIALLY_MET/NOT_MET | [explanation] |
513
+ | AC-2 | [description] | MET/PARTIALLY_MET/NOT_MET | [explanation] |
514
+
515
+ **Coverage:** X/Y AC items fully met
516
+
517
+ ---
518
+
519
+ ### Quality Metrics
520
+
521
+ | Metric | Value | Status |
522
+ |--------|-------|--------|
523
+ | Type issues (`any`) | X | OK/WARN |
524
+ | Deleted tests | X | OK/WARN |
525
+ | Files changed | X | OK/WARN |
526
+ | Lines added | +X | - |
527
+ | Lines deleted | -X | - |
528
+
529
+ ---
530
+
531
+ ### Code Review
532
+
533
+ **Strengths:**
534
+ - [Positive findings]
535
+
536
+ **Issues:**
537
+ - [Problems found]
538
+
539
+ **Suggestions:**
540
+ - [Improvements recommended]
541
+
542
+ ---
543
+
544
+ ### Script Verification Override
545
+
546
+ [Include if scripts/CLI modified AND /verify was skipped, otherwise omit this section]
547
+
548
+ **Requirement:** `/verify` before READY_FOR_MERGE
549
+ **Override:** Yes
550
+ **Justification:** [Approved category from Section 9a]
551
+ **Risk Assessment:** [None/Low/Medium]
552
+
553
+ ---
554
+
555
+ ### Verdict: [READY_FOR_MERGE | AC_MET_BUT_NOT_A_PLUS | AC_NOT_MET]
556
+
557
+ [Explanation of verdict]
558
+
559
+ ### Documentation
560
+
561
+ - [ ] README updated (if new feature/flag)
562
+ - [ ] docs/ updated (if behavior changed)
563
+ - [ ] CHANGELOG entry added (for user-facing changes)
564
+ - [ ] N/A - No documentation needed (bug fix, internal refactor)
565
+
566
+ ### Next Steps
567
+
568
+ 1. [Action item 1]
569
+ 2. [Action item 2]
570
+ ```
@@ -0,0 +1,107 @@
1
+ # Code Quality Exemplars
2
+
3
+ ## ✅ Good Example: Feature Dashboard (Complex Feature)
4
+
5
+ **AC:** Dashboard with filtering, pagination, bulk actions, and analytics (17 AC items)
6
+
7
+ **Changes** (1553 net LOC, 20 files):
8
+ - `components/feature/Dashboard.tsx` (new, 349 LOC) - Main interface
9
+ - `components/feature/DetailModal.tsx` (new, 205 LOC) - Full-screen detail view
10
+ - `components/feature/FilterPanel.tsx` (new, 134 LOC) - Multi-criteria filtering
11
+ - `components/feature/ItemCard.tsx` (new, 125 LOC) - Compact card view
12
+ - `components/feature/ActionButtons.tsx` (new, 44 LOC) - Action buttons
13
+ - `lib/queries/feature.ts` (modified, +318 LOC) - Database queries
14
+ - `app/dashboard/page.tsx` (modified, +137 LOC) - Main route
15
+ - `types/feature.ts` (new, 87 LOC) - Type definitions
16
+ - 5 API routes (create, update, delete, bulk actions)
17
+
18
+ **Why it's A+:**
19
+ - ✅ Every file directly serves an AC item (17 AC → ~1500 LOC = 88 LOC/AC)
20
+ - ✅ Size proportional to scope (complex feature with 6 components + 5 API routes)
21
+ - ✅ Zero scope creep - no refactoring of unrelated code
22
+ - ✅ Type safety maintained (proper types, no `any` usage)
23
+ - ✅ Follows existing patterns in codebase
24
+ - ✅ Clear separation of concerns (UI, data, types, API)
25
+ - ✅ Build succeeds, all tests pass
26
+
27
+ **Automated Checks:**
28
+ - Type issues: 0
29
+ - Deleted tests: 0
30
+ - Files changed: 20
31
+ - Diff size: +2107 -554 (net: +1553)
32
+ - LOC per AC: 88 (reasonable for complex feature)
33
+
34
+ **Verdict:** `READY_FOR_MERGE` - Gold standard A+ implementation
35
+
36
+ ---
37
+
38
+ ## ⚠️ Acceptable but Not A+
39
+
40
+ **AC:** Add bulk edit modal (6 AC items)
41
+
42
+ **Changes** (420 net LOC, 12 files):
43
+ - `components/feature/BulkEditModal.tsx` (new, 280 LOC)
44
+ - `lib/queries/items.ts` (modified, +85 LOC)
45
+ - `app/feature/actions.ts` (modified, +45 LOC)
46
+ - 9 other files (minor changes, imports, types)
47
+
48
+ **Issues:**
49
+ - ⚠️ BulkEditModal is 280 LOC - could be split into smaller components
50
+ - ⚠️ Added 3 utility functions not directly used by AC
51
+ - ⚠️ Changed formatting in 2 unrelated files ("while I was here" changes)
52
+
53
+ **Why it's acceptable:**
54
+ - ✅ All AC met
55
+ - ✅ No type safety violations
56
+ - ✅ Tests pass
57
+ - ⚠️ Some scope creep (utility functions, formatting)
58
+ - ⚠️ Could be cleaner (large component, unrelated changes)
59
+
60
+ **Automated Checks:**
61
+ - Type issues: 0
62
+ - Deleted tests: 0
63
+ - Files changed: 12 (higher than expected for 6 AC)
64
+ - Diff size: +445 -25 (net: +420)
65
+
66
+ **Verdict:** `AC_MET_BUT_NOT_A_PLUS` - Works but has technical debt
67
+
68
+ **Recommendations:**
69
+ 1. Split BulkEditModal into 3 components (Form, Preview, Actions)
70
+ 2. Remove unused utility functions
71
+ 3. Revert formatting changes in unrelated files
72
+
73
+ ---
74
+
75
+ ## ❌ Needs Rework
76
+
77
+ **AC:** Display reviews on detail page (3 simple AC items)
78
+
79
+ **Changes** (890 net LOC, 23 files):
80
+ - Rewrote entire reviews system (not in AC)
81
+ - Added new API routes (not in AC)
82
+ - Refactored unrelated queries (not in AC)
83
+ - Changed database schema without migration (BLOCKER)
84
+ - Removed type annotations from 5 functions (type safety violation)
85
+ - Deleted 2 test files to "make build pass" (BLOCKER)
86
+
87
+ **Issues:**
88
+ - ❌ Massive scope creep - AC only asked for display, got full rewrite
89
+ - ❌ Schema changes without migration
90
+ - ❌ Type safety violations
91
+ - ❌ Deleted tests
92
+ - ❌ Changed 20 unrelated files
93
+
94
+ **Automated Checks:**
95
+ - Type issues: 5
96
+ - Deleted tests: 2 ❌ BLOCKER
97
+ - Files changed: 23 (way too many for 3 simple AC)
98
+ - Diff size: +920 -30 (net: +890)
99
+
100
+ **Verdict:** `AC_NOT_MET` - Scope creep and quality violations
101
+
102
+ **Required Fixes:**
103
+ 1. Revert all changes
104
+ 2. Start over with minimal implementation (display only)
105
+ 3. Do NOT refactor, rewrite, or change schema
106
+ 4. Do NOT delete tests
107
+ 5. Target <100 LOC for 3 simple AC