@lvlup-sw/exarchos 2.0.1

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 (153) hide show
  1. package/.claude-plugin/marketplace.json +22 -0
  2. package/.claude-plugin/plugin.json +17 -0
  3. package/.mcp.json +17 -0
  4. package/AGENTS.md +59 -0
  5. package/CLAUDE.md.template +62 -0
  6. package/LICENSE +202 -0
  7. package/README.md +258 -0
  8. package/commands/autocompact.md +37 -0
  9. package/commands/checkpoint.md +85 -0
  10. package/commands/cleanup.md +99 -0
  11. package/commands/debug.md +145 -0
  12. package/commands/delegate.md +56 -0
  13. package/commands/ideate.md +82 -0
  14. package/commands/plan.md +150 -0
  15. package/commands/refactor.md +139 -0
  16. package/commands/reload.md +37 -0
  17. package/commands/resume.md +130 -0
  18. package/commands/review.md +51 -0
  19. package/commands/sync-schemas.md +74 -0
  20. package/commands/synthesize.md +122 -0
  21. package/commands/tdd.md +58 -0
  22. package/dist/exarchos-cli.js +8828 -0
  23. package/dist/exarchos-mcp.js +50 -0
  24. package/hooks/hooks.json +53 -0
  25. package/package.json +59 -0
  26. package/rules/coding-standards.md +46 -0
  27. package/rules/mcp-tool-guidance.md +26 -0
  28. package/rules/pr-descriptions.md +12 -0
  29. package/rules/rm-safety.md +9 -0
  30. package/rules/skill-path-resolution.md +10 -0
  31. package/rules/tdd.md +41 -0
  32. package/rules/telemetry-awareness.md +9 -0
  33. package/scripts/assess-refactor-scope.sh +239 -0
  34. package/scripts/check-benchmark-regression.sh +229 -0
  35. package/scripts/check-coderabbit.sh +288 -0
  36. package/scripts/check-coverage-thresholds.sh +194 -0
  37. package/scripts/check-polish-scope.sh +245 -0
  38. package/scripts/check-property-tests.sh +167 -0
  39. package/scripts/check-tdd-compliance.sh +265 -0
  40. package/scripts/coderabbit-review-gate.sh +518 -0
  41. package/scripts/debug-review-gate.sh +201 -0
  42. package/scripts/extract-fix-tasks.sh +179 -0
  43. package/scripts/extract-task.sh +67 -0
  44. package/scripts/generate-traceability.sh +209 -0
  45. package/scripts/investigation-timer.sh +171 -0
  46. package/scripts/needs-schema-sync.sh +174 -0
  47. package/scripts/new-project.sh +103 -0
  48. package/scripts/post-delegation-check.sh +317 -0
  49. package/scripts/pre-synthesis-check.sh +440 -0
  50. package/scripts/reconcile-state.sh +346 -0
  51. package/scripts/reconstruct-stack.sh +432 -0
  52. package/scripts/review-diff.sh +63 -0
  53. package/scripts/review-verdict.sh +169 -0
  54. package/scripts/security-scan.sh +248 -0
  55. package/scripts/select-debug-track.sh +186 -0
  56. package/scripts/setup-worktree.sh +323 -0
  57. package/scripts/spec-coverage-check.sh +230 -0
  58. package/scripts/static-analysis-gate.sh +236 -0
  59. package/scripts/sync-labels.sh +122 -0
  60. package/scripts/validate-companion.sh +161 -0
  61. package/scripts/validate-dotnet-standards.sh +267 -0
  62. package/scripts/validate-installation.sh +101 -0
  63. package/scripts/validate-plugin.sh +223 -0
  64. package/scripts/validate-refactor.sh +234 -0
  65. package/scripts/validate-rm.sh +93 -0
  66. package/scripts/verify-delegation-saga.sh +240 -0
  67. package/scripts/verify-doc-links.sh +211 -0
  68. package/scripts/verify-ideate-artifacts.sh +296 -0
  69. package/scripts/verify-plan-coverage.sh +228 -0
  70. package/scripts/verify-review-triage.sh +219 -0
  71. package/scripts/verify-worktree-baseline.sh +159 -0
  72. package/scripts/verify-worktree.sh +84 -0
  73. package/settings.json +47 -0
  74. package/skills/brainstorming/SKILL.md +127 -0
  75. package/skills/brainstorming/references/design-template.md +65 -0
  76. package/skills/cleanup/SKILL.md +147 -0
  77. package/skills/cleanup/references/merge-verification.md +40 -0
  78. package/skills/debug/SKILL.md +204 -0
  79. package/skills/debug/references/hotfix-track.md +134 -0
  80. package/skills/debug/references/investigation-checklist.md +217 -0
  81. package/skills/debug/references/rca-template.md +150 -0
  82. package/skills/debug/references/state-schema.md +294 -0
  83. package/skills/debug/references/thorough-track.md +194 -0
  84. package/skills/debug/references/triage-questions.md +155 -0
  85. package/skills/debug/references/troubleshooting.md +47 -0
  86. package/skills/delegation/SKILL.md +150 -0
  87. package/skills/delegation/references/adaptive-orchestration.md +31 -0
  88. package/skills/delegation/references/agent-teams-saga.md +248 -0
  89. package/skills/delegation/references/fix-mode.md +74 -0
  90. package/skills/delegation/references/fixer-prompt.md +162 -0
  91. package/skills/delegation/references/implementer-prompt.md +322 -0
  92. package/skills/delegation/references/parallel-strategy.md +124 -0
  93. package/skills/delegation/references/pbt-patterns.md +172 -0
  94. package/skills/delegation/references/pr-fixes-mode.md +154 -0
  95. package/skills/delegation/references/state-management.md +51 -0
  96. package/skills/delegation/references/testing-patterns.md +129 -0
  97. package/skills/delegation/references/troubleshooting.md +33 -0
  98. package/skills/delegation/references/workflow-steps.md +127 -0
  99. package/skills/delegation/references/worktree-enforcement.md +64 -0
  100. package/skills/dotnet-standards/SKILL.md +269 -0
  101. package/skills/dotnet-standards/references/csharp-standards.md +120 -0
  102. package/skills/dotnet-standards/templates/.editorconfig +366 -0
  103. package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
  104. package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
  105. package/skills/dotnet-standards/templates/global.json +6 -0
  106. package/skills/dotnet-standards/templates/nuget.config +9 -0
  107. package/skills/dotnet-standards/templates/stylecop.json +37 -0
  108. package/skills/git-worktrees/SKILL.md +255 -0
  109. package/skills/implementation-planning/SKILL.md +233 -0
  110. package/skills/implementation-planning/references/plan-document-template.md +42 -0
  111. package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
  112. package/skills/implementation-planning/references/task-template.md +43 -0
  113. package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
  114. package/skills/quality-review/SKILL.md +278 -0
  115. package/skills/quality-review/references/code-quality-checklist.md +159 -0
  116. package/skills/quality-review/references/review-report-template.md +65 -0
  117. package/skills/quality-review/references/security-checklist.md +79 -0
  118. package/skills/quality-review/references/typescript-standards.md +24 -0
  119. package/skills/refactor/COMMAND.md +67 -0
  120. package/skills/refactor/SKILL.md +198 -0
  121. package/skills/refactor/phases/auto-chain.md +262 -0
  122. package/skills/refactor/phases/brief.md +176 -0
  123. package/skills/refactor/phases/explore.md +132 -0
  124. package/skills/refactor/phases/overhaul-delegate.md +136 -0
  125. package/skills/refactor/phases/overhaul-plan.md +312 -0
  126. package/skills/refactor/phases/overhaul-review.md +304 -0
  127. package/skills/refactor/phases/polish-implement.md +349 -0
  128. package/skills/refactor/phases/polish-validate.md +218 -0
  129. package/skills/refactor/phases/update-docs.md +234 -0
  130. package/skills/refactor/references/brief-template.md +81 -0
  131. package/skills/refactor/references/doc-update-checklist.md +110 -0
  132. package/skills/refactor/references/explore-checklist.md +73 -0
  133. package/skills/refactor/references/overhaul-track.md +215 -0
  134. package/skills/refactor/references/polish-track.md +170 -0
  135. package/skills/shared/prompts/context-reading.md +58 -0
  136. package/skills/shared/prompts/report-format.md +54 -0
  137. package/skills/shared/prompts/tdd-requirements.md +39 -0
  138. package/skills/shepherd/SKILL.md +264 -0
  139. package/skills/shepherd/references/assess-checklist.md +124 -0
  140. package/skills/shepherd/references/fix-strategies.md +191 -0
  141. package/skills/spec-review/SKILL.md +229 -0
  142. package/skills/spec-review/references/review-checklist.md +60 -0
  143. package/skills/sync-schemas/SKILL.md +114 -0
  144. package/skills/sync-schemas/references/configuration.md +73 -0
  145. package/skills/synthesis/SKILL.md +129 -0
  146. package/skills/synthesis/references/pr-descriptions.md +87 -0
  147. package/skills/synthesis/references/synthesis-steps.md +109 -0
  148. package/skills/synthesis/references/troubleshooting.md +115 -0
  149. package/skills/validate-all-skills.sh +57 -0
  150. package/skills/validate-frontmatter.sh +237 -0
  151. package/skills/workflow-state/SKILL.md +210 -0
  152. package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
  153. package/skills/workflow-state/references/phase-transitions.md +141 -0
