sequant 1.0.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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/bin/cli.d.ts +8 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/bin/cli.js +70 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/src/commands/doctor.d.ts +8 -0
  8. package/dist/src/commands/doctor.d.ts.map +1 -0
  9. package/dist/src/commands/doctor.js +171 -0
  10. package/dist/src/commands/doctor.js.map +1 -0
  11. package/dist/src/commands/init.d.ts +11 -0
  12. package/dist/src/commands/init.d.ts.map +1 -0
  13. package/dist/src/commands/init.js +124 -0
  14. package/dist/src/commands/init.js.map +1 -0
  15. package/dist/src/commands/run.d.ts +18 -0
  16. package/dist/src/commands/run.d.ts.map +1 -0
  17. package/dist/src/commands/run.js +229 -0
  18. package/dist/src/commands/run.js.map +1 -0
  19. package/dist/src/commands/status.d.ts +5 -0
  20. package/dist/src/commands/status.d.ts.map +1 -0
  21. package/dist/src/commands/status.js +45 -0
  22. package/dist/src/commands/status.js.map +1 -0
  23. package/dist/src/commands/update.d.ts +10 -0
  24. package/dist/src/commands/update.d.ts.map +1 -0
  25. package/dist/src/commands/update.js +124 -0
  26. package/dist/src/commands/update.js.map +1 -0
  27. package/dist/src/index.d.ts +15 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +13 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/lib/fs.d.ts +10 -0
  32. package/dist/src/lib/fs.d.ts.map +1 -0
  33. package/dist/src/lib/fs.js +44 -0
  34. package/dist/src/lib/fs.js.map +1 -0
  35. package/dist/src/lib/manifest.d.ts +14 -0
  36. package/dist/src/lib/manifest.d.ts.map +1 -0
  37. package/dist/src/lib/manifest.js +37 -0
  38. package/dist/src/lib/manifest.js.map +1 -0
  39. package/dist/src/lib/stacks.d.ts +22 -0
  40. package/dist/src/lib/stacks.d.ts.map +1 -0
  41. package/dist/src/lib/stacks.js +131 -0
  42. package/dist/src/lib/stacks.js.map +1 -0
  43. package/dist/src/lib/templates.d.ts +16 -0
  44. package/dist/src/lib/templates.d.ts.map +1 -0
  45. package/dist/src/lib/templates.js +118 -0
  46. package/dist/src/lib/templates.js.map +1 -0
  47. package/dist/src/lib/workflow/cli-args.d.ts +138 -0
  48. package/dist/src/lib/workflow/cli-args.d.ts.map +1 -0
  49. package/dist/src/lib/workflow/cli-args.js +210 -0
  50. package/dist/src/lib/workflow/cli-args.js.map +1 -0
  51. package/dist/src/lib/workflow/execute-issues.d.ts +42 -0
  52. package/dist/src/lib/workflow/execute-issues.d.ts.map +1 -0
  53. package/dist/src/lib/workflow/execute-issues.js +463 -0
  54. package/dist/src/lib/workflow/execute-issues.js.map +1 -0
  55. package/dist/src/lib/workflow/logger.d.ts +168 -0
  56. package/dist/src/lib/workflow/logger.d.ts.map +1 -0
  57. package/dist/src/lib/workflow/logger.js +249 -0
  58. package/dist/src/lib/workflow/logger.js.map +1 -0
  59. package/dist/src/lib/workflow/types.d.ts +89 -0
  60. package/dist/src/lib/workflow/types.d.ts.map +1 -0
  61. package/dist/src/lib/workflow/types.js +23 -0
  62. package/dist/src/lib/workflow/types.js.map +1 -0
  63. package/package.json +69 -0
  64. package/stacks/go.yaml +22 -0
  65. package/stacks/nextjs.yaml +28 -0
  66. package/stacks/python.yaml +24 -0
  67. package/stacks/rust.yaml +23 -0
  68. package/templates/hooks/post-tool.sh +301 -0
  69. package/templates/hooks/pre-tool.sh +350 -0
  70. package/templates/memory/constitution.md +60 -0
  71. package/templates/scripts/cleanup-worktree.sh +78 -0
  72. package/templates/scripts/list-worktrees.sh +50 -0
  73. package/templates/scripts/new-feature.sh +156 -0
  74. package/templates/settings.json +26 -0
  75. package/templates/skills/assess/SKILL.md +428 -0
  76. package/templates/skills/clean/SKILL.md +196 -0
  77. package/templates/skills/docs/SKILL.md +323 -0
  78. package/templates/skills/exec/SKILL.md +426 -0
  79. package/templates/skills/fullsolve/SKILL.md +479 -0
  80. package/templates/skills/loop/SKILL.md +310 -0
  81. package/templates/skills/qa/SKILL.md +261 -0
  82. package/templates/skills/qa/references/code-quality-exemplars.md +112 -0
  83. package/templates/skills/qa/references/code-review-checklist.md +77 -0
  84. package/templates/skills/qa/references/quality-gates.md +95 -0
  85. package/templates/skills/qa/references/testing-requirements.md +109 -0
  86. package/templates/skills/qa/scripts/quality-checks.sh +109 -0
  87. package/templates/skills/reflect/SKILL.md +159 -0
  88. package/templates/skills/reflect/references/documentation-tiers.md +70 -0
  89. package/templates/skills/reflect/references/phase-reflection.md +95 -0
  90. package/templates/skills/reflect/scripts/workflow-queries.ts +165 -0
  91. package/templates/skills/security-review/SKILL.md +344 -0
  92. package/templates/skills/security-review/references/security-checklists.md +377 -0
  93. package/templates/skills/solve/SKILL.md +242 -0
  94. package/templates/skills/spec/SKILL.md +169 -0
  95. package/templates/skills/spec/references/parallel-groups.md +72 -0
  96. package/templates/skills/spec/references/verification-criteria.md +104 -0
  97. package/templates/skills/test/SKILL.md +508 -0
  98. package/templates/skills/testgen/SKILL.md +561 -0
  99. package/templates/skills/verify/SKILL.md +266 -0
