create-rigel 0.1.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 (240) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/cli.js +122 -0
  4. package/package.json +47 -0
  5. package/templates/express/.claude/CLAUDE.md +114 -0
  6. package/templates/express/.claude/agents/arch-validator.md +85 -0
  7. package/templates/express/.claude/agents/db-optimizer.md +72 -0
  8. package/templates/express/.claude/agents/doc-gardener.md +67 -0
  9. package/templates/express/.claude/agents/garbage-collector.md +94 -0
  10. package/templates/express/.claude/agents/gate-checker.md +176 -0
  11. package/templates/express/.claude/agents/reviewer.md +84 -0
  12. package/templates/express/.claude/agents/security-auditor.md +82 -0
  13. package/templates/express/.claude/hooks/post-write.sh +93 -0
  14. package/templates/express/.claude/rules/api.md +149 -0
  15. package/templates/express/.claude/rules/architecture.md +78 -0
  16. package/templates/express/.claude/rules/database.md +104 -0
  17. package/templates/express/.claude/rules/jobs.md +81 -0
  18. package/templates/express/.claude/rules/security.md +92 -0
  19. package/templates/express/.claude/rules/testing.md +97 -0
  20. package/templates/express/.claude/settings.json +35 -0
  21. package/templates/express/.claude/skills/00-infra-setup/SKILL.md +479 -0
  22. package/templates/express/.claude/skills/01-write-roadmap/SKILL.md +72 -0
  23. package/templates/express/.claude/skills/02-write-spec/SKILL.md +119 -0
  24. package/templates/express/.claude/skills/03-write-plan/SKILL.md +124 -0
  25. package/templates/express/.claude/skills/04-build-layer/SKILL.md +216 -0
  26. package/templates/express/.claude/skills/05-validate-layer/SKILL.md +43 -0
  27. package/templates/express/.claude/skills/06-push-layer/SKILL.md +59 -0
  28. package/templates/express/.claude/skills/07-layer-check/SKILL.md +62 -0
  29. package/templates/express/.claude/skills/08-garbage-collect/SKILL.md +86 -0
  30. package/templates/express/.claude/skills/09-doc-garden/SKILL.md +64 -0
  31. package/templates/express/.claude/skills/10-db-optimize/SKILL.md +96 -0
  32. package/templates/express/.claude/skills/11-load-test/SKILL.md +77 -0
  33. package/templates/express/.dockerignore +43 -0
  34. package/templates/express/.env.example +42 -0
  35. package/templates/express/.github/CODEOWNERS +22 -0
  36. package/templates/express/.github/dependabot.yml +48 -0
  37. package/templates/express/.github/pull_request_template.md +58 -0
  38. package/templates/express/.github/workflows/ci.yml +278 -0
  39. package/templates/express/.github/workflows/load-test.yml +41 -0
  40. package/templates/express/.gitleaks.toml +18 -0
  41. package/templates/express/.lintstagedrc.json +3 -0
  42. package/templates/express/.nvmrc +1 -0
  43. package/templates/express/.prettierrc +8 -0
  44. package/templates/express/.sequelizerc +8 -0
  45. package/templates/express/AGENTS.md +94 -0
  46. package/templates/express/ARCHITECTURE.md +161 -0
  47. package/templates/express/Dockerfile +40 -0
  48. package/templates/express/Makefile +79 -0
  49. package/templates/express/QUICKSTART.md +131 -0
  50. package/templates/express/docker-compose.yml +114 -0
  51. package/templates/express/docs/PLANS.md +111 -0
  52. package/templates/express/docs/QUALITY_SCORE.md +66 -0
  53. package/templates/express/docs/design-docs/core-beliefs.md +89 -0
  54. package/templates/express/docs/design-docs/decisions/ADR-000-infrastructure.md +70 -0
  55. package/templates/express/docs/design-docs/decisions/ADR-001-observability.md +82 -0
  56. package/templates/express/docs/design-docs/decisions/index.md +23 -0
  57. package/templates/express/docs/design-docs/index.md +11 -0
  58. package/templates/express/docs/design-docs/observability.md +194 -0
  59. package/templates/express/docs/design-docs/team-workflow.md +64 -0
  60. package/templates/express/docs/exec-plans/active/.gitkeep +0 -0
  61. package/templates/express/docs/exec-plans/completed/.gitkeep +0 -0
  62. package/templates/express/docs/exec-plans/tech-debt-tracker.md +31 -0
  63. package/templates/express/docs/generated/.gitkeep +0 -0
  64. package/templates/express/docs/product-specs/ROADMAP.md +49 -0
  65. package/templates/express/docs/product-specs/draft/.gitkeep +0 -0
  66. package/templates/express/docs/product-specs/index.md +21 -0
  67. package/templates/express/docs/product-specs/ready/.gitkeep +0 -0
  68. package/templates/express/eslint.config.mjs +94 -0
  69. package/templates/express/gitignore +36 -0
  70. package/templates/express/infra/monitoring/alloy/config.alloy +59 -0
  71. package/templates/express/jest.config.ts +61 -0
  72. package/templates/express/package.json +45 -0
  73. package/templates/express/scripts/openapi.export.ts +77 -0
  74. package/templates/express/tests/architecture/isolation.test.ts +51 -0
  75. package/templates/express/tests/architecture/layers.test.ts +83 -0
  76. package/templates/express/tests/integration/health.test.ts +40 -0
  77. package/templates/express/tests/integration/isolation.test.template.ts +88 -0
  78. package/templates/express/tests/load/smoke.js +46 -0
  79. package/templates/express/tests/load/soak.js +45 -0
  80. package/templates/express/tests/load/stress.js +44 -0
  81. package/templates/express/tests/unit/utils/response.util.test.ts +53 -0
  82. package/templates/express/tsconfig.build.json +8 -0
  83. package/templates/express/tsconfig.json +20 -0
  84. package/templates/fastapi/.claude/CLAUDE.md +122 -0
  85. package/templates/fastapi/.claude/agents/arch-validator.md +64 -0
  86. package/templates/fastapi/.claude/agents/db-optimizer.md +59 -0
  87. package/templates/fastapi/.claude/agents/doc-gardener.md +55 -0
  88. package/templates/fastapi/.claude/agents/garbage-collector.md +74 -0
  89. package/templates/fastapi/.claude/agents/gate-checker.md +133 -0
  90. package/templates/fastapi/.claude/agents/reviewer.md +74 -0
  91. package/templates/fastapi/.claude/agents/security-auditor.md +69 -0
  92. package/templates/fastapi/.claude/hooks/post-write.sh +65 -0
  93. package/templates/fastapi/.claude/rules/api.md +119 -0
  94. package/templates/fastapi/.claude/rules/architecture.md +84 -0
  95. package/templates/fastapi/.claude/rules/database.md +153 -0
  96. package/templates/fastapi/.claude/rules/jobs.md +85 -0
  97. package/templates/fastapi/.claude/rules/security.md +102 -0
  98. package/templates/fastapi/.claude/rules/testing.md +207 -0
  99. package/templates/fastapi/.claude/settings.json +50 -0
  100. package/templates/fastapi/.claude/skills/00-infra-setup/SKILL.md +311 -0
  101. package/templates/fastapi/.claude/skills/01-write-roadmap/SKILL.md +61 -0
  102. package/templates/fastapi/.claude/skills/02-write-spec/SKILL.md +82 -0
  103. package/templates/fastapi/.claude/skills/03-write-plan/SKILL.md +83 -0
  104. package/templates/fastapi/.claude/skills/04-build-layer/SKILL.md +170 -0
  105. package/templates/fastapi/.claude/skills/05-validate-layer/SKILL.md +20 -0
  106. package/templates/fastapi/.claude/skills/06-push-layer/SKILL.md +31 -0
  107. package/templates/fastapi/.claude/skills/07-layer-check/SKILL.md +51 -0
  108. package/templates/fastapi/.claude/skills/08-garbage-collect/SKILL.md +47 -0
  109. package/templates/fastapi/.claude/skills/09-doc-garden/SKILL.md +9 -0
  110. package/templates/fastapi/.claude/skills/10-db-optimize/SKILL.md +53 -0
  111. package/templates/fastapi/.claude/skills/11-load-test/SKILL.md +81 -0
  112. package/templates/fastapi/.dockerignore +30 -0
  113. package/templates/fastapi/.github/dependabot.yml +24 -0
  114. package/templates/fastapi/AGENTS.md +87 -0
  115. package/templates/fastapi/ARCHITECTURE.md +141 -0
  116. package/templates/fastapi/Makefile +42 -0
  117. package/templates/fastapi/README.md +179 -0
  118. package/templates/fastapi/docs/PLANS.md +26 -0
  119. package/templates/fastapi/docs/QUALITY_SCORE.md +26 -0
  120. package/templates/fastapi/docs/design-docs/core-beliefs.md +46 -0
  121. package/templates/fastapi/docs/design-docs/decisions/ADR-000-infrastructure.md +79 -0
  122. package/templates/fastapi/docs/design-docs/decisions/index.md +7 -0
  123. package/templates/fastapi/docs/design-docs/index.md +9 -0
  124. package/templates/fastapi/docs/exec-plans/active/.gitkeep +0 -0
  125. package/templates/fastapi/docs/exec-plans/completed/.gitkeep +0 -0
  126. package/templates/fastapi/docs/exec-plans/tech-debt-tracker.md +19 -0
  127. package/templates/fastapi/docs/generated/.gitkeep +0 -0
  128. package/templates/fastapi/docs/product-specs/ROADMAP.md +49 -0
  129. package/templates/fastapi/docs/product-specs/draft/.gitkeep +0 -0
  130. package/templates/fastapi/docs/product-specs/index.md +18 -0
  131. package/templates/fastapi/docs/product-specs/ready/.gitkeep +0 -0
  132. package/templates/fastapi/gitignore +46 -0
  133. package/templates/fastapi/scripts/gate.sh +68 -0
  134. package/templates/nestjs/.claude/CLAUDE.md +121 -0
  135. package/templates/nestjs/.claude/agents/db-optimizer.md +51 -0
  136. package/templates/nestjs/.claude/agents/doc-gardener.md +45 -0
  137. package/templates/nestjs/.claude/agents/garbage-collector.md +50 -0
  138. package/templates/nestjs/.claude/agents/gate-checker.md +127 -0
  139. package/templates/nestjs/.claude/agents/reviewer.md +68 -0
  140. package/templates/nestjs/.claude/agents/security-auditor.md +72 -0
  141. package/templates/nestjs/.claude/hooks/post-write.sh +91 -0
  142. package/templates/nestjs/.claude/rules/api.md +87 -0
  143. package/templates/nestjs/.claude/rules/architecture.md +104 -0
  144. package/templates/nestjs/.claude/rules/database.md +111 -0
  145. package/templates/nestjs/.claude/rules/security.md +110 -0
  146. package/templates/nestjs/.claude/rules/testing.md +145 -0
  147. package/templates/nestjs/.claude/settings.json +33 -0
  148. package/templates/nestjs/.claude/skills/00-infra-setup/SKILL.md +222 -0
  149. package/templates/nestjs/.claude/skills/01-write-spec/SKILL.md +25 -0
  150. package/templates/nestjs/.claude/skills/02-write-plan/SKILL.md +18 -0
  151. package/templates/nestjs/.claude/skills/03-build-layer/SKILL.md +242 -0
  152. package/templates/nestjs/.claude/skills/04-validate-layer/SKILL.md +4 -0
  153. package/templates/nestjs/.claude/skills/05-push-layer/SKILL.md +6 -0
  154. package/templates/nestjs/.claude/skills/06-layer-check/SKILL.md +12 -0
  155. package/templates/nestjs/.claude/skills/07-garbage-collect/SKILL.md +2 -0
  156. package/templates/nestjs/.claude/skills/08-doc-garden/SKILL.md +4 -0
  157. package/templates/nestjs/.claude/skills/09-api-sync/SKILL.md +36 -0
  158. package/templates/nestjs/.claude/skills/10-load-test/SKILL.md +29 -0
  159. package/templates/nestjs/.env.example +11 -0
  160. package/templates/nestjs/AGENTS.md +88 -0
  161. package/templates/nestjs/ARCHITECTURE.md +192 -0
  162. package/templates/nestjs/docs/PLANS.md +22 -0
  163. package/templates/nestjs/docs/QUALITY_SCORE.md +27 -0
  164. package/templates/nestjs/docs/design-docs/core-beliefs.md +18 -0
  165. package/templates/nestjs/docs/design-docs/decisions/ADR-000-infrastructure.md +58 -0
  166. package/templates/nestjs/docs/design-docs/decisions/index.md +7 -0
  167. package/templates/nestjs/docs/design-docs/index.md +7 -0
  168. package/templates/nestjs/docs/exec-plans/active/.gitkeep +0 -0
  169. package/templates/nestjs/docs/exec-plans/completed/.gitkeep +0 -0
  170. package/templates/nestjs/docs/exec-plans/tech-debt-tracker.md +16 -0
  171. package/templates/nestjs/docs/generated/.gitkeep +0 -0
  172. package/templates/nestjs/docs/product-specs/draft/.gitkeep +0 -0
  173. package/templates/nestjs/docs/product-specs/index.md +7 -0
  174. package/templates/nestjs/docs/product-specs/ready/.gitkeep +0 -0
  175. package/templates/nestjs/gitignore +8 -0
  176. package/templates/nextjs/.claude/CLAUDE.md +139 -0
  177. package/templates/nextjs/.claude/agents/arch-validator.md +66 -0
  178. package/templates/nextjs/.claude/agents/contract-checker.md +78 -0
  179. package/templates/nextjs/.claude/agents/doc-gardener.md +52 -0
  180. package/templates/nextjs/.claude/agents/garbage-collector.md +61 -0
  181. package/templates/nextjs/.claude/agents/gate-checker.md +129 -0
  182. package/templates/nextjs/.claude/agents/perf-auditor.md +109 -0
  183. package/templates/nextjs/.claude/agents/reviewer.md +79 -0
  184. package/templates/nextjs/.claude/agents/security-auditor.md +50 -0
  185. package/templates/nextjs/.claude/hooks/post-write.sh +121 -0
  186. package/templates/nextjs/.claude/rules/api-contract.md +166 -0
  187. package/templates/nextjs/.claude/rules/architecture.md +99 -0
  188. package/templates/nextjs/.claude/rules/components.md +122 -0
  189. package/templates/nextjs/.claude/rules/security.md +122 -0
  190. package/templates/nextjs/.claude/rules/testing.md +187 -0
  191. package/templates/nextjs/.claude/scripts/infra-setup.sh +550 -0
  192. package/templates/nextjs/.claude/settings.json +33 -0
  193. package/templates/nextjs/.claude/skills/00-infra-setup/SKILL.md +471 -0
  194. package/templates/nextjs/.claude/skills/01-write-roadmap/SKILL.md +77 -0
  195. package/templates/nextjs/.claude/skills/02-write-spec/SKILL.md +78 -0
  196. package/templates/nextjs/.claude/skills/03-write-plan/SKILL.md +91 -0
  197. package/templates/nextjs/.claude/skills/04-build-layer/SKILL.md +141 -0
  198. package/templates/nextjs/.claude/skills/05-validate-layer/SKILL.md +13 -0
  199. package/templates/nextjs/.claude/skills/06-push-layer/SKILL.md +20 -0
  200. package/templates/nextjs/.claude/skills/07-layer-check/SKILL.md +28 -0
  201. package/templates/nextjs/.claude/skills/08-garbage-collect/SKILL.md +14 -0
  202. package/templates/nextjs/.claude/skills/09-doc-garden/SKILL.md +12 -0
  203. package/templates/nextjs/.claude/skills/10-api-sync/SKILL.md +50 -0
  204. package/templates/nextjs/.claude/skills/11-perf-budget/SKILL.md +51 -0
  205. package/templates/nextjs/.dockerignore +25 -0
  206. package/templates/nextjs/.gitattributes +10 -0
  207. package/templates/nextjs/.github/CODEOWNERS +24 -0
  208. package/templates/nextjs/.github/dependabot.yml +31 -0
  209. package/templates/nextjs/.github/pull_request_template.md +59 -0
  210. package/templates/nextjs/.github/workflows/ci.yml +143 -0
  211. package/templates/nextjs/.github/workflows/lighthouse.yml +54 -0
  212. package/templates/nextjs/.github/workflows/load-test.yml +54 -0
  213. package/templates/nextjs/.husky/pre-commit +1 -0
  214. package/templates/nextjs/.lintstagedrc.json +4 -0
  215. package/templates/nextjs/.mcp.json +8 -0
  216. package/templates/nextjs/.prettierignore +13 -0
  217. package/templates/nextjs/.prettierrc +9 -0
  218. package/templates/nextjs/AGENTS.md +88 -0
  219. package/templates/nextjs/ARCHITECTURE.md +165 -0
  220. package/templates/nextjs/Dockerfile +38 -0
  221. package/templates/nextjs/Makefile +50 -0
  222. package/templates/nextjs/QUICKSTART.md +128 -0
  223. package/templates/nextjs/docs/PLANS.md +23 -0
  224. package/templates/nextjs/docs/QUALITY_SCORE.md +27 -0
  225. package/templates/nextjs/docs/design-docs/core-beliefs.md +43 -0
  226. package/templates/nextjs/docs/design-docs/decisions/ADR-000-infrastructure.md +72 -0
  227. package/templates/nextjs/docs/design-docs/decisions/index.md +7 -0
  228. package/templates/nextjs/docs/design-docs/index.md +7 -0
  229. package/templates/nextjs/docs/design-docs/team-workflow.md +66 -0
  230. package/templates/nextjs/docs/exec-plans/active/.gitkeep +0 -0
  231. package/templates/nextjs/docs/exec-plans/completed/.gitkeep +0 -0
  232. package/templates/nextjs/docs/exec-plans/tech-debt-tracker.md +19 -0
  233. package/templates/nextjs/docs/generated/.gitkeep +0 -0
  234. package/templates/nextjs/docs/product-specs/ROADMAP.md +59 -0
  235. package/templates/nextjs/docs/product-specs/draft/.gitkeep +0 -0
  236. package/templates/nextjs/docs/product-specs/index.md +18 -0
  237. package/templates/nextjs/docs/product-specs/ready/.gitkeep +0 -0
  238. package/templates/nextjs/eslint.config.mjs +150 -0
  239. package/templates/nextjs/gitignore +35 -0
  240. package/templates/nextjs/lighthouserc.js +37 -0
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: 03-write-plan
3
+ description: /write-plan — Write an Execution Plan
4
+ verified: 2026-06-19
5
+ libraries: []
6
+ source: docs/PLANS.md
7
+ note: Process skill — no library dependencies, no freshness check needed.
8
+ ---
9
+
10
+ # /write-plan — Write an Execution Plan
11
+
12
+ Triggered by: `/write-plan`
13
+
14
+ ---
15
+
16
+ ## Step 1 — Find Ready Spec
17
+
18
+ ```bash
19
+ ls docs/product-specs/ready/
20
+ ```
21
+
22
+ If none → tell human to mark a spec READY first. Stop.
23
+ If multiple → list them and ask which one to plan.
24
+
25
+ > A large spec may span MULTIPLE plans — slice it into shippable milestones, each its own
26
+ > `PLAN-XXX` that ends green (e.g. data model + CRUD; then an external integration; then
27
+ > reporting). Plans are numbered independently, so just create the next plan for the same spec.
28
+
29
+ ## Step 2 — Get Next Plan Number
30
+ ```bash
31
+ ls docs/exec-plans/{active,completed}/ 2>/dev/null | grep "PLAN-" | sort | tail -1
32
+ ```
33
+ Increment by 1. Start at PLAN-001 if none.
34
+
35
+ ## Step 3 — Read the Spec
36
+ Read the full READY spec. Identify:
37
+ - All entities → determine model + migration + repo + service files
38
+ - All endpoints → determine route files
39
+ - Any background jobs → determine worker files
40
+ - State machines → note in service layer
41
+ - Non-functional requirements → note in tests layer
42
+
43
+ ## Step 4 — Write the Plan
44
+
45
+ Save to: `docs/exec-plans/active/PLAN-XXX-{slug}.md`
46
+
47
+ ```markdown
48
+ # PLAN-XXX — {Feature Name}
49
+
50
+ **Status:** IN_PROGRESS
51
+ **Spec:** docs/product-specs/ready/SPEC-XXX-{slug}.md
52
+ **Created:** YYYY-MM-DD
53
+ **Completed:** —
54
+
55
+ ---
56
+
57
+ ## Goal
58
+ {One sentence: what does this plan deliver?}
59
+
60
+ ---
61
+
62
+ ## Layer Build Order
63
+
64
+ | # | Layer | Files | Gate Focuses On |
65
+ |---|---|---|---|
66
+ | 1 | Types | `src/types/{entity}.types.ts`, `common.types.ts` | Zero imports, zero logic |
67
+ | 2 | Config | `src/config/env.ts` update, `constants.ts` | No process.env elsewhere |
68
+ | 3 | Models | `src/models/{Entity}.model.ts` × N | paranoid, UUIDv7, indexes |
69
+ | 4 | Migrations | `db/migrations/YYYYMMDD-create-{table}.js` × N | Runs clean, has down() |
70
+ | 5 | Repo | `src/repo/{entity}.repo.ts` × N | Zod parse, cursor pagination, ownership, no N+1 |
71
+ | 6 | Service | `src/services/{domain}.service.ts` × N | No express imports, ≥90% coverage |
72
+ | 7 | Runtime | `src/runtime/routes/v1/{resource}.route.ts` × N | Auth first, envelope, rate-limit |
73
+ | 8 | Workers | `src/runtime/workers/{name}.worker.ts` × N | Zod payload, retry, observability |
74
+ | 9 | Tests | `tests/unit/`, `tests/integration/` | Coverage gates, load test |
75
+
76
+ *(Remove rows that don't apply to this feature)*
77
+
78
+ ---
79
+
80
+ ## Acceptance Criteria
81
+ {Copy from spec — these become the final gate}
82
+ - [ ] criterion
83
+ - [ ] criterion
84
+
85
+ ---
86
+
87
+ ## Progress Log
88
+
89
+ ### {date} — Plan created
90
+ - Spec {SPEC-XXX} confirmed READY
91
+ - {N} layers planned
92
+
93
+ ---
94
+
95
+ ## Decision Log
96
+
97
+ *(Filled during build)*
98
+
99
+ ---
100
+
101
+ ## Known Constraints
102
+ {Any technical decisions already made or constraints from the spec}
103
+ ```
104
+
105
+ ## Step 5 — Update Spec
106
+ In `docs/product-specs/ready/SPEC-XXX.md`, **APPEND** `PLAN-XXX` to the `**Plan:**` field — do
107
+ not overwrite. A spec split across multiple plans lists them all (e.g. `**Plan:** PLAN-003, PLAN-007`).
108
+ If the field is still `—`, replace it with `PLAN-XXX`.
109
+
110
+ ## Step 6 — Update Index
111
+ In `docs/product-specs/index.md`: update status to `PLANNED`
112
+
113
+ ## Step 7 — Tell the Human
114
+ ```
115
+ Plan written: docs/exec-plans/active/PLAN-XXX-{slug}.md
116
+
117
+ {N} layers planned. Build order:
118
+ 1. Types
119
+ 2. Config
120
+ ...
121
+
122
+ Run /build-layer to start Layer 1.
123
+ Claude will automatically find the next unchecked layer each time.
124
+ ```
@@ -0,0 +1,216 @@
1
+ ---
2
+ name: 04-build-layer
3
+ description: /build-layer — Build Next Layer from Active Plan
4
+ verified: 2026-06-04
5
+ libraries: [express, sequelize, sequelize-typescript, zod, jose, bullmq, pino]
6
+ source: https://www.npmjs.com
7
+ staleness-threshold-days: 60
8
+ ---
9
+
10
+ # /build-layer — Build Next Layer from Active Plan
11
+
12
+ Triggered by: `/build-layer` (no argument — reads active plan automatically)
13
+
14
+ ---
15
+
16
+ ## Step 1 — Find the Active Plan and Next Layer
17
+
18
+ ```bash
19
+ # Find active plan
20
+ PLAN=$(ls docs/exec-plans/active/*.md 2>/dev/null | head -1)
21
+
22
+ if [[ -z "$PLAN" ]]; then
23
+ echo "No active plan found. Run /write-plan first."
24
+ exit 1
25
+ fi
26
+
27
+ echo "Active plan: $PLAN"
28
+ cat "$PLAN"
29
+ ```
30
+
31
+ Parse the **Build Order** table in the plan.
32
+ Find the first row with `[ ]` (unchecked) — this is the layer to build.
33
+ If all rows are `[x]` (checked) → all layers complete, run `/garbage-collect`.
34
+
35
+ ---
36
+
37
+ ## Step 2 — Load Context for This Layer
38
+
39
+ Read these files before writing a single line of code:
40
+ 1. The active plan (already loaded)
41
+ 2. The spec linked in the plan (`docs/product-specs/ready/SPEC-XXX.md`)
42
+ 3. `ARCHITECTURE.md` — layer rules
43
+ 4. The path-scoped rule for this layer type:
44
+ - Types → `.claude/rules/architecture.md`
45
+ - Config → `.claude/rules/architecture.md`
46
+ - Models → `.claude/rules/database.md`
47
+ - Repo → `.claude/rules/database.md` + `.claude/rules/security.md`
48
+ - Service → `.claude/rules/architecture.md` + `.claude/rules/security.md`
49
+ - Runtime → `.claude/rules/api.md` + `.claude/rules/security.md`
50
+ - Workers → `.claude/rules/jobs.md`
51
+ - Tests → `.claude/rules/testing.md`
52
+
53
+ ---
54
+
55
+ ## Step 3 — Build the Layer
56
+
57
+ Write only the files for this layer. Follow the layer rules exactly.
58
+
59
+ ### Layer-specific what-to-build guide:
60
+
61
+ **Types layer** — `src/types/`
62
+ - One file per domain entity: `{entity}.types.ts`
63
+ - Interfaces, enums, Zod schemas, type aliases
64
+ - `common.types.ts` for shared types: `PageCursor`, `PageResult<T>`, `ApiSuccess<T>`, `ApiError`
65
+ - Zero imports. Zero logic.
66
+
67
+ **Config layer** — `src/config/`
68
+ - Update `env.ts` if new env vars needed (add to Zod schema + `.env.example`)
69
+ - `constants.ts` for domain constants (stage arrays, limits, etc.)
70
+
71
+ **Models layer** — `src/models/`
72
+ - One file per entity: `{Entity}.model.ts`
73
+ - Sequelize-typescript decorators
74
+ - `paranoid: true` on every `@Table`
75
+ - `@Default(() => newId())` on every `id` column
76
+ - `indexes` array defined on `@Table` for FK + ORDER BY columns
77
+ - Export all models from `src/models/index.ts`, and register them there with
78
+ `sequelize.addModels([...])` (`import 'reflect-metadata'` first). Config and runtime must not
79
+ import the models layer — `models → config` is the legal registration edge.
80
+
81
+ **Migrations layer** — `db/migrations/`
82
+ - One migration per table: `YYYYMMDDHHMMSS-create-{table}.js`
83
+ - `up`: createTable + addIndex (CONCURRENTLY for new indexes)
84
+ - `down`: dropTable
85
+ - Run: `npx sequelize-cli db:migrate` to verify
86
+
87
+ **Repo layer** — `src/repo/`
88
+ - One file per entity: `{entity}.repo.ts`
89
+ - EVERY method: `Schema.parse(raw.toJSON())` on results
90
+ - List methods: cursor-based pagination (Op.lt on createdAt + id)
91
+ - Ownership: `findOne({ where: { id, userId } })` — never `findByPk(id)` alone
92
+ - Zod schemas for all entity shapes
93
+ - Export from `src/repo/index.ts`
94
+
95
+ **Service layer** — `src/services/`
96
+ - One file per domain: `{domain}.service.ts`
97
+ - Takes domain types as input, returns domain types
98
+ - NO `Request`, `Response`, `express` imports
99
+ - Business logic lives here: state machines, validations, orchestration
100
+ - External calls → via Repo layer
101
+ - Async jobs → enqueue via queue (don't process inline)
102
+ - Wrap multi-table operations in `sequelize.transaction()`
103
+
104
+ **Runtime layer** — `src/runtime/routes/v1/`
105
+ - One file per resource: `{resource}.route.ts`
106
+ - Handler order: auth → validate → service → respond → catch
107
+ - All routes under `/api/v1/`
108
+ - Use `ok()` and `err()` helpers for all responses
109
+ - Rate limiting applied at router level
110
+
111
+ **Workers layer** — `src/runtime/workers/`
112
+ - One file per queue: `{name}.worker.ts`
113
+ - Validate payload with Zod first
114
+ - Log start/complete/failed
115
+ - Re-throw on error (BullMQ handles retry)
116
+ - Register shutdown hook in server.ts
117
+
118
+ **Tests layer** — `tests/`
119
+ - `tests/unit/services/{service}.test.ts` — service layer
120
+ - `tests/unit/utils/{util}.test.ts` — utils
121
+ - `tests/integration/{feature}.test.ts` — route-level
122
+ - `tests/integration/{resource}.isolation.test.ts` — REQUIRED for every owned resource
123
+ (copy `tests/integration/isolation.test.template.ts`); `tests/architecture/isolation.test.ts`
124
+ fails the gate if a userId-scoped repo has no matching isolation test
125
+ - Meet coverage thresholds from `.claude/rules/testing.md`
126
+
127
+ ---
128
+
129
+ ## Step 4 — Run Gate
130
+
131
+ Call the `gate-checker` agent with the layer name.
132
+
133
+ **If FAIL:**
134
+ - Read each ITEM from the gate report
135
+ - Fix it automatically (no asking the human)
136
+ - Log: `[Auto-fix] item description → fix applied`
137
+ - Re-run gate (max 3 attempts)
138
+ - If still failing after 3 attempts → present to human with specific blocker
139
+
140
+ **If PASS:**
141
+ - Tick the checkbox in the plan:
142
+ `- [ ] Layer N: Types` → `- [x] Layer N: Types`
143
+ - Write ADR if any non-obvious decision was made during this layer
144
+
145
+ ---
146
+
147
+ ## Step 5 — Write ADR (if needed)
148
+
149
+ An ADR is needed when you made a decision that a future engineer would question.
150
+ Examples: chose approach A over B, moved responsibility between layers, added a constraint.
151
+
152
+ ```markdown
153
+ # ADR-XXX — [Short Decision Title]
154
+
155
+ **Date:** YYYY-MM-DD
156
+ **Plan:** PLAN-XXX Layer N
157
+ **Status:** ACCEPTED
158
+
159
+ ## Context
160
+ What situation forced this decision?
161
+
162
+ ## Decision
163
+ What was chosen.
164
+
165
+ ## Alternatives Considered
166
+ - Option A: [why not chosen]
167
+ - Option B: [why not chosen]
168
+
169
+ ## Consequences
170
+ What this decision costs / enables.
171
+ ```
172
+
173
+ Save to: `docs/design-docs/decisions/ADR-XXX-{slug}.md`
174
+ Update: `docs/design-docs/decisions/index.md`
175
+
176
+ ---
177
+
178
+ ## Step 6 — Commit and Push
179
+
180
+ ```bash
181
+ git add -A
182
+ git commit -m "{type}({scope}): {description}
183
+
184
+ {bullet points of what was built}
185
+
186
+ PLAN-XXX Layer N/Total"
187
+
188
+ git push origin main
189
+ ```
190
+
191
+ Conventional commit types: `feat`, `fix`, `chore`, `refactor`, `test`, `docs`
192
+ Scope: layer name (types, config, models, repo, service, runtime, worker, tests)
193
+
194
+ ---
195
+
196
+ ## Step 7 — Report to Human
197
+
198
+ ```
199
+ ═══════════════════════════════════════════
200
+ ✅ Layer N ({layer-name}) — COMPLETE
201
+ ═══════════════════════════════════════════
202
+ Files created: [list]
203
+ Gate attempts: 1 (or N with auto-fixes)
204
+ Auto-fixed: [list of fixes if any]
205
+ ADR written: ADR-XXX / None needed
206
+ Committed: [commit hash]
207
+
208
+ Progress: [x] Layer 1 [x] Layer 2 [ ] Layer 3 ...
209
+
210
+ Ready for Layer N+1: {next-layer-name}
211
+ Confirm to continue? [human must respond]
212
+ ═══════════════════════════════════════════
213
+ ```
214
+
215
+ **Wait for human confirmation before building the next layer.**
216
+ Human response of "yes", "y", "continue", "proceed" or similar → start next layer.
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: 05-validate-layer
3
+ description: /validate-layer — Run Gate Check Without Building
4
+ verified: 2026-06-04
5
+ libraries: []
6
+ source: .claude/agents/gate-checker.md
7
+ note: Process skill — delegates to gate-checker agent, no library dependencies.
8
+ ---
9
+
10
+ # /validate-layer — Run Gate Check Without Building
11
+
12
+ Triggered by: `/validate-layer`
13
+ Use ad-hoc to check any layer at any time.
14
+
15
+ ---
16
+
17
+ ## What It Does
18
+ Calls the `gate-checker` agent on the current state of `src/`.
19
+ Does NOT build anything. Does NOT commit anything.
20
+ Useful for: checking state mid-build, verifying after manual edits.
21
+
22
+ ## Steps
23
+
24
+ 1. Determine which layer to check:
25
+ - Read `docs/exec-plans/active/PLAN-XXX.md`
26
+ - Find the most recently checked layer (last `[x]`)
27
+ - Or ask the human: "Which layer do you want to validate?"
28
+
29
+ 2. Call `gate-checker` agent with the layer name
30
+
31
+ 3. Present the full PASS/FAIL report
32
+
33
+ 4. If FAIL: list items but do NOT auto-fix (this is an inspection tool)
34
+ - To auto-fix: run `/build-layer` which includes auto-fix logic
35
+
36
+ ## Output
37
+ ```
38
+ VALIDATION REPORT — Layer: {name}
39
+ {full gate output}
40
+
41
+ This was a read-only validation.
42
+ To auto-fix failures: run /build-layer
43
+ ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: 06-push-layer
3
+ description: /push-layer — Commit and Push Current Layer
4
+ verified: 2026-06-04
5
+ libraries: []
6
+ source: git
7
+ note: Process skill — git operations only, no library dependencies.
8
+ ---
9
+
10
+ # /push-layer — Commit and Push Current Layer
11
+
12
+ Triggered by: `/push-layer`
13
+ Called automatically by /build-layer after gate passes.
14
+ Can be called manually if needed.
15
+
16
+ ---
17
+
18
+ ## Steps
19
+
20
+ 1. Check gate status:
21
+ ```bash
22
+ # Run quick gate check before allowing push
23
+ npx tsc --noEmit && npx eslint src/ --max-warnings=0
24
+ ```
25
+ If either fails → abort and tell human to fix or run `/build-layer`
26
+
27
+ 2. Stage all changes:
28
+ ```bash
29
+ git add -A
30
+ git status # show what's being committed
31
+ ```
32
+
33
+ 3. Determine commit message from active plan:
34
+ - Read plan → find most recently completed layer
35
+ - Format: `{type}({layer}): {description}`
36
+
37
+ 4. Commit:
38
+ ```bash
39
+ git commit -m "{conventional commit message}"
40
+ ```
41
+
42
+ 5. Push:
43
+ ```bash
44
+ git push origin $(git branch --show-current)
45
+ ```
46
+
47
+ 6. Report:
48
+ ```
49
+ Pushed: {commit hash} — {message}
50
+ Branch: {branch name}
51
+ ```
52
+
53
+ ## Conventional Commit Types
54
+ - `feat` — new feature layer (types, service, runtime)
55
+ - `chore` — infrastructure, config, migrations
56
+ - `test` — test layer
57
+ - `refactor` — refactoring existing layer
58
+ - `fix` — fixing a bug in existing layer
59
+ - `docs` — documentation only
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: 07-layer-check
3
+ description: /layer-check — Ad-hoc Architecture Violation Scan
4
+ verified: 2026-06-04
5
+ libraries: []
6
+ source: ARCHITECTURE.md
7
+ note: Process skill — architecture scan, no library dependencies.
8
+ ---
9
+
10
+ # /layer-check — Ad-hoc Architecture Violation Scan
11
+
12
+ Triggered by: `/layer-check`
13
+ Scans the entire codebase for architecture violations right now.
14
+ Does not require an active plan.
15
+
16
+ ---
17
+
18
+ ## Scans
19
+
20
+ ```bash
21
+ echo "=== 1. Circular Imports ==="
22
+ npx madge --circular src/ --extensions ts
23
+
24
+ echo "=== 2. File Size Violations ==="
25
+ find src/ -name "*.ts" | xargs wc -l | awk '$1 > 400 { print "VIOLATION:", $2, $1, "lines" }' | sort -rn
26
+
27
+ echo "=== 3. console.log in src/ ==="
28
+ grep -rn "console\.\(log\|error\|warn\|info\)" src/ \
29
+ --include="*.ts" \
30
+ --exclude-dir="config"
31
+
32
+ echo "=== 4. process.env outside config ==="
33
+ grep -rn "process\.env" src/ --include="*.ts" | grep -v "src/config/env.ts"
34
+
35
+ echo "=== 5. TypeScript compilation ==="
36
+ npx tsc --noEmit 2>&1
37
+
38
+ echo "=== 6. ESLint ==="
39
+ npx eslint src/ --max-warnings=0 2>&1
40
+
41
+ echo "=== 7. Architecture structural tests ==="
42
+ npx jest tests/architecture/ --no-coverage --verbose 2>&1
43
+
44
+ echo "=== 8. Unsafe casts in repo ==="
45
+ grep -rn "return raw as\|as Application\|as User\|as Note" src/repo/ --include="*.ts"
46
+ ```
47
+
48
+ ## Output
49
+ ```
50
+ LAYER CHECK — {timestamp}
51
+
52
+ Circular imports: NONE / {list}
53
+ File size violations: NONE / {list}
54
+ console.log: NONE / {list}
55
+ process.env: NONE / {list}
56
+ TypeScript: CLEAN / {errors}
57
+ ESLint: CLEAN / {errors}
58
+ Arch tests: PASS / FAIL
59
+ Unsafe casts in repo: NONE / {list}
60
+
61
+ OVERALL: ✅ CLEAN / ❌ {N} violations
62
+ ```
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: 08-garbage-collect
3
+ description: /garbage-collect — End-of-Feature Cleanup
4
+ verified: 2026-06-04
5
+ libraries: []
6
+ source: docs/QUALITY_SCORE.md
7
+ note: Process skill — cleanup workflow, no library dependencies.
8
+ ---
9
+
10
+ # /garbage-collect — End-of-Feature Cleanup
11
+
12
+ Triggered by: `/garbage-collect`
13
+ Run after every feature is complete (all plan layers checked off).
14
+
15
+ ---
16
+
17
+ ## Steps (run in order, auto-fix everything)
18
+
19
+ ### 1. File Size
20
+ ```bash
21
+ find src/ -name "*.ts" | xargs wc -l | awk '$1 > 400 { print $2, $1 }' | sort -rn
22
+ ```
23
+ For any file over 400 lines: split it. Update imports everywhere.
24
+
25
+ ### 2. Layer Violations
26
+ ```bash
27
+ npx madge --circular src/ --extensions ts
28
+ npx eslint src/ --max-warnings=0
29
+ ```
30
+ Fix any violations.
31
+
32
+ ### 3. Stale Documentation
33
+ - Read `AGENTS.md` — does it list all current skills and agents?
34
+ - Read `ARCHITECTURE.md` — does it match current source structure?
35
+ - Read `docs/design-docs/decisions/index.md` — are all ADRs listed?
36
+ Update anything stale.
37
+
38
+ ### 4. Update QUALITY_SCORE.md
39
+ ```bash
40
+ npm test -- --coverage --coverageReporters=text 2>&1 | grep -A20 "Coverage summary"
41
+ ```
42
+ Update grade for every domain touched in this feature.
43
+
44
+ ### 5. Log Tech Debt
45
+ Any shortcuts taken → add to `docs/exec-plans/tech-debt-tracker.md`.
46
+
47
+ ### 6. Close the Plan
48
+ - Read active plan
49
+ - Confirm ALL layer checkboxes are `[x]`
50
+ - Confirm ALL acceptance criteria are checked (or note which aren't and why)
51
+ - Set `**Status:** COMPLETE` and `**Completed:** YYYY-MM-DD`
52
+ - Move: `docs/exec-plans/active/PLAN-XXX.md` → `docs/exec-plans/completed/PLAN-XXX.md`
53
+
54
+ ### 7. Mark Spec Shipped
55
+ - In `docs/product-specs/ready/SPEC-XXX.md`: set `**Status:** SHIPPED`
56
+ - In `docs/product-specs/index.md`: update row status
57
+
58
+ ### 8. Final Commit
59
+ ```bash
60
+ git add -A
61
+ git commit -m "chore: garbage collect — close PLAN-XXX
62
+
63
+ - QUALITY_SCORE.md updated: [domain: grade, ...]
64
+ - Tech debt logged: [N] items
65
+ - PLAN-XXX → completed/
66
+ - SPEC-XXX marked SHIPPED"
67
+ git push origin main
68
+ ```
69
+
70
+ ### 9. Report
71
+ ```
72
+ ═══════════════════════════════════════
73
+ GARBAGE COLLECT COMPLETE
74
+ ═══════════════════════════════════════
75
+ Files split: N
76
+ Violations fixed: N
77
+ Stale docs updated: N
78
+ Quality scores:
79
+ {domain}: {grade} ({coverage}%)
80
+ Debt logged: N items (see tech-debt-tracker.md)
81
+ Plan closed: PLAN-XXX
82
+ Spec shipped: SPEC-XXX
83
+
84
+ Next: /write-spec for the next feature
85
+ ═══════════════════════════════════════
86
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: 09-doc-garden
3
+ description: /doc-garden — Scan and Fix Stale Documentation
4
+ verified: 2026-06-04
5
+ libraries: []
6
+ source: AGENTS.md
7
+ note: Process skill — documentation sync, no library dependencies.
8
+ ---
9
+
10
+ # /doc-garden — Scan and Fix Stale Documentation
11
+
12
+ Triggered by: `/doc-garden`
13
+
14
+ ---
15
+
16
+ ## What It Checks
17
+
18
+ ### 1. AGENTS.md
19
+ - Lists all skills that exist in `.claude/skills/`?
20
+ - Lists all agents that exist in `.claude/agents/`?
21
+ - Navigation table matches actual `docs/` structure?
22
+
23
+ ### 2. ARCHITECTURE.md
24
+ - Layer definitions match what's actually in `src/`?
25
+ - Directory structure example is current?
26
+
27
+ ### 3. docs/product-specs/index.md
28
+ - Every spec file in `draft/` and `ready/` has a row?
29
+ - Status column matches actual file status?
30
+
31
+ ### 4. docs/exec-plans/tech-debt-tracker.md
32
+ - RESOLVED items not cluttering the open list?
33
+
34
+ ### 5. docs/design-docs/decisions/index.md
35
+ - Every ADR file in `decisions/` is listed?
36
+
37
+ ### 6. .env.example
38
+ - Every variable in `src/config/env.ts` EnvSchema has a row in `.env.example`?
39
+
40
+ ## Steps
41
+ For each stale item found:
42
+ 1. Update the document to match reality
43
+ 2. Note what was changed
44
+
45
+ ## Report
46
+ ```
47
+ DOC GARDEN COMPLETE — {timestamp}
48
+
49
+ Updated:
50
+ - AGENTS.md: added {skill} to slash commands table
51
+ - docs/product-specs/index.md: synced 2 spec statuses
52
+ - .env.example: added {NEW_VAR} from env.ts
53
+
54
+ No changes needed:
55
+ - ARCHITECTURE.md ✓
56
+ - tech-debt-tracker.md ✓
57
+ ```
58
+
59
+ Commit if anything changed:
60
+ ```bash
61
+ git add docs/ AGENTS.md ARCHITECTURE.md .env.example
62
+ git commit -m "docs: doc garden — sync stale documentation"
63
+ git push origin main
64
+ ```