claude-code-kit 0.7.0__py3-none-any.whl

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 (209) hide show
  1. claude_code_kit-0.7.0.dist-info/METADATA +384 -0
  2. claude_code_kit-0.7.0.dist-info/RECORD +209 -0
  3. claude_code_kit-0.7.0.dist-info/WHEEL +4 -0
  4. claude_code_kit-0.7.0.dist-info/entry_points.txt +4 -0
  5. claude_code_kit-0.7.0.dist-info/licenses/LICENSE +21 -0
  6. claude_kit/__init__.py +10 -0
  7. claude_kit/__main__.py +8 -0
  8. claude_kit/_payload/agents/acceptance-reviewer.md +60 -0
  9. claude_kit/_payload/agents/auditor.md +76 -0
  10. claude_kit/_payload/agents/dependency-scanner.md +84 -0
  11. claude_kit/_payload/agents/developer.md +187 -0
  12. claude_kit/_payload/agents/devils-advocate.md +62 -0
  13. claude_kit/_payload/agents/devops-engineer.md +134 -0
  14. claude_kit/_payload/agents/e2e-tester.md +152 -0
  15. claude_kit/_payload/agents/em-reviewer.md +105 -0
  16. claude_kit/_payload/agents/incident-responder.md +64 -0
  17. claude_kit/_payload/agents/merge-reviewer.md +194 -0
  18. claude_kit/_payload/agents/observability-engineer.md +94 -0
  19. claude_kit/_payload/agents/orchestrator.md +551 -0
  20. claude_kit/_payload/agents/owasp-reviewer.md +76 -0
  21. claude_kit/_payload/agents/policy-validator.md +63 -0
  22. claude_kit/_payload/agents/pr-raiser.md +138 -0
  23. claude_kit/_payload/agents/risk-classifier.md +50 -0
  24. claude_kit/_payload/agents/sdlc-code-reviewer.md +196 -0
  25. claude_kit/_payload/agents/secret-scanner.md +70 -0
  26. claude_kit/_payload/agents/security-reviewer.md +80 -0
  27. claude_kit/_payload/agents/senior-backend-dev.md +199 -0
  28. claude_kit/_payload/agents/senior-frontend-dev.md +181 -0
  29. claude_kit/_payload/agents/senior-tester.md +206 -0
  30. claude_kit/_payload/agents/spec-doc-writer.md +331 -0
  31. claude_kit/_payload/agents/story-planner.md +56 -0
  32. claude_kit/_payload/agents/technical-architect.md +139 -0
  33. claude_kit/_payload/agents/tester.md +193 -0
  34. claude_kit/_payload/agents/ui-designer.md +73 -0
  35. claude_kit/_payload/agents/unit-tester.md +119 -0
  36. claude_kit/_payload/catalog/mcp.yaml +54 -0
  37. claude_kit/_payload/catalog/org.yaml +145 -0
  38. claude_kit/_payload/catalog/profiles.yaml +96 -0
  39. claude_kit/_payload/catalog/stacks.yaml +96 -0
  40. claude_kit/_payload/commands/init.md +36 -0
  41. claude_kit/_payload/commands/sdlc.md +18 -0
  42. claude_kit/_payload/commands/status.md +20 -0
  43. claude_kit/_payload/hooks/hooks.json +58 -0
  44. claude_kit/_payload/hooks/scripts/audit-log.sh +18 -0
  45. claude_kit/_payload/hooks/scripts/guard-secrets.sh +26 -0
  46. claude_kit/_payload/hooks/scripts/lint-fix.sh +38 -0
  47. claude_kit/_payload/hooks/scripts/load-continuity.sh +32 -0
  48. claude_kit/_payload/hooks/scripts/load-learnings.sh +40 -0
  49. claude_kit/_payload/hooks/scripts/type-check.sh +23 -0
  50. claude_kit/_payload/hooks/scripts/validate-frontmatter.sh +34 -0
  51. claude_kit/_payload/hooks/scripts/validate-settings.sh +21 -0
  52. claude_kit/_payload/hooks/scripts/warn-large-edits.sh +24 -0
  53. claude_kit/_payload/hooks/scripts/warn-missing-tests.sh +24 -0
  54. claude_kit/_payload/hooks/scripts/warn-sensitive-files.sh +30 -0
  55. claude_kit/_payload/hooks/scripts/warn-shared-modules.sh +33 -0
  56. claude_kit/_payload/rules/agent-guardrails.md +83 -0
  57. claude_kit/_payload/rules/agent-memory.md +106 -0
  58. claude_kit/_payload/rules/agent-resilience.md +61 -0
  59. claude_kit/_payload/rules/autonomy-levels.md +30 -0
  60. claude_kit/_payload/rules/code-organization.md +312 -0
  61. claude_kit/_payload/rules/continuity.md +84 -0
  62. claude_kit/_payload/rules/design-patterns.md +422 -0
  63. claude_kit/_payload/rules/devops-observability.md +57 -0
  64. claude_kit/_payload/rules/documentation.md +326 -0
  65. claude_kit/_payload/rules/evals.md +62 -0
  66. claude_kit/_payload/rules/frontend-best-practices.md +157 -0
  67. claude_kit/_payload/rules/goal-setting-and-monitoring.md +72 -0
  68. claude_kit/_payload/rules/human-in-the-loop.md +64 -0
  69. claude_kit/_payload/rules/linting-and-formatting.md +220 -0
  70. claude_kit/_payload/rules/mandatory-workflow.md +309 -0
  71. claude_kit/_payload/rules/model-tiers.md +34 -0
  72. claude_kit/_payload/rules/quality-gates.md +107 -0
  73. claude_kit/_payload/rules/rarv-cycle.md +31 -0
  74. claude_kit/_payload/rules/reasoning-techniques.md +62 -0
  75. claude_kit/_payload/rules/responsive-and-accessibility.md +353 -0
  76. claude_kit/_payload/rules/risk-classification.md +36 -0
  77. claude_kit/_payload/rules/testing.md +417 -0
  78. claude_kit/_payload/rules/tool-design.md +66 -0
  79. claude_kit/_payload/skills/_references/accessibility-checklist.md +160 -0
  80. claude_kit/_payload/skills/_references/orchestration-patterns.md +405 -0
  81. claude_kit/_payload/skills/_references/performance-checklist.md +153 -0
  82. claude_kit/_payload/skills/_references/security-checklist.md +134 -0
  83. claude_kit/_payload/skills/_references/testing-patterns.md +236 -0
  84. claude_kit/_payload/skills/accessibility-review/SKILL.md +56 -0
  85. claude_kit/_payload/skills/api-and-interface-design/SKILL.md +294 -0
  86. claude_kit/_payload/skills/api-integration/SKILL.md +348 -0
  87. claude_kit/_payload/skills/archive-sprint/SKILL.md +31 -0
  88. claude_kit/_payload/skills/backlog/SKILL.md +41 -0
  89. claude_kit/_payload/skills/backlog/item-template.md +20 -0
  90. claude_kit/_payload/skills/browser-testing-with-devtools/SKILL.md +302 -0
  91. claude_kit/_payload/skills/ci-cd-and-automation/SKILL.md +402 -0
  92. claude_kit/_payload/skills/code-review-and-quality/SKILL.md +347 -0
  93. claude_kit/_payload/skills/code-simplification/SKILL.md +331 -0
  94. claude_kit/_payload/skills/component-design/SKILL.md +171 -0
  95. claude_kit/_payload/skills/consolidate-learnings/SKILL.md +55 -0
  96. claude_kit/_payload/skills/context-engineering/SKILL.md +321 -0
  97. claude_kit/_payload/skills/debugging-and-error-recovery/SKILL.md +300 -0
  98. claude_kit/_payload/skills/decision/SKILL.md +46 -0
  99. claude_kit/_payload/skills/decision/adr-template.md +36 -0
  100. claude_kit/_payload/skills/deprecation-and-migration/SKILL.md +207 -0
  101. claude_kit/_payload/skills/documentation-and-adrs/SKILL.md +299 -0
  102. claude_kit/_payload/skills/doubt-driven-development/SKILL.md +243 -0
  103. claude_kit/_payload/skills/execute/SKILL.md +27 -0
  104. claude_kit/_payload/skills/frontend-ui-engineering/SKILL.md +328 -0
  105. claude_kit/_payload/skills/git-workflow-and-versioning/SKILL.md +300 -0
  106. claude_kit/_payload/skills/idea-refine/SKILL.md +178 -0
  107. claude_kit/_payload/skills/idea-refine/examples.md +238 -0
  108. claude_kit/_payload/skills/idea-refine/frameworks.md +99 -0
  109. claude_kit/_payload/skills/idea-refine/refinement-criteria.md +113 -0
  110. claude_kit/_payload/skills/idea-refine/scripts/idea-refine.sh +15 -0
  111. claude_kit/_payload/skills/incident-postmortem/SKILL.md +74 -0
  112. claude_kit/_payload/skills/incremental-implementation/SKILL.md +245 -0
  113. claude_kit/_payload/skills/interview-me/SKILL.md +221 -0
  114. claude_kit/_payload/skills/load-testing/SKILL.md +83 -0
  115. claude_kit/_payload/skills/manual-test/SKILL.md +516 -0
  116. claude_kit/_payload/skills/performance-optimization/SKILL.md +277 -0
  117. claude_kit/_payload/skills/planning-and-task-breakdown/SKILL.md +223 -0
  118. claude_kit/_payload/skills/playwright-verification/SKILL.md +205 -0
  119. claude_kit/_payload/skills/refresh-docs/SKILL.md +63 -0
  120. claude_kit/_payload/skills/remember/SKILL.md +96 -0
  121. claude_kit/_payload/skills/scope/SKILL.md +52 -0
  122. claude_kit/_payload/skills/scope/scope-template.md +82 -0
  123. claude_kit/_payload/skills/sdlc/SKILL.md +83 -0
  124. claude_kit/_payload/skills/security-and-hardening/SKILL.md +368 -0
  125. claude_kit/_payload/skills/security-verification/SKILL.md +209 -0
  126. claude_kit/_payload/skills/shipping-and-launch/SKILL.md +309 -0
  127. claude_kit/_payload/skills/smoke-test/SKILL.md +78 -0
  128. claude_kit/_payload/skills/source-driven-development/SKILL.md +195 -0
  129. claude_kit/_payload/skills/spec-driven-development/SKILL.md +200 -0
  130. claude_kit/_payload/skills/sprint/SKILL.md +67 -0
  131. claude_kit/_payload/skills/sprint/sprint-template.md +90 -0
  132. claude_kit/_payload/skills/test-driven-development/SKILL.md +383 -0
  133. claude_kit/_payload/skills/threat-model/SKILL.md +60 -0
  134. claude_kit/_payload/skills/triage/SKILL.md +87 -0
  135. claude_kit/_payload/skills/ui-ux-design/SKILL.md +71 -0
  136. claude_kit/_payload/skills/unit-test/SKILL.md +237 -0
  137. claude_kit/_payload/skills/using-agent-skills/SKILL.md +180 -0
  138. claude_kit/_payload/templates/CLAUDE.md +238 -0
  139. claude_kit/_payload/templates/CLAUDE.stack.md.tmpl +53 -0
  140. claude_kit/_payload/templates/CONTINUITY.template.md +35 -0
  141. claude_kit/_payload/templates/README.claude-sdlc.md.tmpl +219 -0
  142. claude_kit/_payload/templates/agent-memory/MEMORY.md +30 -0
  143. claude_kit/_payload/templates/agent-memory/api/.gitkeep +0 -0
  144. claude_kit/_payload/templates/agent-memory/architecture/.gitkeep +0 -0
  145. claude_kit/_payload/templates/agent-memory/debugging/.gitkeep +0 -0
  146. claude_kit/_payload/templates/agent-memory/gotchas/.gitkeep +0 -0
  147. claude_kit/_payload/templates/agent-memory/patterns/.gitkeep +0 -0
  148. claude_kit/_payload/templates/agent-memory/performance/.gitkeep +0 -0
  149. claude_kit/_payload/templates/artifacts/adr.md +18 -0
  150. claude_kit/_payload/templates/artifacts/feature-spec.md +29 -0
  151. claude_kit/_payload/templates/artifacts/release-plan.md +23 -0
  152. claude_kit/_payload/templates/artifacts/runbook.md +24 -0
  153. claude_kit/_payload/templates/artifacts/security-review.md +23 -0
  154. claude_kit/_payload/templates/artifacts/test-plan.md +22 -0
  155. claude_kit/_payload/templates/org/README.md +53 -0
  156. claude_kit/_payload/templates/org/agents/data-workflow-agent.md +59 -0
  157. claude_kit/_payload/templates/org/agents/founder-prototype-agent.md +61 -0
  158. claude_kit/_payload/templates/org/agents/internal-tools-builder.md +63 -0
  159. claude_kit/_payload/templates/org/agents/pm-copilot.md +60 -0
  160. claude_kit/_payload/templates/org/agents/support-ticket-engineer.md +63 -0
  161. claude_kit/_payload/templates/org/packs/devops-and-release/README.md +46 -0
  162. claude_kit/_payload/templates/org/packs/devops-and-release/pack.yaml +32 -0
  163. claude_kit/_payload/templates/org/packs/engineering-core/README.md +46 -0
  164. claude_kit/_payload/templates/org/packs/engineering-core/pack.yaml +44 -0
  165. claude_kit/_payload/templates/org/packs/non-engineer-builder/README.md +53 -0
  166. claude_kit/_payload/templates/org/packs/non-engineer-builder/pack.yaml +39 -0
  167. claude_kit/_payload/templates/org/packs/onboarding-and-docs/README.md +49 -0
  168. claude_kit/_payload/templates/org/packs/onboarding-and-docs/pack.yaml +26 -0
  169. claude_kit/_payload/templates/org/packs/product-to-code/README.md +50 -0
  170. claude_kit/_payload/templates/org/packs/product-to-code/pack.yaml +34 -0
  171. claude_kit/_payload/templates/org/packs/quality-and-review/README.md +53 -0
  172. claude_kit/_payload/templates/org/packs/quality-and-review/pack.yaml +40 -0
  173. claude_kit/_payload/templates/org/packs/security-and-compliance/README.md +50 -0
  174. claude_kit/_payload/templates/org/packs/security-and-compliance/pack.yaml +36 -0
  175. claude_kit/_payload/templates/org/rules/ai-working-agreement.md +45 -0
  176. claude_kit/_payload/templates/org/rules/ambiguity-resolution.md +36 -0
  177. claude_kit/_payload/templates/org/rules/branch-and-pr-policy.md +41 -0
  178. claude_kit/_payload/templates/org/rules/compliance-policy.md +50 -0
  179. claude_kit/_payload/templates/org/rules/non-engineer-safe-coding.md +37 -0
  180. claude_kit/_payload/templates/org/rules/pii-policy.md +46 -0
  181. claude_kit/_payload/templates/org/rules/production-data-policy.md +35 -0
  182. claude_kit/_payload/templates/org/rules/prompt-to-task-conversion.md +30 -0
  183. claude_kit/_payload/templates/org/rules/prototype-boundaries.md +40 -0
  184. claude_kit/_payload/templates/org/rules/secrets-policy.md +34 -0
  185. claude_kit/_payload/templates/org/skills/customer-issue-to-fix/SKILL.md +61 -0
  186. claude_kit/_payload/templates/org/skills/feature-from-idea/SKILL.md +56 -0
  187. claude_kit/_payload/templates/org/skills/prompt-to-safe-task/SKILL.md +59 -0
  188. claude_kit/_payload/templates/org/skills/prototype-to-production/SKILL.md +61 -0
  189. claude_kit/_payload/templates/org/skills/repo-onboarding/SKILL.md +60 -0
  190. claude_kit/_payload/templates/settings.json +53 -0
  191. claude_kit/_payload/templates/stacks/backend/python/fastapi/rules/fastapi-patterns.md +64 -0
  192. claude_kit/_payload/templates/stacks/db/mongodb/agents/migration-specialist.md +61 -0
  193. claude_kit/_payload/templates/stacks/db/mongodb/agents/mongodb-specialist.md +59 -0
  194. claude_kit/_payload/templates/stacks/db/mongodb/rules/mongodb-patterns.md +39 -0
  195. claude_kit/_payload/templates/stacks/db/postgres/agents/db-performance-reviewer.md +66 -0
  196. claude_kit/_payload/templates/stacks/db/postgres/agents/migration-specialist.md +56 -0
  197. claude_kit/_payload/templates/stacks/db/postgres/agents/postgres-specialist.md +58 -0
  198. claude_kit/_payload/templates/stacks/db/postgres/rules/database-performance.md +64 -0
  199. claude_kit/_payload/templates/stacks/db/postgres/rules/postgres-patterns.md +43 -0
  200. claude_kit/_payload/templates/stacks/frontend/react/rules/react-patterns.md +63 -0
  201. claude_kit/catalog.py +476 -0
  202. claude_kit/cli.py +327 -0
  203. claude_kit/hooks.py +246 -0
  204. claude_kit/models.py +205 -0
  205. claude_kit/prompts.py +209 -0
  206. claude_kit/render.py +146 -0
  207. claude_kit/scaffold.py +492 -0
  208. claude_kit/upgrader.py +294 -0
  209. claude_kit/validator.py +197 -0