@@ -0,0 +1,310 @@
1
+ ---
2
+ name: loop
3
+ description: "Quality loop - Parse test/QA findings and iterate until quality gates pass"
4
+ license: MIT
5
+ metadata:
6
+ author: sequant
7
+ version: "1.0"
8
+ allowed-tools:
9
+ - Read
10
+ - Edit
11
+ - Write
12
+ - Glob
13
+ - Grep
14
+ - Bash
15
+ - TodoWrite
16
+ - mcp__chrome-devtools__*
17
+ - mcp__supabase__*
18
+ - Bash(gh issue view:*)
19
+ - Bash(gh issue comment:*)
20
+ - Bash(npm test:*)
21
+ - Bash(npm run build:*)
22
+ - Bash(git diff:*)
23
+ - Bash(git status:*)
24
+ ---
25
+
26
+ # Quality Loop Command
27
+
28
+ You are the "Quality Loop Agent" for the current repository.
29
+
30
+ ## Purpose
31
+
32
+ When invoked as `/loop <issue-number>`, your job is to:
33
+
34
+ 1. Read the previous phase output from `/tmp/claude-issue-<N>.log`
35
+ 2. Parse findings from the last `/test` or `/qa` phase
36
+ 3. Fix the identified issues
37
+ 4. Re-run validation until quality gates pass
38
+ 5. Exit when `READY_FOR_MERGE` or max iterations reached
39
+
40
+ ## Invocation
41
+
42
+ - `/loop 123` - Parse log for issue #123, fix issues, re-validate
43
+
44
+ ## Workflow
45
+
46
+ ### Step 1: Read Previous Phase Output
47
+
48
+ ```bash
49
+ # Read the log file for this issue
50
+ cat /tmp/claude-issue-<issue-number>.log
51
+ ```
52
+
53
+ Parse the log to find:
54
+ - **Last phase executed:** `/test` or `/qa`
55
+ - **Verdict:** `READY_FOR_MERGE`, `AC_NOT_MET`, `AC_MET_BUT_NOT_A_PLUS`
56
+ - **Test results:** PASS/FAIL/BLOCKED counts
57
+ - **Issues to fix:** Numbered recommendations or bug descriptions
58
+
59
+ ### Step 2: Detect Phase and Parse Findings
60
+
61
+ **If last phase was `/test`:**
62
+ Look for patterns like:
63
+ - `X/Y tests passed`
64
+ - `FAIL` or `BLOCKED` test results
65
+ - `### Bugs Found` section
66
+ - `### Issues to Fix` section
67
+
68
+ Extract:
69
+ - Failed test descriptions
70
+ - Bug locations and descriptions
71
+ - Blocked test dependencies
72
+
73
+ **If last phase was `/qa`:**
74
+ Look for patterns like:
75
+ - `Verdict: AC_NOT_MET` or `Verdict: AC_MET_BUT_NOT_A_PLUS`
76
+ - `NOT_MET` or `PARTIALLY_MET` AC items
77
+ - `### Issues` or `### Recommendations` sections
78
+
79
+ Extract:
80
+ - AC items marked NOT_MET or PARTIALLY_MET
81
+ - Specific recommendations
82
+ - Required fixes
83
+
84
+ ### Step 3: Check Exit Conditions
85
+
86
+ **Exit loop if:**
87
+ - Verdict is `READY_FOR_MERGE` - Nothing to fix!
88
+ - No actionable issues found
89
+ - Max iterations reached (3 by default)
90
+
91
+ **Continue loop if:**
92
+ - Tests failed
93
+ - AC not met
94
+ - Specific issues identified
95
+
96
+ ### Step 4: Locate Feature Worktree
97
+
98
+ Find the worktree for this issue:
99
+ ```bash
100
+ git worktree list | grep -E "feature.*<issue-number>"
101
+ ```
102
+
103
+ Or check:
104
+ ```bash
105
+ ls ../worktrees/feature/<issue-number>-*/
106
+ ```
107
+
108
+ Navigate to the worktree directory for making fixes.
109
+
110
+ ### Step 5: Fix Identified Issues
111
+
112
+ For each issue found in the log:
113
+
114
+ 1. **Understand the issue:** Read relevant code to understand the problem
115
+ 2. **Plan the fix:** Determine minimal change needed
116
+ 3. **Implement fix:** Make targeted changes
117
+ 4. **Verify locally:** Run `npm test` and `npm run build`
118
+
119
+ **Quality Standards (from /exec):**
120
+ - Make minimal, focused changes
121
+ - Avoid scope creep
122
+ - Maintain type safety (no `any`)
123
+ - Don't delete or modify unrelated tests
124
+
125
+ ### Step 6: Re-run Validation
126
+
127
+ After fixes are applied, re-run the phase that found issues:
128
+
129
+ **If fixing `/test` issues:**
130
+ - Use Chrome DevTools MCP to re-run failed tests
131
+ - Mark tests as PASS/FAIL based on fix
132
+ - Generate updated test summary
133
+
134
+ **If fixing `/qa` issues:**
135
+ - Run automated quality checks:
136
+ ```bash
137
+ npm test
138
+ npm run build
139
+ git diff main...HEAD --stat
140
+ ```
141
+ - Re-evaluate AC coverage
142
+ - Update verdict
143
+
144
+ ### Step 7: Iteration Check
145
+
146
+ After re-validation:
147
+
148
+ **If issues remain:**
149
+ - Increment iteration counter
150
+ - If iteration < MAX_ITERATIONS (3): Go back to Step 5
151
+ - If iteration >= MAX_ITERATIONS: Exit with summary
152
+
153
+ **If all issues fixed:**
154
+ - Confirm `READY_FOR_MERGE` status
155
+ - Post success comment to GitHub issue
156
+
157
+ ## Output Format
158
+
159
+ ### Progress Updates
160
+
161
+ For each iteration, output:
162
+
163
+ ```markdown
164
+ ## Loop Iteration X/3
165
+
166
+ ### Issues from Previous Phase
167
+ 1. [Issue description]
168
+ 2. [Issue description]
169
+
170
+ ### Fixes Applied
171
+ - [Fix 1]: [file:line] - [description]
172
+ - [Fix 2]: [file:line] - [description]
173
+
174
+ ### Re-validation Results
175
+ - Tests: X/Y passed
176
+ - Build: PASS/FAIL
177
+ - AC Coverage: X/Y met
178
+
179
+ ### Status
180
+ [FIXED - Continue to QA | NEEDS_MORE_WORK | MAX_ITERATIONS_REACHED]
181
+ ```
182
+
183
+ ### Final Summary
184
+
185
+ ```markdown
186
+ ## Quality Loop Complete
187
+
188
+ **Issue:** #<N>
189
+ **Iterations:** X/3
190
+ **Final Status:** [READY_FOR_MERGE | NEEDS_MANUAL_REVIEW]
191
+
192
+ ### Issues Fixed
193
+ 1. [Issue] - Fixed in [file:line]
194
+ 2. [Issue] - Fixed in [file:line]
195
+
196
+ ### Remaining Issues (if any)
197
+ - [Issue that couldn't be auto-fixed]
198
+
199
+ ### Recommended Next Steps
200
+ - [If READY_FOR_MERGE]: Run `/qa <N>` for final review
201
+ - [If manual review needed]: [Specific guidance]
202
+ ```
203
+
204
+ ## Integration with Workflow
205
+
206
+ **Interactive usage:**
207
+ ```bash
208
+ /spec 218 # Plan
209
+ /exec 218 # Implement
210
+ /test 218 # Test - finds 2 bugs
211
+ /loop 218 # Fixes bugs, re-tests, confirms PASS
212
+ /qa 218 # Final QA - READY_FOR_MERGE
213
+ ```
214
+
215
+ **Automated usage (execute-issues.ts):**
216
+ ```bash
217
+ QUALITY_LOOP=true npx tsx --env-file=.env.local scripts/dev/execute-issues.ts 218
218
+ # Phases: spec → testgen → exec → test → (loop if needed) → qa → (loop if needed)
219
+ ```
220
+
221
+ ## Example Log Parsing
222
+
223
+ ### Test Log Example
224
+
225
+ ```
226
+ /test 218
227
+ ## Testing Results for Issue #218
228
+
229
+ **Summary:** 8/10 tests passed
230
+
231
+ ### Test Results
232
+
233
+ **Test 1: Basic image selection** - PASS
234
+ **Test 2: External URL validation** - FAIL
235
+ - Expected: URL validation error message
236
+ - Actual: No error shown for invalid URLs
237
+ - Issue: Validation not triggering on blur
238
+
239
+ **Test 3: Focal point picker** - BLOCKED
240
+ - Blocker: Modal not opening due to Test 2 failure
241
+
242
+ ### Bugs Found
243
+
244
+ 1. **URL validation not working**
245
+ - Location: components/admin/news/ExternalUrlTab.tsx:45
246
+ - Issue: onBlur handler missing validation call
247
+ - Status: needs fix
248
+ ```
249
+
250
+ **Parsed Output:**
251
+ - Last phase: `/test`
252
+ - Failed tests: 2 (Test 2, Test 3)
253
+ - Issues to fix:
254
+ 1. URL validation missing onBlur handler at `ExternalUrlTab.tsx:45`
255
+ 2. Test 3 blocked - depends on Test 2 fix
256
+
257
+ ### QA Log Example
258
+
259
+ ```
260
+ /qa 218
261
+ ## QA Review for Issue #218
262
+
263
+ ### AC Coverage
264
+
265
+ - AC-1: MET
266
+ - AC-2: MET
267
+ - AC-3: PARTIALLY_MET - External URL validation incomplete
268
+ - AC-4: NOT_MET - Focal point not persisted to database
269
+
270
+ ### Verdict: AC_NOT_MET
271
+
272
+ ### Required Fixes
273
+
274
+ 1. Complete URL validation in ExternalUrlTab
275
+ 2. Add focal point persistence in updateArticleImage action
276
+ ```
277
+
278
+ **Parsed Output:**
279
+ - Last phase: `/qa`
280
+ - Verdict: `AC_NOT_MET`
281
+ - Issues to fix:
282
+ 1. AC-3: Complete URL validation
283
+ 2. AC-4: Add focal point persistence
284
+
285
+ ## Error Handling
286
+
287
+ **If log file doesn't exist:**
288
+ ```
289
+ Error: Log file not found at /tmp/claude-issue-<N>.log
290
+ Please run /spec, /exec, /test, or /qa first.
291
+ ```
292
+
293
+ **If no issues found but not READY_FOR_MERGE:**
294
+ ```
295
+ Warning: No specific issues found in log.
296
+ Recommend running /qa <N> for fresh assessment.
297
+ ```
298
+
299
+ **If worktree not found:**
300
+ ```
301
+ Error: Feature worktree not found for issue #<N>
302
+ Expected: ../worktrees/feature/<N>-*/
303
+ Please run /exec <N> first to create the worktree.
304
+ ```
305
+
306
+ ## Configuration
307
+
308
+ **Max iterations:** 3 (prevents infinite loops)
309
+ **Re-validation after each fix:** Required
310
+ **GitHub comment:** Posted after loop completion
@@ -0,0 +1,261 @@
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
+ - Task
20
+ - AgentOutputTool
21
+ ---
22
+
23
+ # QA & Code Review
24
+
25
+ You are the Phase 3 "QA & Code Review Agent" for the current repository.
26
+
27
+ ## Purpose
28
+
29
+ When invoked as `/qa`, your job is to:
30
+
31
+ 1. Review the current state of the implementation for a single issue.
32
+ 2. Perform a focused code review for correctness, readability, and alignment with repo standards.
33
+ 3. Validate behavior against the Acceptance Criteria (AC).
34
+ 4. Assess whether the change is "A+ status" or needs more work.
35
+ 5. Draft a GitHub review/QA comment summarizing findings and recommendations.
36
+
37
+ ## Behavior
38
+
39
+ Invocation:
40
+
41
+ - `/qa 123`: Treat `123` as the GitHub issue/PR identifier in context.
42
+ - `/qa <freeform description>`: Treat the text as context about the change to review.
43
+
44
+ ### Feature Worktree Workflow
45
+
46
+ **QA Phase:** Review code in the feature worktree.
47
+
48
+ 1. **Locate the worktree:**
49
+ - The worktree should already exist from the execution phase (`/exec`)
50
+ - Find the worktree: `git worktree list` or check `../worktrees/feature/` for directories matching the issue number
51
+ - The worktree path will be: `../worktrees/feature/<issue-number>-<issue-title-slug>/`
52
+
53
+ 2. **Check implementation status:**
54
+ - Navigate to worktree: `cd <worktree-path>`
55
+ - Check for uncommitted changes: `git status`
56
+ - Check for committed changes: `git log --oneline main..HEAD`
57
+
58
+ **Status interpretation:**
59
+ - **No commits AND no uncommitted changes:** Implementation may not be started
60
+ - **Uncommitted changes exist:** Implementation done but not committed
61
+ - **Commits exist:** Implementation committed and ready for review
62
+
63
+ 3. **Review in the worktree:**
64
+ - Navigate to the worktree directory to review the implementation
65
+ - Use `git diff main...HEAD` to see all changes made in the feature branch
66
+ - Run `npm test` and `npm run build` in the worktree to verify everything works
67
+ - Review the code changes against the AC checklist
68
+
69
+ 4. **Pre-merge cleanup check:**
70
+ - Check for untracked files in main that match PR files: `git status --short`
71
+ - If found, compare versions and remove older local copies
72
+
73
+ **Important:** Review the actual implementation in the worktree, not the main branch.
74
+
75
+ ### No Worktree Found
76
+
77
+ If no feature worktree exists (work was done directly on main):
78
+
79
+ 1. **Identify relevant commits:**
80
+ ```bash
81
+ git log --oneline -10
82
+ ```
83
+
84
+ 2. **Find the base commit** (before the implementation started):
85
+ ```bash
86
+ # Look for the last commit before the feature work
87
+ git log --oneline --before="<date>" -1
88
+ ```
89
+
90
+ 3. **Review changes from base:**
91
+ ```bash
92
+ git diff <base-commit>...HEAD --name-only
93
+ git diff <base-commit>...HEAD
94
+ ```
95
+
96
+ 4. **Run quality checks** on the current branch instead of comparing to a worktree.
97
+
98
+ ### Parallel Quality Checks (Multi-Agent)
99
+
100
+ Before detailed manual review, run quality checks in parallel using specialized agents.
101
+
102
+ **Spawn agents in a SINGLE message:**
103
+
104
+ ```
105
+ Task(subagent_type="quality-checker", model="haiku",
106
+ prompt="Run type safety and deleted tests checks. Report: type issues count, deleted tests, verdict.")
107
+
108
+ Task(subagent_type="quality-checker", model="haiku",
109
+ prompt="Run scope and size checks. Report: files count, diff size, size assessment.")
110
+
111
+ Task(subagent_type="quality-checker", model="haiku",
112
+ prompt="Run security scan on changed files. Report: critical/warning/info counts, verdict.")
113
+ ```
114
+
115
+ **Add RLS check if admin files modified:**
116
+ ```bash
117
+ admin_modified=$(git diff main...HEAD --name-only | grep -E "^app/admin/" | head -1)
118
+ ```
119
+
120
+ See [quality-gates.md](references/quality-gates.md) for detailed verdict synthesis.
121
+
122
+ ### Using MCP Tools
123
+
124
+ - **Sequential Thinking:** For complex multi-step analysis
125
+ - **Context7:** For broader pattern context
126
+ - **Supabase MCP:** For database-related code verification
127
+
128
+ ### 1. Context and AC Alignment
129
+
130
+ - **Read all GitHub issue comments** for complete context
131
+ - Reconstruct the AC checklist (AC-1, AC-2, ...)
132
+ - If AC unclear, state assumptions explicitly
133
+
134
+ ### 2. Code Review
135
+
136
+ Perform a code review focusing on:
137
+
138
+ - Correctness and potential bugs
139
+ - Readability and maintainability
140
+ - Alignment with existing patterns (see CLAUDE.md)
141
+ - TypeScript strictness and type safety
142
+ - **Duplicate utility check:** Verify new utilities don't duplicate existing ones in `docs/patterns/`
143
+
144
+ See [code-review-checklist.md](references/code-review-checklist.md) for integration verification steps.
145
+
146
+ ### 3. QA vs AC
147
+
148
+ For each AC item, mark as:
149
+ - `MET`
150
+ - `PARTIALLY_MET`
151
+ - `NOT_MET`
152
+
153
+ Provide a sentence or two explaining why.
154
+
155
+ ### 4. Failure Path & Edge Case Testing (REQUIRED)
156
+
157
+ Before any READY_FOR_MERGE verdict, complete the adversarial thinking checklist:
158
+
159
+ 1. **"What would break this?"** - Identify and test at least 2 failure scenarios
160
+ 2. **"What assumptions am I making?"** - List and validate key assumptions
161
+ 3. **"What's the unhappy path?"** - Test invalid inputs, failed dependencies
162
+ 4. **"Did I test the feature's PRIMARY PURPOSE?"** - If it handles errors, trigger an error
163
+
164
+ See [testing-requirements.md](references/testing-requirements.md) for edge case checklists.
165
+
166
+ ### 5. A+ Status Verdict
167
+
168
+ Provide an overall verdict:
169
+
170
+ - `READY_FOR_MERGE` — AC met and code quality is high ("A+")
171
+ - `AC_MET_BUT_NOT_A_PLUS` — AC met, but meaningful improvements recommended
172
+ - `AC_NOT_MET` — AC not fully met; additional implementation needed
173
+
174
+ See [quality-gates.md](references/quality-gates.md) for detailed verdict criteria.
175
+
176
+ ## Automated Quality Checks
177
+
178
+ Run these before detailed review (or use parallel agents above):
179
+
180
+ ```bash
181
+ # Type safety
182
+ type_issues=$(git diff main...HEAD | grep -E ":\s*any[,)]|as any" | wc -l | xargs)
183
+
184
+ # Deleted tests
185
+ deleted_tests=$(git diff main...HEAD --diff-filter=D --name-only | grep -E "\\.test\\.|\\spec\\." | wc -l | xargs)
186
+
187
+ # Scope check
188
+ files_changed=$(git diff main...HEAD --name-only | wc -l | xargs)
189
+
190
+ # Size check
191
+ additions=$(git diff main...HEAD --numstat | awk '{sum+=$1} END {print sum+0}')
192
+ deletions=$(git diff main...HEAD --numstat | awk '{sum+=$2} END {print sum+0}')
193
+
194
+ # Security scan
195
+ npx tsx scripts/lib/__tests__/run-security-scan.ts 2>/dev/null
196
+ ```
197
+
198
+ See [scripts/quality-checks.sh](scripts/quality-checks.sh) for the complete automation script.
199
+
200
+ ### 6. Draft Review/QA Comment
201
+
202
+ Produce a Markdown snippet for the PR/issue:
203
+ - Short summary of the change
204
+ - AC coverage status (bullet list)
205
+ - Key strengths and issues
206
+ - Clear, actionable next steps
207
+
208
+ ### 7. Update GitHub Issue
209
+
210
+ Post the draft comment to GitHub and update labels:
211
+ - `AC_NOT_MET`: add `needs-work` label
212
+ - `READY_FOR_MERGE`: add `ready-for-review` label
213
+ - `AC_MET_BUT_NOT_A_PLUS`: add `needs-improvement` label
214
+
215
+ ### 8. Documentation Reminder
216
+
217
+ If verdict is `READY_FOR_MERGE` or `AC_MET_BUT_NOT_A_PLUS`:
218
+
219
+ ```md
220
+ **Documentation:** Before merging, run `/docs <issue>` to generate feature documentation.
221
+ ```
222
+
223
+ ### 9. Script/CLI Execution Verification
224
+
225
+ **REQUIRED for CLI/script features:** When `scripts/` files are modified, execution verification is required before `READY_FOR_MERGE`.
226
+
227
+ **Detection:**
228
+ ```bash
229
+ scripts_changed=$(git diff main...HEAD --name-only | grep "^scripts/" | wc -l | xargs)
230
+ if [[ $scripts_changed -gt 0 ]]; then
231
+ echo "Script changes detected. Run /verify before READY_FOR_MERGE"
232
+ fi
233
+ ```
234
+
235
+ **Verification evidence:** Look for "Execution Verification" section in issue comments. This section is posted by the `/verify` skill and includes:
236
+ - Command executed
237
+ - Exit code and duration
238
+ - Output sample (truncated)
239
+ - Human confirmation of expected behavior
240
+
241
+ **If no verification evidence exists:**
242
+ 1. Prompt: "Script changes detected but no execution verification found. Run `/verify <issue> --command \"<test command>\"` before READY_FOR_MERGE verdict."
243
+ 2. Do NOT give `READY_FOR_MERGE` verdict until verification is complete
244
+ 3. Verdict should be `AC_MET_BUT_NOT_A_PLUS` with note about missing verification
245
+
246
+ **Why this matters:**
247
+ - Code review + unit tests miss integration issues
248
+ - CLI features must be executed at least once to verify end-to-end behavior
249
+
250
+ **Example workflow:**
251
+ ```bash
252
+ # QA detects scripts/ changes
253
+ # -> Prompt: "Run /verify before READY_FOR_MERGE"
254
+
255
+ /verify 558 --command "npx tsx scripts/dev/execute-issues.ts 535 --phases spec"
256
+
257
+ # Human confirms output looks correct
258
+ # -> /verify posts evidence to issue
259
+
260
+ /qa 558 # Re-run, now sees verification, can give READY_FOR_MERGE
261
+ ```
@@ -0,0 +1,112 @@
1
+ # Code Quality Exemplars
2
+
3
+ ## ✅ Good Example: Content Ideas Queue (Issue #146)
4
+
5
+
6
+
7
+ **AC:** Content Ideas Queue with filtering, pagination, bulk actions, and scoring (17 AC items)
8
+
9
+ **Changes** (1553 net LOC, 20 files):
10
+ - `components/admin/news/ContentIdeasList.tsx` (new, 349 LOC) - Main queue interface
11
+ - `components/admin/news/IdeaDetailModal.tsx` (new, 205 LOC) - Full-screen review modal
12
+ - `components/admin/news/IdeaScoringForm.tsx` (new, 160 LOC) - Interactive scoring UI
13
+ - `components/admin/news/IdeasFilters.tsx` (new, 134 LOC) - Multi-criteria filtering
14
+ - `components/admin/news/IdeaCard.tsx` (new, 125 LOC) - Compact card view
15
+ - `components/admin/news/IdeaActions.tsx` (new, 44 LOC) - Action buttons
16
+ - `lib/queries/news.ts` (modified, +318 LOC) - Database queries for ideas
17
+ - `app/admin/news/ideas/page.tsx` (modified, +137 LOC) - Main route
18
+ - `types/database.ts` (modified, type regeneration with +383/-554 LOC)
19
+ - `types/news.ts` (new, 87 LOC) - Type definitions
20
+ - 5 API routes (promote, archive, score, bulk actions)
21
+
22
+ **Why it's A+:**
23
+ - ✅ Every file directly serves an AC item (17 AC → ~1500 LOC = 88 LOC/AC)
24
+ - ✅ Size proportional to scope (complex feature with 6 components + 5 API routes)
25
+ - ✅ Zero scope creep - no refactoring of unrelated code
26
+ - ✅ Type safety improved (removed all 'as never' assertions, added proper types)
27
+ - ✅ Follows existing admin patterns (List + Card + Modal + Actions)
28
+ - ✅ Clear separation of concerns (UI, data, types, API)
29
+ - ✅ Comprehensive: filtering, pagination, bulk operations, scoring
30
+ - ✅ Build succeeds, all 280 tests pass
31
+
32
+ **Automated Checks:**
33
+ - Type issues: 0 (actually improved type safety)
34
+ - Deleted tests: 0
35
+ - Files changed: 20
36
+ - Diff size: +2107 -554 (net: +1553)
37
+ - LOC per AC: 88 (reasonable for complex feature)
38
+
39
+ **Verdict:** `READY_FOR_MERGE` - Gold standard A+ implementation
40
+
41
+ ---
42
+
43
+ ## ⚠️ Acceptable but Not A+
44
+
45
+ **AC:** Add bulk edit modal for shops (6 AC items)
46
+
47
+ **Changes** (420 net LOC, 12 files):
48
+ - `components/admin/shops/BulkEditModal.tsx` (new, 280 LOC)
49
+ - `lib/queries/shops.ts` (modified, +85 LOC)
50
+ - `app/admin/shops/review/actions.ts` (modified, +45 LOC)
51
+ - 9 other files (minor changes, imports, types)
52
+
53
+ **Issues:**
54
+ - ⚠️ BulkEditModal is 280 LOC - could be split into smaller components
55
+ - ⚠️ Added 3 utility functions to `lib/utils/formatting.ts` not directly used
56
+ - ⚠️ Changed formatting in 2 unrelated files ("while I was here" changes)
57
+
58
+ **Why it's acceptable:**
59
+ - ✅ All AC met
60
+ - ✅ No type safety violations
61
+ - ✅ Tests pass
62
+ - ⚠️ Some scope creep (utility functions, formatting)
63
+ - ⚠️ Could be cleaner (large component, unrelated changes)
64
+
65
+ **Automated Checks:**
66
+ - Type issues: 0
67
+ - Deleted tests: 0
68
+ - Files changed: 12 (higher than expected for 6 AC)
69
+ - Diff size: +445 -25 (net: +420)
70
+
71
+ **Verdict:** `AC_MET_BUT_NOT_A_PLUS` - Works but has technical debt
72
+
73
+ **Recommendations:**
74
+ 1. Split BulkEditModal into 3 components (Form, Preview, Actions)
75
+ 2. Remove unused utility functions
76
+ 3. Revert formatting changes in unrelated files
77
+
78
+ ---
79
+
80
+ ## ❌ Needs Rework
81
+
82
+ **AC:** Display shop reviews on detail page (3 simple AC items)
83
+
84
+ **Changes** (890 net LOC, 23 files):
85
+ - Rewrote entire reviews system (not in AC)
86
+ - Added new reviews API routes (not in AC)
87
+ - Refactored unrelated shop queries (not in AC)
88
+ - Changed database schema without migration (BLOCKER)
89
+ - Removed type annotations from 5 functions (type safety violation)
90
+ - Deleted 2 test files to "make build pass" (BLOCKER)
91
+
92
+ **Issues:**
93
+ - ❌ Massive scope creep - AC only asked for display, got full rewrite
94
+ - ❌ Schema changes without migration
95
+ - ❌ Type safety violations
96
+ - ❌ Deleted tests
97
+ - ❌ Changed 20 unrelated files
98
+
99
+ **Automated Checks:**
100
+ - Type issues: 5
101
+ - Deleted tests: 2 ❌ BLOCKER
102
+ - Files changed: 23 (way too many for 3 simple AC)
103
+ - Diff size: +920 -30 (net: +890)
104
+
105
+ **Verdict:** `AC_NOT_MET` - Scope creep and quality violations
106
+
107
+ **Required Fixes:**
108
+ 1. Revert all changes
109
+ 2. Start over with minimal implementation (display only)
110
+ 3. Do NOT refactor, rewrite, or change schema
111
+ 4. Do NOT delete tests
112
+ 5. Target <100 LOC for 3 simple AC