@@ -0,0 +1,88 @@
1
+ # Testing Strategy Guide
2
+
3
+ When creating implementation plans, assign a `testingStrategy` to each task. This field controls which verification techniques agents apply during implementation.
4
+
5
+ ## Schema
6
+
7
+ ```typescript
8
+ testingStrategy: {
9
+ exampleTests: true; // Always required (literal true)
10
+ propertyTests: boolean; // Property-based tests required?
11
+ benchmarks: boolean; // Performance benchmarks required?
12
+ properties?: string[]; // Guidance: which properties to verify
13
+ performanceSLAs?: PerformanceSLA[]; // Guidance: performance targets
14
+ }
15
+ ```
16
+
17
+ ## Category Requirements
18
+
19
+ Assign `propertyTests: true` when the task involves any of these categories:
20
+
21
+ | Category | Example Code | Properties to Test |
22
+ |---|---|---|
23
+ | **Data transformations** | Parse/serialize, encode/decode, format/unformat | Roundtrip: `decode(encode(x)) === x` |
24
+ | **State machines** | Workflow HSM, circuit breaker, connection lifecycle | Transition validity: no invalid state reachable from any valid state |
25
+ | **Collections/ordering** | Sort, filter, deduplicate, paginate, merge | Idempotence: `sort(sort(x)) === sort(x)` |
26
+ | **Concurrency** | Optimistic locking, CAS, event ordering | Linearizability: concurrent operations produce valid state |
27
+ | **Serialization** | Event schemas, API contracts, JSON/YAML/TOML | Schema compliance: output matches declared schema for all inputs |
28
+ | **Mathematical operations** | Scoring, percentages, budgets, rates | Invariants: `score >= 0 && score <= 1.0`, conservation laws |
29
+
30
+ Assign `propertyTests: false` when the task is:
31
+ - Pure wiring (DI registration, configuration binding)
32
+ - UI layout or styling
33
+ - Simple CRUD without business logic
34
+ - Documentation or content-only changes
35
+
36
+ ## Populating the `properties` Array
37
+
38
+ When `propertyTests: true`, provide guidance strings in the `properties` array describing which properties to verify:
39
+
40
+ ```json
41
+ {
42
+ "exampleTests": true,
43
+ "propertyTests": true,
44
+ "benchmarks": false,
45
+ "properties": [
46
+ "roundtrip: decode(encode(x)) === x for all valid inputs",
47
+ "idempotence: format(format(x)) === format(x)"
48
+ ]
49
+ }
50
+ ```
51
+
52
+ ## Benchmark Requirements
53
+
54
+ Assign `benchmarks: true` when the task involves any of these categories:
55
+
56
+ | Category | Example Code | What to Measure |
57
+ |---|---|---|
58
+ | **Event store operations** | Append, query, snapshot | Throughput (ops/sec), p99 latency |
59
+ | **View materialization** | Projection apply, cold-start rebuild | Events/sec, cold-start time |
60
+ | **Serialization hot paths** | JSON parse/stringify, schema validation | Throughput, memory allocation |
61
+ | **Query-heavy reads** | CQRS projections, aggregations | Query latency under load |
62
+
63
+ Assign `benchmarks: false` when the task is:
64
+ - Pure wiring, configuration, or DI registration
65
+ - Content-only changes (Markdown, documentation)
66
+ - Test infrastructure (test helpers, fixtures)
67
+ - UI components or styling
68
+
69
+ When `benchmarks: true`, populate `performanceSLAs` with targets:
70
+
71
+ ```json
72
+ {
73
+ "exampleTests": true,
74
+ "propertyTests": false,
75
+ "benchmarks": true,
76
+ "performanceSLAs": [
77
+ { "operation": "event-append", "metric": "p99_ms", "threshold": 10 }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ ## Auto-Determination
83
+
84
+ The planner MUST auto-determine `propertyTests` and `benchmarks` for each task based on the category tables above. Do NOT leave these fields for the implementer to decide. Analyze each task's description and file paths to match against the categories. When uncertain, default to `false`.
85
+
86
+ ## Reference
87
+
88
+ See [Autonomous Code Verification design](../../../docs/designs/2026-02-15-autonomous-code-verification.md#when-to-require-property-based-tests) for the full rationale and category taxonomy.
@@ -0,0 +1,278 @@
1
+ ---
2
+ name: quality-review
3
+ description: "Stage 2 code quality review after spec compliance passes. Use when the user says 'quality review', 'check code quality', or runs /review (stage 2). Requires spec-review to have passed first (stage 2 of /review). Checks SOLID principles, DRY, security, and test quality. Do NOT use for spec compliance — use spec-review instead. Do NOT use for brainstorming."
4
+ metadata:
5
+ author: exarchos
6
+ version: 1.0.0
7
+ mcp-server: exarchos
8
+ category: workflow
9
+ phase-affinity: review
10
+ ---
11
+
12
+ # Quality Review Skill
13
+
14
+ ## Overview
15
+
16
+ Stage 2 of two-stage review: Assess code quality, maintainability, and engineering best practices.
17
+
18
+ **Prerequisite:** Spec review must PASS before quality review.
19
+
20
+ ## Triggers
21
+
22
+ Activate this skill when:
23
+ - Spec review has passed
24
+ - `/review` command (after spec review)
25
+ - Ready to assess code quality
26
+ - Before synthesis/merge
27
+
28
+ ## Execution Context
29
+
30
+ This skill runs in a SUBAGENT spawned by the orchestrator, not inline.
31
+
32
+ The orchestrator provides the state file path, diff output from `~/.claude/scripts/review-diff.sh`, task ID, and spec review results (must be PASS).
33
+
34
+ The subagent reads the state file for artifact paths, uses the diff output instead of full files, runs static analysis, performs a code walkthrough, generates a report, and returns the verdict.
35
+
36
+ ### Context-Efficient Input
37
+
38
+ Instead of reading full files, receive the integrated diff:
39
+
40
+ ```bash
41
+ # Generate integrated diff for review (Graphite stack vs main)
42
+ gt diff main > /tmp/stack-diff.patch
43
+
44
+ # Alternative: git diff for integration branch
45
+ git diff main...integration-branch > /tmp/integration-diff.patch
46
+
47
+ # Alternative: use gh CLI to get PR diff
48
+ # gh pr diff <number>
49
+ # Or use GitHub MCP pull_request_read with method "get_diff" if available
50
+ ```
51
+
52
+ This reduces context consumption by 80-90% while providing the complete picture.
53
+
54
+ ### Review Scope: Combined Changes
55
+
56
+ After delegation completes, quality review examines:
57
+ - The **complete stack diff** (all task branches vs main), or the **feature/integration-branch** diff when using integration branches
58
+ - All changes across all tasks in one view
59
+ - The full picture of combined code quality
60
+
61
+ This enables catching:
62
+ - Cross-task SOLID violations
63
+ - Duplicate code across task boundaries
64
+ - Inconsistent patterns between tasks
65
+
66
+ ## Review Scope
67
+
68
+ **Quality Review focuses on:**
69
+ - Code quality and readability
70
+ - SOLID principles
71
+ - Error handling
72
+ - Test quality
73
+ - Performance considerations
74
+ - Security basics
75
+
76
+ **Does NOT re-check:**
77
+ - Functional completeness (spec review)
78
+ - TDD compliance (spec review)
79
+
80
+ ## Review Process
81
+
82
+ ### Step 0: Verify Spec Review Passed (MANDATORY)
83
+
84
+ Before proceeding, confirm spec review passed for all tasks:
85
+
86
+ ```
87
+ action: "get", featureId: "<id>", query: "reviews"
88
+ ```
89
+
90
+ If ANY task has `specReview.status !== "pass"`, STOP and return:
91
+ ```json
92
+ { "verdict": "blocked", "summary": "Spec review not passed — run spec-review first" }
93
+ ```
94
+
95
+ ### Step 1: Static Analysis
96
+
97
+ Run the static analysis gate:
98
+
99
+ ```bash
100
+ scripts/static-analysis-gate.sh --repo-root <repo-root>
101
+ ```
102
+
103
+ The script runs lint, typecheck, and quality-check (if available), distinguishing errors from warnings.
104
+
105
+ **On exit 0:** All analysis passes -- proceed to Step 2.
106
+ **On exit 1:** Errors found -- fix before continuing review.
107
+
108
+ ### Step 2: Code Walkthrough
109
+
110
+ Assess each modified file against the quality checklists:
111
+ - Consult `references/code-quality-checklist.md` for code quality, SOLID, DRY, and structural criteria
112
+ - Consult `references/security-checklist.md` for security review criteria
113
+ - Consult `references/typescript-standards.md` for TypeScript-specific conventions (file organization, naming, patterns)
114
+
115
+ ### Step 2.5: Security Scan (Automated)
116
+
117
+ Run automated security pattern detection:
118
+
119
+ ```bash
120
+ scripts/security-scan.sh --repo-root <repo-root> --base-branch main
121
+ ```
122
+
123
+ **On exit 0:** No security patterns detected.
124
+ **On exit 1:** Potential security issues found -- include in review report.
125
+
126
+ ### Step 3: Generate Report
127
+
128
+ Use the template from `references/review-report-template.md` to structure the review output.
129
+
130
+ ## Priority Levels
131
+
132
+ | Priority | Action | Examples |
133
+ |----------|--------|----------|
134
+ | **HIGH** | Must fix before merge | Security issues, data loss risks |
135
+ | **MEDIUM** | Should fix, may defer | SOLID violations, complexity |
136
+ | **LOW** | Nice to have | Style preferences, minor refactors |
137
+
138
+ ### Priority Classification Rules
139
+
140
+ - **HIGH:** security vulnerabilities, data loss risk, API contract breaks, uncaught exception paths
141
+ - **MEDIUM:** SOLID violations (LSP, ISP), cyclomatic complexity >15, test coverage <70%
142
+ - **LOW:** naming, code style, comment clarity, non-impactful performance
143
+
144
+ If classification is ambiguous, default to MEDIUM and flag for human decision.
145
+
146
+ ## Fix Loop for HIGH-Priority
147
+
148
+ If HIGH-priority issues found:
149
+
150
+ 1. Create fix task listing each HIGH finding with file, issue, and required fix
151
+ 2. Dispatch to implementer subagent
152
+ 3. Re-review quality after fixes
153
+ 4. Only mark APPROVED when all HIGH items resolved and tests pass
154
+
155
+ ## Required Output Format
156
+
157
+ The subagent MUST return results as structured JSON. The orchestrator parses this JSON to populate state. Any other format is an error.
158
+
159
+ ```json
160
+ {
161
+ "verdict": "pass | fail | blocked",
162
+ "summary": "1-2 sentence summary",
163
+ "issues": [
164
+ {
165
+ "severity": "HIGH | MEDIUM | LOW",
166
+ "category": "security | solid | dry | perf | naming | other",
167
+ "file": "path/to/file",
168
+ "line": 123,
169
+ "description": "Issue description",
170
+ "required_fix": "What must change"
171
+ }
172
+ ],
173
+ "test_results": {
174
+ "passed": 0,
175
+ "failed": 0,
176
+ "coverage_percent": 0
177
+ }
178
+ }
179
+ ```
180
+
181
+ ## Anti-Patterns
182
+
183
+ | Don't | Do Instead |
184
+ |-------|------------|
185
+ | Block on LOW priority | Accept and track for later |
186
+ | Review before spec passes | Complete spec review first |
187
+ | Be overly pedantic | Focus on impactful issues |
188
+ | Skip security checks | Always verify basics |
189
+ | Accept poor test quality | Tests are code too |
190
+ | Apply generic standards to language issues | Reference language-specific rules |
191
+
192
+ ## Cross-Task Integration Issues
193
+
194
+ If an issue spans multiple tasks:
195
+ 1. Classify as "cross-task integration"
196
+ 2. Create fix task specifying ALL affected tasks
197
+ 3. Dispatch fix to implementer with context from all affected tasks
198
+ 4. Mark original tasks as blocked until cross-task fix completes
199
+
200
+ ## State Management
201
+
202
+ **On review complete:**
203
+ ```
204
+ action: "set", featureId: "<id>", updates: {
205
+ "reviews": { "quality": { "status": "pass", "summary": "...", "issues": [...] } }
206
+ }
207
+ ```
208
+
209
+ **On all reviews pass — advance to synthesis:**
210
+ ```
211
+ action: "set", featureId: "<id>", phase: "synthesize"
212
+ ```
213
+
214
+ ## Completion Criteria
215
+
216
+ - [ ] Static analysis passes
217
+ - [ ] All HIGH-priority issues fixed
218
+ - [ ] No security vulnerabilities
219
+ - [ ] Test quality acceptable
220
+ - [ ] Code is maintainable
221
+ - [ ] State file updated with review results
222
+
223
+ ## Determine Verdict
224
+
225
+ Classify review findings into a routing verdict:
226
+
227
+ ```bash
228
+ scripts/review-verdict.sh --high <N> --medium <N> --low <N>
229
+ ```
230
+
231
+ **On exit 0 (APPROVED):** Proceed to synthesis.
232
+ **On exit 1 (NEEDS_FIXES):** Route to `/exarchos:delegate --fixes`.
233
+ **On exit 2 (BLOCKED):** Return to design phase.
234
+
235
+ ## Transition
236
+
237
+ All transitions happen **immediately** without user confirmation:
238
+
239
+ ### If APPROVED:
240
+ 1. Update state: `action: "set", featureId: "<id>", phase: "synthesize"`
241
+ 2. Output: "Quality review passed. Auto-continuing to synthesis..."
242
+ 3. Auto-invoke synthesize:
243
+ ```typescript
244
+ Skill({ skill: "exarchos:synthesize", args: "<feature-name>" })
245
+ ```
246
+
247
+ ### If NEEDS_FIXES:
248
+ 1. Update state: `action: "set", featureId: "<id>", updates: { "reviews": { "quality": { "status": "fail", "issues": [...] } } }`
249
+ 2. Output: "Quality review found [N] HIGH-priority issues. Auto-continuing to fixes..."
250
+ 3. Auto-invoke delegate with fix tasks:
251
+ ```typescript
252
+ Skill({ skill: "exarchos:delegate", args: "--fixes <plan-path>" })
253
+ ```
254
+
255
+ ### If BLOCKED:
256
+ 1. Update state: `action: "set", featureId: "<id>", phase: "blocked"`
257
+ 2. Output: "Quality review blocked: [issue]. Returning to design..."
258
+ 3. Auto-invoke ideate for redesign:
259
+ ```typescript
260
+ Skill({ skill: "exarchos:ideate", args: "--redesign <feature-name>" })
261
+ ```
262
+
263
+ This is NOT a human checkpoint - workflow continues autonomously.
264
+
265
+ ## Exarchos Integration
266
+
267
+ When Exarchos MCP tools are available, emit gate events during review:
268
+
269
+ 1. **Read CI status** via `gh pr checks <number>` (or GitHub MCP `pull_request_read` with method `get_status` if available)
270
+ 2. **Emit gate events** via `exarchos_event` with `action: "append"`, type `gate.executed` (include `gateName`, `layer`, `passed`, `duration`)
271
+ 3. **Read unified status** via `exarchos_view` with `action: "tasks"`, `fields: ["taskId", "status", "title"]`, `limit: 20`
272
+ 4. **When all per-PR gates pass**, apply `stack-ready` label to the PR
273
+
274
+ ## Performance Notes
275
+
276
+ - Complete each step fully before advancing — quality over speed
277
+ - Do not skip validation checks even when the change appears trivial
278
+ - Read each checklist file completely before scoring. Do not skip security or SOLID checks even for small changes.
@@ -0,0 +1,159 @@
1
+ # Code Quality Checklist
2
+
3
+ Detailed review criteria for code quality, SOLID principles, DRY enforcement, and structural standards. Used during Step 2 of the quality review process.
4
+
5
+ ## 1. Code Quality
6
+
7
+ | Aspect | Check For |
8
+ |--------|-----------|
9
+ | Readability | Clear variable/function names |
10
+ | Complexity | Functions <30 lines, single responsibility |
11
+ | Duplication | DRY - no copy-paste code |
12
+ | Comments | Only where logic isn't self-evident |
13
+ | Formatting | Consistent with project style |
14
+
15
+ ## 1.1 DRY Enforcement
16
+
17
+ | Pattern | Threshold | Priority |
18
+ |---------|-----------|----------|
19
+ | Identical code blocks | 3+ occurrences OR 5+ lines | HIGH (3+), MEDIUM (2) |
20
+ | Similar code (literals differ) | 3+ occurrences | MEDIUM |
21
+ | Repeated validation logic | 2+ locations | HIGH |
22
+ | Repeated business rules | 2+ locations | HIGH |
23
+ | Copy-pasted tests | 3+ similar tests | LOW |
24
+ | Magic literals | Same value 3+ times | MEDIUM |
25
+
26
+ **Detection approach (prefer MCP tools):**
27
+ - Use `search_for_pattern` to find duplicate code blocks
28
+ - Use `find_referencing_symbols` to trace dependency usage
29
+ - Use `get_symbols_overview` to understand module structure
30
+
31
+ **Detection checklist:**
32
+ - [ ] Search for identical multi-line blocks (5+ lines duplicated)
33
+ - [ ] Flag validation code outside designated validation layer
34
+ - [ ] Trace business rule conditionals - must have single source
35
+ - [ ] Check for repeated string/number literals without constants
36
+
37
+ ## 2. SOLID Principles
38
+
39
+ | Principle | Verify | Specific Checks |
40
+ |-----------|--------|-----------------|
41
+ | **S**RP | One reason to change | Max 1 public type/file; class name matches responsibility |
42
+ | **O**CP | Extensible without modification | No switch/if-else on types; uses strategy/polymorphism |
43
+ | **L**SP | Subtypes substitutable | No `NotImplementedException`; no precondition strengthening |
44
+ | **I**SP | No forced dependencies | Interface <= 5 methods; no empty implementations |
45
+ | **D**IP | Depend on abstractions | No `new` for services; constructor injection only |
46
+
47
+ ### ISP Violation Patterns
48
+
49
+ | Pattern | Detection | Priority |
50
+ |---------|-----------|----------|
51
+ | Fat interface (> 5 methods) | Count methods on interface | MEDIUM |
52
+ | Mixed read/write interface | Check for getters + mutators together | MEDIUM |
53
+ | Empty/throw implementations | Scan for `NotImplementedException`, empty bodies | HIGH |
54
+ | Vague interface names | `IService`, `IManager`, `IHandler` without qualifier | LOW |
55
+ | Partial interface usage | Client uses < 50% of interface methods | MEDIUM |
56
+
57
+ **ISP Checklist:**
58
+ - [ ] No interface has more than 5 methods
59
+ - [ ] Interfaces are role-specific (IReadable, IWritable, not IDataAccess)
60
+ - [ ] No classes implement interfaces with NotImplementedException
61
+ - [ ] Interface names describe a single capability
62
+
63
+ ## 2.1 Control Flow Standards
64
+
65
+ | Standard | Check For |
66
+ |----------|-----------|
67
+ | Guard clauses | Validate at method entry, not nested |
68
+ | Early returns | Exit as soon as result is known |
69
+ | No arrow code | Deeply nested if/else is a smell |
70
+ | Conditional abstraction | Large switch/if-else extracted to helper |
71
+
72
+ ### Guard Clause Pattern
73
+
74
+ **Preferred:**
75
+ ```typescript
76
+ if (input == null) return;
77
+ // Main logic flat
78
+ ```
79
+
80
+ **Avoid:**
81
+ ```typescript
82
+ if (input != null) {
83
+ // Entire body nested
84
+ }
85
+ ```
86
+
87
+ ## 2.2 Structural Standards
88
+
89
+ | Standard | Check For | Priority |
90
+ |----------|-----------|----------|
91
+ | One responsibility per file | Public types in dedicated files | HIGH |
92
+ | Composition over inheritance | See checklist below | MEDIUM-HIGH |
93
+ | Sealed by default | `sealed` unless designed for extension | LOW |
94
+
95
+ ### Composition Over Inheritance Checklist
96
+
97
+ | Smell | Detection | Priority | Fix |
98
+ |-------|-----------|----------|-----|
99
+ | Inheritance depth > 2 | Count hierarchy levels | MEDIUM | Refactor to delegation |
100
+ | Base class, multiple concerns | Base has unrelated methods | MEDIUM | Split into interfaces + composition |
101
+ | `protected` for code sharing | Many protected methods (> 2/class) | MEDIUM | Extract to utility or inject strategy |
102
+ | Override that only extends | `super.method()` + additions | MEDIUM | Use decorator pattern |
103
+ | Inherit for one method | Extends to reuse single method | HIGH | Compose with delegation |
104
+
105
+ **Composition Checklist:**
106
+ - [ ] Inheritance represents true "is-a" relationship, not code reuse
107
+ - [ ] Class hierarchy depth <= 2
108
+ - [ ] `protected` methods rare (< 2 per class)
109
+ - [ ] No override methods that just call super + add logic
110
+
111
+ **Language-specific rules:** See `~/.claude/rules/coding-standards-{language}.md`
112
+
113
+ ## 3. Error Handling
114
+
115
+ | Check | Verify |
116
+ |-------|--------|
117
+ | Errors caught | Try/catch where needed |
118
+ | Errors meaningful | Clear error messages |
119
+ | Errors propagated | Proper error bubbling |
120
+ | No silent failures | All errors handled or logged |
121
+ | Input validation | At system boundaries |
122
+
123
+ ## 4. Test Quality
124
+
125
+ | Aspect | Verify |
126
+ |--------|--------|
127
+ | Arrange-Act-Assert | Clear test structure |
128
+ | Test isolation | No shared state issues |
129
+ | Meaningful assertions | Not just "expect(true)" |
130
+ | Edge cases | Boundary conditions tested |
131
+ | Error paths | Failure scenarios covered |
132
+
133
+ ## 5. Performance
134
+
135
+ | Check | Verify |
136
+ |-------|--------|
137
+ | No N+1 queries | Batch operations used |
138
+ | Efficient algorithms | No obvious O(n^2) when O(n) works |
139
+ | Memory management | No leaks, proper cleanup |
140
+ | Async patterns | Proper await usage |
141
+
142
+ ## 6. Frontend Aesthetics (if applicable)
143
+
144
+ For frontend code (React, Vue, HTML/CSS, etc.), verify distinctive design:
145
+
146
+ | Check | Verify |
147
+ |-------|--------|
148
+ | Distinctive typography | Not using Inter, Roboto, Arial, or system defaults |
149
+ | Intentional color palette | CSS variables defined, not ad-hoc colors |
150
+ | Purposeful motion | Orchestrated animations, not scattered micro-interactions |
151
+ | Atmospheric backgrounds | Layered/textured, not flat solid colors |
152
+ | Overall distinctiveness | Doesn't exhibit "AI slop" patterns |
153
+
154
+ **Anti-patterns to flag:**
155
+ - Purple gradients on white backgrounds
156
+ - Perfectly centered symmetric layouts
157
+ - Generic font choices
158
+ - Flat #f5f5f5 or pure white/black backgrounds
159
+ - Animation without purpose
@@ -0,0 +1,65 @@
1
+ # Quality Review Report Template
2
+
3
+ Use this template to structure the output of Step 3 (Generate Report) in the quality review process.
4
+
5
+ ## Template
6
+
7
+ ```markdown
8
+ ## Quality Review Report
9
+
10
+ ### Summary
11
+ - Status: [APPROVED | NEEDS_FIXES | BLOCKED]
12
+ - Reviewed: [timestamp]
13
+ - Reviewer: Claude Code
14
+
15
+ ### Findings Summary
16
+
17
+ | Severity | Category | File:Line | Issue |
18
+ |----------|----------|-----------|-------|
19
+ | HIGH | [category] | `path/to/file.ts:42` | [Brief description] |
20
+ | MEDIUM | [category] | `path/to/file.ts:88` | [Brief description] |
21
+ | LOW | [category] | `path/to/file.ts:15` | [Brief description] |
22
+
23
+ ### Findings Detail
24
+
25
+ #### HIGH-Priority
26
+ 1. [Finding title]
27
+ - File: `path/to/file.ts:42`
28
+ - Category: [security | correctness | performance | maintainability]
29
+ - Current: [What the code does now]
30
+ - Fix: [Required change]
31
+
32
+ #### MEDIUM-Priority
33
+ 1. [Finding title]
34
+ - File: `path/to/file.ts:88`
35
+ - Category: [security | correctness | performance | maintainability]
36
+ - Current: [What the code does now]
37
+ - Suggestion: [Recommended change]
38
+
39
+ #### LOW-Priority
40
+ 1. [Finding title]
41
+ - File: `path/to/file.ts:15`
42
+ - Category: [style | documentation | optimization]
43
+ - Note: [Observation]
44
+
45
+ ### Verdict
46
+ [APPROVED] Ready for synthesis
47
+ [NEEDS_FIXES] Fix HIGH-priority items, then re-review
48
+ [BLOCKED] Critical issues require design discussion
49
+ ```
50
+
51
+ ## Verdict Criteria
52
+
53
+ | Verdict | Condition |
54
+ |---------|-----------|
55
+ | **APPROVED** | No HIGH-priority findings; MEDIUM/LOW acceptable |
56
+ | **NEEDS_FIXES** | One or more HIGH-priority findings that must be resolved |
57
+ | **BLOCKED** | Critical architectural or security issues requiring design discussion |
58
+
59
+ ## Report Guidelines
60
+
61
+ - List every finding with file path and line number
62
+ - HIGH-priority findings must include a concrete fix description
63
+ - MEDIUM priority findings should include a suggested approach
64
+ - LOW priority findings are observations for future improvement
65
+ - The verdict drives the next workflow transition (synthesize, fix loop, or redesign)
@@ -0,0 +1,79 @@
1
+ # Security Review Checklist
2
+
3
+ Security review criteria based on OWASP Top 10 patterns. Used during Step 2 of the quality review process.
4
+
5
+ ## Security Basics
6
+
7
+ | Check | Verify |
8
+ |-------|--------|
9
+ | Input sanitization | User input validated |
10
+ | No secrets in code | Use environment variables |
11
+ | SQL injection | Parameterized queries |
12
+ | XSS prevention | Output encoding |
13
+
14
+ ## OWASP Top 10 (2021) Patterns
15
+
16
+ When reviewing code that handles user input, authentication, or data access, check for these common vulnerability patterns:
17
+
18
+ ### Broken Access Control (A01)
19
+ - Authorization checks on every endpoint
20
+ - No direct object references without access validation
21
+ - Default deny for permissions
22
+
23
+ ### Cryptographic Failures (A02)
24
+ - No secrets, API keys, or credentials in source code
25
+ - Sensitive data encrypted at rest and in transit
26
+ - PII properly handled per data classification
27
+
28
+ ### Injection (A03)
29
+ - SQL queries use parameterized statements, never string concatenation
30
+ - Shell commands use safe APIs, never template strings with user input
31
+ - Output encoding applied to all user-controlled data (XSS)
32
+ - Content Security Policy headers set
33
+
34
+ ### Insecure Design (A04)
35
+ - Threat modeling performed for critical flows
36
+ - Business logic validated server-side
37
+ - Rate limiting and resource controls in place
38
+
39
+ ### Security Misconfiguration (A05)
40
+ - No debug mode in production config
41
+ - Error messages don't leak stack traces or internal details
42
+ - Security headers configured (CORS, CSP, HSTS)
43
+
44
+ ### Vulnerable and Outdated Components (A06)
45
+ - Dependencies checked for known vulnerabilities
46
+ - No end-of-life frameworks or libraries
47
+ - Component versions tracked and updated
48
+
49
+ ### Identification and Authentication Failures (A07)
50
+ - Passwords are hashed with bcrypt/argon2, never stored in plaintext
51
+ - Session tokens have sufficient entropy
52
+ - Rate limiting on authentication endpoints
53
+
54
+ ### Software and Data Integrity Failures (A08)
55
+ - User input is validated before deserialization
56
+ - Type checking enforced on deserialized objects
57
+ - No eval() or equivalent on untrusted data
58
+ - CI/CD pipeline integrity verified
59
+
60
+ ### Security Logging and Monitoring Failures (A09)
61
+ - Security-relevant events are logged
62
+ - Logs do not contain sensitive data
63
+ - Alerting configured for suspicious activity
64
+
65
+ ### Server-Side Request Forgery (A10)
66
+ - URL inputs validated against allowlists
67
+ - Internal network access restricted from user-controlled requests
68
+ - DNS rebinding protections in place
69
+
70
+ ## Detection Checklist
71
+
72
+ - [ ] No hardcoded secrets or API keys
73
+ - [ ] All user input validated at system boundaries
74
+ - [ ] SQL/NoSQL queries use parameterized statements
75
+ - [ ] Output encoding applied for XSS prevention
76
+ - [ ] Authentication uses secure hashing algorithms
77
+ - [ ] Authorization checks present on all endpoints
78
+ - [ ] Error messages do not expose internal details
79
+ - [ ] Dependencies checked for known vulnerabilities
@@ -0,0 +1,24 @@
1
+ # TypeScript Standards
2
+
3
+ ## File Organization
4
+
5
+ - **One primary export per file**: Main class/function/component as default or named export
6
+ - **Barrel exports OK**: `index.ts` can re-export from module
7
+ - **Co-locate tests**: `component.test.ts` alongside `component.ts`
8
+
9
+ ## Type Design
10
+
11
+ | Rule | Standard |
12
+ |------|----------|
13
+ | Interfaces over type aliases | For object shapes that might be extended |
14
+ | Discriminated unions | For type-safe variant handling |
15
+ | `readonly` by default | For properties that shouldn't change |
16
+ | No `any` | Use `unknown` with type guards or proper generics |
17
+ | Strict mode | `strict: true` in tsconfig required |
18
+
19
+ ## Modern TypeScript
20
+
21
+ - **Const assertions**: Use `as const` for literal types
22
+ - **Template literal types**: For string pattern validation
23
+ - **No assertions without guards**: `as` requires prior type check
24
+ - **Satisfies operator**: For type checking without widening