@@ -0,0 +1,220 @@
1
+ # Linting and Formatting Rules
2
+
3
+ All code MUST pass the project's linter with **zero warnings and zero errors** before committing. The pre-commit hook (if configured) should enforce this.
4
+
5
+ ## Linting Configuration
6
+
7
+ The project uses a linter configured to enforce code quality, style consistency, and accessibility. Configure enforcement layers appropriate to your stack:
8
+
9
+ | Layer | Typical Scope | Purpose |
10
+ |-------|---------------|---------|
11
+ | Base | All source files | Language rules, framework patterns, common anti-patterns |
12
+ | Accessibility | UI component files | Accessibility rules for web UIs (e.g., ARIA, keyboard nav, alt text) |
13
+ | Design System | Application code (excl. low-level primitives) | Project-specific patterns, banned primitives, import conventions |
14
+ | Code Quality | Application code | Code smells, performance, security patterns |
15
+
16
+ ## Zero-Warning Policy
17
+
18
+ Pre-commit hooks should run the linter with auto-fix enabled and a zero-warning threshold. This means:
19
+
20
+ - **Errors** block the commit — must be fixed
21
+ - **Warnings** also block the commit — must be fixed or suppressed with justification
22
+ - Auto-fix corrects what it can (formatting, import order, simple violations) before checking
23
+
24
+ ## Common Linting Rules
25
+
26
+ These patterns are enforced across many stacks. Adapt to your project's specifics.
27
+
28
+ ### Primitive Bans (error)
29
+
30
+ Never use low-level primitives directly in application code when higher-level abstractions exist:
31
+
32
+ **UI Frameworks:**
33
+ - Raw HTML form elements outside the UI component library (e.g., `<input>` vs. a typed `Input` component)
34
+ - Raw CSS classes outside the design system (e.g., arbitrary color values vs. semantic tokens)
35
+
36
+ **Backend Frameworks:**
37
+ - Raw database queries outside the data-access layer (e.g., string-concatenated SQL vs. query builders)
38
+ - Manual JSON parsing outside typed schemas (e.g., raw `JSON.parse()` vs. validation libraries)
39
+
40
+ ### Inline Styles / Magic Values (error)
41
+
42
+ ```typescript
43
+ // BAD — blocks commit (example: web UI)
44
+ <div style={{ width: '50%' }}>
45
+
46
+ // GOOD — use design system utilities
47
+ <div className="w-1/2">
48
+
49
+ // EXCEPTION — dynamic values with justification
50
+ {/* eslint-disable-next-line no-restricted-syntax -- dynamic chart width from data */}
51
+ <div style={{ width: `${percentage}%` }}>
52
+ ```
53
+
54
+ ```python
55
+ # BAD — magic values (example: backend)
56
+ if user.age > 65:
57
+ discount = 0.15
58
+
59
+ # GOOD — named constants
60
+ if user.age > SENIOR_AGE_THRESHOLD:
61
+ discount = SENIOR_DISCOUNT_RATE
62
+ ```
63
+
64
+ ### Banned Patterns (error)
65
+
66
+ Projects often ban specific patterns that violate design system standards:
67
+
68
+ **Examples (adapt to your stack):**
69
+ - Inconsistent spacing/sizing values outside allowed scales
70
+ - Direct imports of internal modules bypassing public API barrels
71
+ - Reserved sentinel values in enums or special fields
72
+ - Low-contrast color combinations violating accessibility standards
73
+
74
+ ### Abstraction Suggestions (warn)
75
+
76
+ Linters can suggest higher-level patterns when they detect repetitive code:
77
+
78
+ | Pattern Detected | Suggestion |
79
+ |-----------------|------------|
80
+ | Repetitive UI structure | Use a compound component or layout primitive |
81
+ | Repeated validation logic | Extract to a reusable validator |
82
+ | Duplicated error handling | Use middleware or a wrapper |
83
+
84
+ These are nudges, not hard blocks. Fix them when reasonable.
85
+
86
+ ## Framework-Specific Hook Rules (if applicable)
87
+
88
+ For reactive frameworks (React, Vue, Svelte, SolidJS, etc.), enforce hook/reactivity rules:
89
+
90
+ - **Rules of Hooks/Reactivity**: hooks/signals only at the top level, only in appropriate scopes
91
+ - **Exhaustive dependencies**: all reactive dependencies must be declared
92
+
93
+ ### Suppressing Dependency Rules
94
+
95
+ Only suppress with a comment explaining why:
96
+
97
+ ```typescript
98
+ // Example: React
99
+ useEffect(() => {
100
+ loadInitialData();
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- mount-only: loadInitialData is stable
102
+ }, []);
103
+ ```
104
+
105
+ ```python
106
+ # Example: Python async
107
+ async def handler():
108
+ await startup_task()
109
+ # pylint: disable=unused-argument -- event is required by framework signature
110
+ ```
111
+
112
+ ## Accessibility Rules (error, for web UIs)
113
+
114
+ Projects with web UIs should enforce accessibility rules via linter plugins (e.g., `jsx-a11y`, `vuejs-accessibility`, `svelte-a11y`):
115
+
116
+ | Rule Category | What It Checks |
117
+ |---------------|---------------|
118
+ | Alt text | Images must have meaningful `alt` attributes (or `alt=""` for decorative) |
119
+ | Anchor validity | Links must have valid `href` or proper role |
120
+ | ARIA validity | ARIA attributes and roles must be valid |
121
+ | Keyboard accessibility | Interactive elements must be keyboard-accessible (`onClick` pairs with `onKeyDown`/`onKeyUp`, focusable elements) |
122
+ | Label association | Form inputs must have associated labels |
123
+ | Interactive semantics | Non-interactive elements shouldn't have click handlers without proper roles |
124
+
125
+ ## Suppressing Rules
126
+
127
+ When you must suppress a rule, always include a justification:
128
+
129
+ ```typescript
130
+ // Single line (TypeScript/JavaScript)
131
+ // eslint-disable-next-line <rule-name> -- <justification>
132
+
133
+ // Block (use sparingly)
134
+ /* eslint-disable <rule-name> -- <justification> */
135
+ // ... code ...
136
+ /* eslint-enable <rule-name> */
137
+ ```
138
+
139
+ ```python
140
+ # Single line (Python)
141
+ result = unsafe_operation() # pylint: disable=<rule-name> -- <justification>
142
+
143
+ # Block (use sparingly)
144
+ # pylint: disable=<rule-name> -- <justification>
145
+ # ... code ...
146
+ # pylint: enable=<rule-name>
147
+ ```
148
+
149
+ **Never use blanket `// eslint-disable` or `# pylint: disable` without specifying a rule name.**
150
+
151
+ ## Running the Linter
152
+
153
+ ```bash
154
+ # Generic commands — adapt to your project's scripts
155
+ <package-manager> run lint # Check all files
156
+ <linter-cli> path/to/file # Check single file
157
+ <linter-cli> --fix src/ # Auto-fix what's possible
158
+ ```
159
+
160
+ For projects with multiple linters (e.g., backend + frontend, or multiple languages):
161
+
162
+ ```bash
163
+ # Backend
164
+ cd backend && <run backend linter>
165
+
166
+ # Frontend
167
+ cd frontend && <run frontend linter>
168
+
169
+ # Or unified at root
170
+ <package-manager> run lint:all
171
+ ```
172
+
173
+ ## Formatting
174
+
175
+ **Auto-formatters** (e.g., Prettier, Black, Ruff format, gofmt) should run before linting, either:
176
+ - As part of `--fix` in the linter
177
+ - As a separate pre-commit step
178
+
179
+ **Formatting is not negotiable.** Configure your editor to format on save, or rely on pre-commit hooks. Never commit unformatted code.
180
+
181
+ ## Ignored Paths
182
+
183
+ Configure the linter to exclude:
184
+ - Build output directories (`dist/`, `build/`, `target/`, `.next/`, etc.)
185
+ - Generated code (protobuf outputs, ORM migrations, auto-generated clients)
186
+ - Vendor/third-party code
187
+ - Tooling artifacts (`.claude/worktrees/`, IDE configs, etc.)
188
+ - Legacy/deprecated code not under active development
189
+
190
+ ## Integration with Type Checking
191
+
192
+ For statically-typed languages, the linter should complement (not replace) the type checker:
193
+
194
+ | Tool | Focus |
195
+ |------|-------|
196
+ | Type Checker | Type safety, nullability, interface contracts |
197
+ | Linter | Code quality, style, anti-patterns, accessibility, design system compliance |
198
+
199
+ Run both before committing. See `linting-and-formatting.md` for type-checking rules (if applicable to your stack).
200
+
201
+ ## Enforcement
202
+
203
+ ### Pre-Commit Hook
204
+ The project should configure a pre-commit hook (e.g., `husky`, `pre-commit`, `lefthook`) to:
205
+ 1. Format code
206
+ 2. Run linter with auto-fix
207
+ 3. Block commit if errors or warnings remain
208
+
209
+ ### CI/CD
210
+ The CI pipeline must run linting as a required check:
211
+ 1. Format check (fail if code is not formatted)
212
+ 2. Lint check (fail on errors or warnings)
213
+ 3. Block merge if linting fails
214
+
215
+ ### Code Review
216
+ Reviewers must verify:
217
+ - [ ] Zero linting errors or warnings
218
+ - [ ] Any suppressed rules have clear justifications
219
+ - [ ] Design system and accessibility rules are followed
220
+ - [ ] No blanket disables without specific rule names
@@ -0,0 +1,309 @@
1
+ # Mandatory Workflow
2
+
3
+ This document defines **two development workflows**: one for bug fixes and one for features.
4
+ Identify which workflow to follow FIRST, then execute it step by step.
5
+
6
+ The pipeline is **stack-agnostic**. Wherever it says "run the project's lint / type-check /
7
+ test / build commands," substitute the actual commands for your stack (define them in
8
+ `.claude/rules/linting-and-formatting.md` and `.claude/rules/testing.md`). The canonical
9
+ example of parallel work uses a **backend lane** and a **frontend lane**, but the same
10
+ fork/join logic applies to any set of independent work streams.
11
+
12
+ ## Which Workflow?
13
+
14
+ | Task type | Workflow |
15
+ |-----------|----------|
16
+ | Bug fix, defect, regression, crash, broken behavior | **Bug Fix Workflow** |
17
+ | New feature, enhancement, new page/component, refactor | **Feature Workflow — SDLC Agent Pipeline** |
18
+
19
+ If unclear whether a task is a bug fix or feature, ask the user.
20
+
21
+ ---
22
+ ---
23
+
24
+ ## Working Memory & Self-Check (both workflows)
25
+
26
+ - **CONTINUITY.md** — read `.claude/CONTINUITY.md` at the start of every turn and write it
27
+ back at the end and at each stage transition. It carries phase, active work, decisions,
28
+ mistakes, and next steps across context compaction and new sessions. Durable learnings go
29
+ to `.claude/agent-memory/` via the `remember` skill. See `.claude/rules/continuity.md`.
30
+ - **RARV** — every step runs Reason → Act → Reflect → Verify; never hand off before Verify is
31
+ green. See `.claude/rules/rarv-cycle.md`.
32
+ - **Severity** — classify findings Critical/High/Medium/Low/Cosmetic; a gate passes only with
33
+ zero Critical/High/Medium open. See `.claude/rules/quality-gates.md`.
34
+ - **Agent operating disciplines** — every agent also follows, throughout both workflows: how to
35
+ reason (`.claude/rules/reasoning-techniques.md`); measurable goals, monitoring, and prioritization
36
+ (`.claude/rules/goal-setting-and-monitoring.md`); safe handling of untrusted inputs/outputs and
37
+ least-privilege tools (`.claude/rules/agent-guardrails.md`); recovery from tool/agent failures
38
+ (`.claude/rules/agent-resilience.md`); and when to stop for a human
39
+ (`.claude/rules/human-in-the-loop.md`).
40
+
41
+ ---
42
+ ---
43
+
44
+ # Bug Fix Workflow
45
+
46
+ A streamlined, 6-step process: **reproduce → understand → fix → verify**. No test plans, no
47
+ review docs, no feature planning. Find the bug, prove it with a test, fix it, confirm nothing
48
+ else broke.
49
+
50
+ ```
51
+ B1 (understand) → B2 (reproduce + failing test) → B3 (root cause) → B4 (fix) → B5 (quality gate) → B6 (commit)
52
+ ```
53
+
54
+ ## B1 — Understand the Bug
55
+ - Read the bug report completely. What is the expected behavior? What is the actual behavior?
56
+ - Identify which module and file(s) are affected.
57
+ - Read the affected code BEFORE changing anything.
58
+ - If the report is vague, ask: which component, repro steps, expected vs. actual.
59
+
60
+ **Gate:** Can you describe the bug, the expected behavior, and where it likely lives?
61
+
62
+ ## B2 — Reproduce with a Failing Test
63
+ Write a test that captures the buggy behavior BEFORE writing any fix.
64
+ - The test must FAIL with the bug present — proving the bug exists.
65
+ - Assert the EXPECTED (correct) behavior, not the current broken behavior.
66
+ - Keep it minimal. Cover edge cases (null, empty, zero, boundary) where relevant.
67
+
68
+ **Gate:** Does your test fail for the right reason? If it passes, it isn't testing the bug.
69
+
70
+ ## B3 — Find the Root Cause
71
+ Do NOT start fixing until you understand WHY the bug happens.
72
+ - Trace the data flow: where does the bad value come from?
73
+ - Is it in the component, the state, the data, or a shared utility?
74
+ - Is it a type issue, logic error, missing guard, or a wrong assumption?
75
+
76
+ **Rules:** Fix the ROOT CAUSE, not the symptom. Don't modify a test to make it pass. Don't
77
+ suppress type/lint errors to hide a mismatch. **Gate:** Can you explain the root cause in one sentence?
78
+
79
+ ## B4 — Fix the Bug
80
+ Apply the minimal fix that addresses the root cause.
81
+ - ONLY change what is necessary. Do NOT refactor or "improve" surrounding code.
82
+ - If the fix touches a shared component/utility, find all consumers and verify they still work.
83
+ - If the fix needs project-wide file changes, ask the user first.
84
+ - No error suppression, no temporary code, follow existing conventions.
85
+ - For UI: verify at mobile/tablet/desktop widths and keep it accessible.
86
+
87
+ **Verify:** Your B2 test now passes; ALL existing tests still pass; the fix is minimal.
88
+
89
+ ## B5 — Quality Gate
90
+ Run, in order, your project's: **linter → type-check (if any) → tests → build.** All must pass.
91
+ Review the diff: only bug-related files changed, no suppressed errors, no temporary code.
92
+ **If it fails:** fix it — do NOT suppress errors. If you can't resolve it, ask the user.
93
+
94
+ ## B6 — Commit + Report
95
+ Use your project's commit convention (see the commit format note below). Then report:
96
+ 1. **Bug** (one sentence) 2. **Root cause** (one sentence) 3. **Fix** (files changed)
97
+ 4. **Test** added to prevent regression 5. **Ask** whether to deploy and to which environment.
98
+
99
+ ---
100
+ ---
101
+
102
+ # Feature Workflow — SDLC Agent Pipeline
103
+
104
+ A 3-phase, 7-stage pipeline for new features, enhancements, and refactors. Each stage is
105
+ handled by a dedicated agent in `.claude/agents/`.
106
+
107
+ ```
108
+ Phase 1 — Planning (Stages 0-3) ║ Phase 2 — Development (4-5) ║ Phase 3 — Testing & Delivery (6-7)
109
+ [0] Orchestrator receives request ║ [4] Developer writes code ║ [6a] Unit Tester ─┐
110
+ 1a→1b→1c→1d→1e ───────────────────╬──► 2a→2b→2c→2d ────────────────╬──► [6b] E2E Tester ─┤ (parallel)
111
+ Understand→Clarify→Spec→Dev docs ║ Read→Implement→Quality gate ║ 3a→3b→3c→3d
112
+ → EM review ║ → Code review ║ → Security → DevOps/Obs → PR → Human
113
+ ```
114
+
115
+ **Pipeline rules:**
116
+ - No code is written until Phase 1 is complete (EM approval required).
117
+ - No testing starts until Phase 2 code review passes.
118
+ - No PR is created until all tests pass (unit + E2E).
119
+ - No task is marked done until the user has reviewed and accepted.
120
+
121
+ ---
122
+
123
+ # Phase 1 — Planning (Stages 0-3)
124
+
125
+ ## 1a — Understand the Requirement `[Orchestrator]`
126
+ Read the task twice. Find the spec/reference for this feature (check `docs/specs/`,
127
+ `docs/planning/`). Identify which module/package it belongs in.
128
+ **Gate:** Can you explain in one sentence what the task asks for and where it lives?
129
+
130
+ ## 1b — Clarify Ambiguities `[Orchestrator]`
131
+ If ANYTHING is vague, STOP and ask before proceeding. Never infer missing requirements. State
132
+ assumptions explicitly and ask for confirmation.
133
+ **Gate:** Are all requirements clear and confirmed?
134
+
135
+ ## 1c — Create Feature Spec `[Spec Writer]`
136
+ **Output:** `docs/specs/{feature-name}_spec.md` with: overview; numbered requirements (R1,
137
+ R2, …) each with a user story, acceptance criteria, and edge cases; dependencies; out of
138
+ scope; assumptions; open questions.
139
+ **Rules:** every requirement has acceptance criteria; flag conflicts; mark assumptions; the
140
+ spec is the contract. **Gate:** spec exists with acceptance criteria for every requirement and
141
+ the user has confirmed it.
142
+
143
+ ## 1d — Create Developer Documentation `[Dev Doc Writer]`
144
+ Append a Developer Documentation section to the same spec file: architecture overview, file
145
+ structure, data models, component/interface contracts, state management, implementation
146
+ steps, error handling, edge-case mapping, non-functional requirements, and a spec-traceability
147
+ table (each requirement → implementation approach → files).
148
+ **Gate:** the spec file now covers all requirements with an implementation approach.
149
+
150
+ ## 1e — EM Review & Approval `[EM Reviewer]`
151
+ A skeptical Engineering Manager reviews the dev docs for completeness, quality (simplest
152
+ approach, no over/under-engineering), non-functional concerns, and architecture fit.
153
+ Feedback loops with the Dev Doc Writer, **max 3 iterations**, then escalate.
154
+ **Gate:** EM signals `APPROVED`. Development CANNOT start without it.
155
+
156
+ ---
157
+
158
+ # Phase 2 — Development (Stages 4-5)
159
+
160
+ ## 2a — Read Existing Code & Confirm Scope `[Developer]`
161
+ Work in an **isolated git worktree**. Before writing code, read the approved spec + dev docs,
162
+ the relevant `.claude/rules/*` for your stack, and EVERY file you plan to modify — in full.
163
+ Understand a function's callers/returns before changing it. Reuse existing utilities and
164
+ components — search before creating.
165
+
166
+ **Scope check** for every planned edit: is this file in the task? does the task depend on it?
167
+ can the task be done WITHOUT this edit? If yes to the last, drop it.
168
+
169
+ Changes to **project-wide files** (build config, dependency manifests, lockfiles, CI config,
170
+ app entry points, shared barrels) require telling the user what and why, the impact, and
171
+ getting approval first. NEVER add/remove/upgrade dependencies without confirmation.
172
+ **Gate:** you understand every file/function you'll touch; the file list is task-scoped only.
173
+
174
+ ## 2b — Write Implementation Code `[Developer]`
175
+ Follow the approved spec + dev docs and your stack's rules.
176
+ - Put files in the correct module/package; don't put module-specific code in shared dirs.
177
+ - Reuse the design system / shared components; follow existing patterns and naming.
178
+ - **Every data-driven UI component handles all states:** loading, empty, error, success.
179
+ - **Accessibility (UI):** keyboard access, alt text, ARIA labels, focus management, color is
180
+ never the only indicator, sufficient contrast. See `.claude/rules/responsive-and-accessibility.md`.
181
+ - **Responsiveness (UI):** works at mobile/tablet/desktop widths; mobile-first.
182
+ - **Edge cases:** handle null/undefined/empty/zero/boundary inputs.
183
+ - **No error suppression** (no `@ts-ignore`, `as any`, blanket lint-disable, bare excepts to
184
+ hide failures). If you can't resolve an error properly, STOP and ask.
185
+ - **Root-cause fixes only** — understand WHY before fixing; never paper over with a fallback.
186
+
187
+ After implementation, run the quality gate: the project's **linter → type-check → build**;
188
+ all must pass before committing to the worktree.
189
+ **Gate:** implementation matches the spec; lint/type-check/build pass; code is committed.
190
+
191
+ ## 2c — Code Review `[Code Reviewer]`
192
+ The reviewer is read-only — suggests changes, does NOT write code. It reads the spec and the
193
+ relevant rules, then checks: correctness vs. spec & acceptance criteria; code quality
194
+ (no suppressed errors, explicit types, null handling, no dead code, naming, function/file
195
+ size); performance; security; linting; design-system/responsive/accessibility compliance;
196
+ conventions. Feedback loops with the Developer, **max 5 iterations**, then escalate.
197
+ **Gate:** Code Reviewer signals `APPROVED`. Testing CANNOT start without it.
198
+
199
+ ## 2d — Breaking Changes + Impact Check `[Developer]`
200
+ If you renamed an export, changed a signature, or modified a shared module/utility — find
201
+ every consumer and verify it still works. Run the full test suite (not just your tests).
202
+ Review the diff for changes outside your scope.
203
+ **Gate:** zero regressions verified across the codebase.
204
+
205
+ ---
206
+
207
+ # Phase 3 — Testing & Delivery (Stages 6-7)
208
+
209
+ ## 3a — Unit Tests `[Unit Tester]` (parallel with 3b)
210
+ Cover every public function/module: happy paths, edge cases, error scenarios, all branches,
211
+ all UI states, and accessibility attributes. Tests mirror source structure; test behavior,
212
+ not implementation; query by role/label/text over test ids. **Target: 90% coverage** on
213
+ statements/branches/functions/lines (adjust to your project's standard).
214
+ **Gate:** all tests pass; coverage meets the threshold.
215
+
216
+ ## 3b — E2E Tests `[E2E Tester]` (parallel with 3a)
217
+ Cover critical user journeys, navigation, forms (input→validation→submit→success/error), data
218
+ display, interactive components, and error/empty states. For UI, test at **mobile (≈375px),
219
+ tablet (≈768px), desktop (≈1024px+)** — check overflow, touch targets, layout adaptation. Use
220
+ accessible selectors; each test is independent.
221
+ **Gate:** all E2E tests pass at all viewports.
222
+
223
+ ## 3b.5 — Test-Coverage Gate: Blind Review + Devil's Advocate
224
+ Parallel reviewers/testers assess **independently** (no shared findings) and each returns
225
+ PASS/FAIL with severity-classified findings. Any Critical/High/Medium → gate FAILs.
226
+ **Anti-sycophancy:** a **unanimous PASS** triggers the `devils-advocate` agent, which assumes
227
+ the work is guilty. The gate is not PASS until it returns **CONFIRMED**; an **UPHELD** verdict
228
+ re-opens the defect loop. See `.claude/rules/quality-gates.md`.
229
+
230
+ ## 3b.6 — Security (gate: Security Clear)
231
+ The `security-reviewer` dispatches four sub-scanners in parallel — `secret-scanner`,
232
+ `dependency-scanner`, `owasp-reviewer`, `policy-validator` — and aggregates by severity.
233
+ **Security Clear** passes with zero Critical/High/Medium. Failures route to the dev lane via
234
+ the defect loop; only the affected scanner re-runs.
235
+
236
+ ## 3b.7 — DevOps + Observability (conditional, before PR)
237
+ For changes touching a **deployable or observable surface**, run two gated phases (skip with a
238
+ noted reason otherwise — see `.claude/rules/devops-observability.md`):
239
+ - **DevOps** `[devops-engineer]` — **Pipeline Green**: CI valid, build/containers healthy, env
240
+ vars + migrations + runbook complete.
241
+ - **Observability** `[observability-engineer]` — **Observability Ready**: SLOs/SLIs, health/
242
+ readiness checks cover new deps, structured logs + alerts, request-id propagation.
243
+
244
+ ## 3c — PR Creation `[PR Raiser]`
245
+ Triggered only after BOTH test agents report success.
246
+ 1. **Final quality gate:** the project's lint → type-check → unit tests → E2E tests → build.
247
+ 2. **Commit hygiene:** follow the project's commit convention; stage files by name (never
248
+ `git add -A`); never commit secrets; never `--no-verify`; never force-push to main.
249
+ 3. **Create the PR** with a structured description: summary, changes, spec traceability, test
250
+ evidence (counts, coverage, viewports), breaking changes.
251
+ 4. Report the PR URL + status.
252
+
253
+ ## 3d — Human Review + Deploy `[Human-in-the-Loop]`
254
+ Present: what was built (plain language), pipeline status, files changed, test coverage, known
255
+ limitations, PR URL. **The task is NOT complete until the user reviews and accepts.**
256
+ **Deploy is user-directed:** ask whether to deploy and to which environment. Do NOT deploy
257
+ without explicit confirmation. Run the project's deploy command only after the user confirms;
258
+ report the output; on failure, share the error and do NOT retry without asking.
259
+
260
+ ---
261
+
262
+ # Quick Reference
263
+
264
+ ## Bug fix flow
265
+ ```
266
+ B1 understand → B2 failing test → B3 root cause → B4 fix → B5 quality gate → B6 commit + report
267
+ ```
268
+
269
+ ## Feature flow — SDLC Agent Pipeline
270
+ ```
271
+ Phase 1: 1a Understand [Orchestrator] → 1b Clarify → 1c Spec [Spec Writer]
272
+ → 1d Dev docs [Dev Doc Writer] → 1e EM review [EM Reviewer, max 3]
273
+ Phase 2: 2a Read code [Developer] → 2b Implement → 2c Code review [Code Reviewer, max 5] → 2d Impact check
274
+ Phase 3: 3a Unit tests ─┐ 3b E2E tests ─┘ (parallel)
275
+ → 3b.5 Test-coverage gate (blind review + Devil's Advocate)
276
+ → 3b.6 Security (Security Clear) → 3b.7 DevOps + Observability (if applicable)
277
+ → 3c PR creation [PR Raiser] → 3d Human review + deploy
278
+ ```
279
+
280
+ ## Pipeline gating
281
+ | Gate | Required before |
282
+ |------|-----------------|
283
+ | Requirements clarified (1b) | Spec Writer starts |
284
+ | Spec approved by user (1c) | Dev Doc Writer starts |
285
+ | EM `APPROVED` (1e) | Developer starts coding |
286
+ | Code Reviewer `APPROVED` (2c) | Testing starts |
287
+ | Both testers pass (3a+3b) | Test-coverage gate |
288
+ | Test-coverage PASS/CONFIRMED (3b.5) | Security review |
289
+ | Security Clear (3b.6) | DevOps + Observability (if applicable) |
290
+ | Pipeline Green + Observability Ready (3b.7) | PR Raiser starts |
291
+ | All checks pass (3c) | PR is created |
292
+ | User accepts (3d) | Task is complete |
293
+
294
+ ## When to STOP and ask the user
295
+ Vague/ambiguous requirements; existing code looks wrong but works; task needs changes outside
296
+ scope or to project-wide files; task needs dependency changes; a type/lint error can't be
297
+ resolved properly; a review loop is exhausted; the quality gate fails and can't be fixed; the
298
+ commit ticket ID is needed; the deploy environment is needed. See
299
+ `.claude/rules/human-in-the-loop.md` for the full set of decision points and the escalation protocol.
300
+
301
+ ## Commit & ticket format (customize per project)
302
+ The default is **Conventional Commits**: `type(scope): summary` where `type` ∈
303
+ `feat|fix|refactor|test|docs|chore`. If your team uses ticket-prefixed commits, define that
304
+ format here (e.g. `ID:<TICKET>; <summary>`) and the PR Raiser will follow it. Always ask the
305
+ user for the ticket ID — never guess.
306
+
307
+ ## Files that require user approval before editing
308
+ Build config, dependency manifests + lockfiles, CI config, app entry points, shared component
309
+ barrels/index files, `CLAUDE.md`, and `.claude/rules/*`. Define the exact list for your project.
@@ -0,0 +1,34 @@
1
+ # Model Tiers
2
+
3
+ Each agent declares an explicit `model:` in its frontmatter — pick the tier deliberately. Three tiers
4
+ balance capability against cost (the most capable model costs several times the cheapest per token), so
5
+ spend the strongest reasoning where a wrong answer is expensive and the cheapest where the work is
6
+ mechanical. This is the concrete assignment policy behind the "resource-aware effort" guidance in
7
+ `.claude/rules/reasoning-techniques.md`.
8
+
9
+ > Adapted from a portfolio project's model-tiers rule; aligned to claude-kit's agent roster. Model
10
+ > names are Claude tiers, not a tech stack — the tier *intent* matters more than the exact alias.
11
+
12
+ ## Policy
13
+
14
+ | Tier | Model | Use for | Agents |
15
+ |------|-------|---------|--------|
16
+ | **Critical** | `opus` | Architecture decisions, deep code/security reasoning, orchestration, adversarial review | `orchestrator`, `developer`, `devils-advocate`, `owasp-reviewer` |
17
+ | **Default** | `sonnet` | Specs, reviews, testing, infra, coordination, scanning, incident command, risk classification | `spec-doc-writer`, `story-planner`, `technical-architect`, `em-reviewer`, `senior-backend-dev`, `senior-frontend-dev`, `ui-designer`, `merge-reviewer`, `sdlc-code-reviewer`, `unit-tester`, `e2e-tester`, `tester`, `senior-tester`, `acceptance-reviewer`, `risk-classifier`, `security-reviewer`, `secret-scanner`, `dependency-scanner`, `policy-validator`, `devops-engineer`, `observability-engineer`, `pr-raiser`, `incident-responder` |
18
+ | **Fast** | `haiku` | Mechanical, read-only reporting | `auditor` |
19
+
20
+ Stack **overlay** agents (e.g. `postgres-specialist`, `mongodb-specialist`, `migration-specialist`,
21
+ `db-performance-reviewer`) and the organization persona agents (`pm-copilot`, `founder-prototype-agent`,
22
+ `support-ticket-engineer`, `data-workflow-agent`, `internal-tools-builder`) default to the **Default**
23
+ tier — they are focused specialists/personas, not deep-reasoning orchestrators.
24
+
25
+ ## Notes
26
+
27
+ - **Per-session promotion.** For a high-risk change (auth, migrations, billing) or a SEV1 incident,
28
+ start the session on the most capable model, or temporarily bump a Default agent's frontmatter to
29
+ `opus`. The senior-dev reviewers and `incident-responder` are the most common candidates. See
30
+ `.claude/rules/human-in-the-loop.md` for when such changes are human-gated.
31
+ - **`owasp-reviewer` stays `opus`** (vulnerability reasoning) even though its sibling scanners
32
+ (`secret-scanner`, `dependency-scanner`, `policy-validator`) are `sonnet` (pattern/tool work).
33
+ - **Re-map when names/prices change.** Keep the tier *intent* (Critical / Default / Fast); swap the
34
+ concrete alias if Anthropic's model lineup shifts.
@@ -0,0 +1,107 @@
1
+ # Quality Gates, Severity & Blind Review
2
+
3
+ This rule adds three things on top of the existing pipeline in `mandatory-workflow.md`:
4
+
5
+ 1. a single **severity model** every reviewer and tester classifies findings against,
6
+ 2. **gate semantics** (PASS / FAIL / retry / escalate) shared by all gates, and
7
+ 3. a **blind review + Devil's Advocate** protocol that prevents AI reviewers from rubber-stamping each other.
8
+
9
+ It does not replace the pipeline gates already defined in `mandatory-workflow.md` — it standardizes *how* those gates decide PASS vs FAIL.
10
+
11
+ ---
12
+
13
+ ## 1. Severity Model
14
+
15
+ Every finding from a reviewer, tester, security agent, or merge reviewer is classified into exactly one severity. Severity drives whether a gate blocks.
16
+
17
+ | Severity | Definition | Gate action |
18
+ |----------|-----------|-------------|
19
+ | **Critical** | Security hole, data loss, authorization bypass, crash, build broken | BLOCK — fix immediately, re-run the lane |
20
+ | **High** | Broken functionality, failing acceptance criterion, major bug | BLOCK — fix before the gate passes |
21
+ | **Medium** | Minor bug, code smell, perf issue, missing edge-case handling | BLOCK — fix before delivery (PR) |
22
+ | **Low** | Style nit, minor naming, non-blocking doc gap | Note as TODO — does not block |
23
+ | **Cosmetic** | Formatting, wording preference | Informational — no action required |
24
+
25
+ **Blocking rule:** a gate is **PASS** only when zero Critical, zero High, and zero Medium findings remain open. Low/Cosmetic may pass with notes. This matches the existing reviewer rule "do not approve with unresolved critical or high-severity issues" and tightens Medium to block before PR.
26
+
27
+ **Auto-Critical findings** (never downgrade these):
28
+ - A hardcoded secret, password, API key, or token in code or configuration.
29
+ - Missing authentication or authorization checks on a protected endpoint/resource.
30
+ - Missing tenant/organization scoping on a multi-tenant query (authorization bypass).
31
+ - Blocking I/O on an async/event-loop execution path (deadlock risk).
32
+ - Error suppression that hides failures (blanket exception catching, type-cast to silence errors, linter disable without justification).
33
+ - Broken build (lint errors, type errors, compilation failures, import errors).
34
+
35
+ ---
36
+
37
+ ## 2. Gate Semantics
38
+
39
+ Every gate is binary: **PASS** or **FAIL**.
40
+
41
+ ```
42
+ Phase completes -> Gate
43
+ PASS -> advance to next phase
44
+ FAIL -> fix highest-severity findings first
45
+ -> log the miss to CONTINUITY.md (and agent-memory if durable)
46
+ -> retry the gate
47
+ retries exhausted -> escalate to human with unresolved findings
48
+ ```
49
+
50
+ **Retry budgets** (already in `mandatory-workflow.md`; restated for one place):
51
+ - Design review: 3 · Senior dev: 3 · Tech architect: 3 · EM: 3
52
+ - Code review: 5 · Merge reviewer: 2 · Defect loop: 2 cycles
53
+
54
+ When a gate FAILs, the agent records the miss in `CONTINUITY.md` under **Mistakes & Learnings** so the same defect is not reintroduced on retry.
55
+
56
+ ---
57
+
58
+ ## 3. Blind Review + Devil's Advocate
59
+
60
+ Applies wherever **multiple reviewers assess the same artifact in parallel** — primarily:
61
+ - the **test-coverage merge gate** (multiple independent test lanes feeding the merge reviewer), and
62
+ - any **multi-reviewer review phase** the Orchestrator runs in parallel.
63
+
64
+ ### Blind review
65
+ 1. Reviewers assess **independently** — each gets the artifact + spec + rules, none sees another's findings until all have reported.
66
+ 2. Each returns a structured verdict: `PASS | FAIL` + findings classified by the severity model above.
67
+ 3. The Orchestrator (or merge reviewer) aggregates. Any Critical/High/Medium from any reviewer → gate FAILs.
68
+
69
+ ### Devil's Advocate (anti-sycophancy)
70
+ A **unanimous PASS is suspicious**, not reassuring — independent AI reviewers tend to converge and rubber-stamp.
71
+
72
+ > When all reviewers return PASS with no Critical/High/Medium findings, the Orchestrator MUST spawn the `devils-advocate` agent before the gate is allowed to pass — **in any profile that installs it** (standard and enterprise). The **lean** profile's fast track omits this adversarial pass and does not install the agent.
73
+
74
+ The Devil's Advocate assumes the artifact is guilty and hunts for what everyone missed. Its verdict:
75
+ - **UPHELD** — found a real Critical/High/Medium issue → gate FAILs, route to the fix lane.
76
+ - **CONFIRMED** — genuinely clean after adversarial effort → gate PASSes.
77
+
78
+ Where the agent is installed, a gate reached by unanimous PASS is not PASS until the Devil's Advocate returns CONFIRMED. See `.claude/agents/devils-advocate.md` (present in the standard and enterprise profiles).
79
+
80
+ ---
81
+
82
+ ## 4. Where Gates Live (Example Pipeline)
83
+
84
+ | Gate | Phase | Pass criteria | Blind/Devil's? |
85
+ |------|-------|---------------|----------------|
86
+ | Spec/Dev-doc complete | 1–2 | Numbered reqs + acceptance criteria + dev-doc sections | No |
87
+ | EM approved | 1e | EM `APPROVED`, all reqs have an approach | No |
88
+ | Code review passed | 2c | Reviewer `APPROVED`, 0 Critical/High/Medium | No (single reviewer/lane) |
89
+ | Build green | 2b/2d | linter + type checker + unit tests pass | No |
90
+ | Test coverage verified | 3 | All acceptance criteria covered across lanes | **Yes** — senior testers blind, Devil's Advocate on unanimous PASS |
91
+ | Security clear | 5.4 | 0 Critical/High/Medium, no secrets, deps patched, policies enforced | No — `security-reviewer` + sub-scanners |
92
+ | Pipeline green | DevOps | CI valid, container/build artifacts healthy, runbook complete | No — see `devops-observability.md` |
93
+ | Observability ready | Observability | SLOs, health checks, alerts, structured logs | No — see `devops-observability.md` |
94
+
95
+ ---
96
+
97
+ ## 5. Process Signals (optional, lightweight)
98
+
99
+ Track these in `CONTINUITY.md` when running a full pipeline; they reveal a degrading process early:
100
+
101
+ | Signal | Healthy | Investigate |
102
+ |--------|---------|-------------|
103
+ | Gate first-pass rate | ≥ 80% | < 60% |
104
+ | Avg fix iterations per gate | ≤ 1.5 | > 3 |
105
+ | Defect-loop cycles per feature | ≤ 1 | 2 (then escalate) |
106
+
107
+ These are observability for the *process*, not a gate. Do not block on them.