@kennethsolomon/shipkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +321 -0
  2. package/bin/shipkit.js +146 -0
  3. package/commands/sk/brainstorm.md +63 -0
  4. package/commands/sk/branch.md +35 -0
  5. package/commands/sk/config.md +96 -0
  6. package/commands/sk/execute-plan.md +85 -0
  7. package/commands/sk/features.md +238 -0
  8. package/commands/sk/finish-feature.md +154 -0
  9. package/commands/sk/help.md +103 -0
  10. package/commands/sk/hotfix.md +61 -0
  11. package/commands/sk/plan.md +30 -0
  12. package/commands/sk/release.md +72 -0
  13. package/commands/sk/security-check.md +188 -0
  14. package/commands/sk/set-profile.md +71 -0
  15. package/commands/sk/status.md +25 -0
  16. package/commands/sk/update-task.md +35 -0
  17. package/commands/sk/write-plan.md +72 -0
  18. package/package.json +23 -0
  19. package/skills/sk:accessibility/LICENSE.txt +177 -0
  20. package/skills/sk:accessibility/SKILL.md +150 -0
  21. package/skills/sk:api-design/LICENSE.txt +177 -0
  22. package/skills/sk:api-design/SKILL.md +158 -0
  23. package/skills/sk:brainstorming/SKILL.md +124 -0
  24. package/skills/sk:debug/SKILL.md +252 -0
  25. package/skills/sk:debug/debug_conductor.py +177 -0
  26. package/skills/sk:debug/lib/__init__.py +1 -0
  27. package/skills/sk:debug/lib/bug_gatherer.py +55 -0
  28. package/skills/sk:debug/lib/context_reader.py +139 -0
  29. package/skills/sk:debug/lib/findings_writer.py +76 -0
  30. package/skills/sk:debug/lib/lessons_writer.py +165 -0
  31. package/skills/sk:debug/lib/step_runner.py +326 -0
  32. package/skills/sk:features/SKILL.md +238 -0
  33. package/skills/sk:frontend-design/LICENSE.txt +177 -0
  34. package/skills/sk:frontend-design/SKILL.md +191 -0
  35. package/skills/sk:laravel-init/SKILL.md +37 -0
  36. package/skills/sk:laravel-new/SKILL.md +68 -0
  37. package/skills/sk:lint/SKILL.md +113 -0
  38. package/skills/sk:perf/LICENSE.txt +177 -0
  39. package/skills/sk:perf/SKILL.md +188 -0
  40. package/skills/sk:release/SKILL.md +113 -0
  41. package/skills/sk:release/references/android-checklist.md +269 -0
  42. package/skills/sk:release/references/ios-checklist.md +339 -0
  43. package/skills/sk:release/release.sh +378 -0
  44. package/skills/sk:review/SKILL.md +346 -0
  45. package/skills/sk:review/references/security-checklist.md +223 -0
  46. package/skills/sk:schema-migrate/SKILL.md +125 -0
  47. package/skills/sk:schema-migrate/orms/drizzle.md +546 -0
  48. package/skills/sk:schema-migrate/orms/laravel.md +367 -0
  49. package/skills/sk:schema-migrate/orms/prisma.md +357 -0
  50. package/skills/sk:schema-migrate/orms/rails.md +351 -0
  51. package/skills/sk:schema-migrate/orms/sqlalchemy.md +385 -0
  52. package/skills/sk:schema-migrate/references/detection.md +110 -0
  53. package/skills/sk:setup-claude/SKILL.md +365 -0
  54. package/skills/sk:setup-claude/references/detection.md +6 -0
  55. package/skills/sk:setup-claude/references/templates.md +11 -0
  56. package/skills/sk:setup-claude/scripts/apply_setup_claude.py +443 -0
  57. package/skills/sk:setup-claude/scripts/detect_arch_changes.py +437 -0
  58. package/skills/sk:setup-claude/templates/.claude/docs/arch-changelog-guide.md.template +6 -0
  59. package/skills/sk:setup-claude/templates/.claude/docs/changelog-guide.md.template +12 -0
  60. package/skills/sk:setup-claude/templates/CHANGELOG.md.template +21 -0
  61. package/skills/sk:setup-claude/templates/CLAUDE.md.template +299 -0
  62. package/skills/sk:setup-claude/templates/arch-changelog-guide.md.template +3 -0
  63. package/skills/sk:setup-claude/templates/changelog-guide.md.template +3 -0
  64. package/skills/sk:setup-claude/templates/commands/brainstorm.md.template +74 -0
  65. package/skills/sk:setup-claude/templates/commands/execute-plan.md.template +57 -0
  66. package/skills/sk:setup-claude/templates/commands/features.md.template +238 -0
  67. package/skills/sk:setup-claude/templates/commands/finish-feature.md.template +155 -0
  68. package/skills/sk:setup-claude/templates/commands/plan.md.template +30 -0
  69. package/skills/sk:setup-claude/templates/commands/re-setup.md.template +38 -0
  70. package/skills/sk:setup-claude/templates/commands/release.md.template +74 -0
  71. package/skills/sk:setup-claude/templates/commands/security-check.md.template +172 -0
  72. package/skills/sk:setup-claude/templates/commands/status.md.template +17 -0
  73. package/skills/sk:setup-claude/templates/commands/write-plan.md.template +34 -0
  74. package/skills/sk:setup-claude/templates/finish-feature.md.template +3 -0
  75. package/skills/sk:setup-claude/templates/plan.md.template +3 -0
  76. package/skills/sk:setup-claude/templates/status.md.template +3 -0
  77. package/skills/sk:setup-claude/templates/tasks/findings.md.template +19 -0
  78. package/skills/sk:setup-claude/templates/tasks/lessons.md.template +26 -0
  79. package/skills/sk:setup-claude/templates/tasks/progress.md.template +20 -0
  80. package/skills/sk:setup-claude/templates/tasks/security-findings.md.template +5 -0
  81. package/skills/sk:setup-claude/templates/tasks/todo.md.template +26 -0
  82. package/skills/sk:setup-claude/templates/tasks/workflow-status.md.template +31 -0
  83. package/skills/sk:setup-claude/templates/tasks-findings.md.template +3 -0
  84. package/skills/sk:setup-claude/templates/tasks-lessons.md.template +3 -0
  85. package/skills/sk:setup-claude/templates/tasks-progress.md.template +3 -0
  86. package/skills/sk:setup-claude/templates/tasks-todo.md.template +3 -0
  87. package/skills/sk:setup-claude/tests/test_apply_setup_claude.py +193 -0
  88. package/skills/sk:setup-optimizer/SKILL.md +184 -0
  89. package/skills/sk:setup-optimizer/lib/__init__.py +24 -0
  90. package/skills/sk:setup-optimizer/lib/detect.py +205 -0
  91. package/skills/sk:setup-optimizer/lib/discover.py +221 -0
  92. package/skills/sk:setup-optimizer/lib/enrich.py +163 -0
  93. package/skills/sk:setup-optimizer/lib/merge.py +277 -0
  94. package/skills/sk:setup-optimizer/lib/sidecar.py +129 -0
  95. package/skills/sk:setup-optimizer/optimize_claude.py +174 -0
  96. package/skills/sk:setup-optimizer/templates/CLAUDE.md.template +105 -0
  97. package/skills/sk:skill-creator/LICENSE.txt +202 -0
  98. package/skills/sk:skill-creator/SKILL.md +479 -0
  99. package/skills/sk:skill-creator/agents/analyzer.md +274 -0
  100. package/skills/sk:skill-creator/agents/comparator.md +202 -0
  101. package/skills/sk:skill-creator/agents/grader.md +223 -0
  102. package/skills/sk:skill-creator/assets/eval_review.html +146 -0
  103. package/skills/sk:skill-creator/eval-viewer/generate_review.py +471 -0
  104. package/skills/sk:skill-creator/eval-viewer/viewer.html +1325 -0
  105. package/skills/sk:skill-creator/references/schemas.md +430 -0
  106. package/skills/sk:skill-creator/scripts/aggregate_benchmark.py +401 -0
  107. package/skills/sk:skill-creator/scripts/generate_report.py +326 -0
  108. package/skills/sk:skill-creator/scripts/improve_description.py +248 -0
  109. package/skills/sk:skill-creator/scripts/package_skill.py +136 -0
  110. package/skills/sk:skill-creator/scripts/quick_validate.py +103 -0
  111. package/skills/sk:skill-creator/scripts/run_eval.py +310 -0
  112. package/skills/sk:skill-creator/scripts/run_loop.py +332 -0
  113. package/skills/sk:skill-creator/scripts/utils.py +47 -0
  114. package/skills/sk:smart-commit/SKILL.md +175 -0
  115. package/skills/sk:test/SKILL.md +171 -0
  116. package/skills/sk:write-tests/SKILL.md +195 -0
  117. package/skills/sk:write-tests/references/patterns.md +209 -0
@@ -0,0 +1,299 @@
1
+ <!-- Generated by /setup-claude -->
2
+
3
+ # [PROJECT_NAME]
4
+
5
+ [ONE_SENTENCE_DESCRIPTION]
6
+
7
+ ## Tech Stack
8
+
9
+ | Tech | Details |
10
+ |------|---------|
11
+ | **Language** | [LANGUAGE] |
12
+ | **Framework** | [FRAMEWORK] |
13
+ | **Database** | [DATABASE] |
14
+ | **UI** | [UI] |
15
+ | **Testing** | [TESTING] |
16
+ | **AI/LLM** | [AI] |
17
+ | **Browser Automation** | [BROWSER_AUTOMATION] |
18
+
19
+ ## Key Directories
20
+
21
+ | Path | Purpose |
22
+ |------|---------|
23
+ | `tasks/` | Planning + findings + progress + security logs |
24
+
25
+ ## Build & Run
26
+
27
+ ```bash
28
+ [DEV_COMMAND]
29
+ [BUILD_COMMAND]
30
+ [LINT_COMMAND]
31
+ [TEST_COMMAND]
32
+ ```
33
+
34
+ ## Workflow — Follow This Order
35
+ <!-- LOCK -->
36
+
37
+ **Flow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint → Verify Tests → Security → Performance → Review → Finish
38
+
39
+ Progress is tracked in `tasks/workflow-status.md`. This file persists across conversations.
40
+
41
+ | # | Step | Command | Type | Loop? |
42
+ |---|------|---------|------|-------|
43
+ | 1 | Read Todo | read `tasks/todo.md` | required | no |
44
+ | 2 | Read Lessons | read `tasks/lessons.md` | required | no |
45
+ | 3 | Explore | `/brainstorm` | required | no |
46
+ | 4 | Design | `/frontend-design` or `/api-design` | optional (confirm to skip) | no |
47
+ | 5 | Accessibility | `/accessibility` | optional (confirm to skip) | no |
48
+ | 6 | Plan | `/write-plan` | required | no |
49
+ | 7 | Branch | `/branch` | required | no |
50
+ | 8 | Migrate | `/schema-migrate` | optional (confirm to skip) | no |
51
+ | 9 | Write Tests | `/write-tests` | required | no |
52
+ | 10 | Implement | `/execute-plan` | required | no |
53
+ | 11 | Commit | `/smart-commit` | required | no |
54
+ | 12 | Lint | `/lint` | required | yes — must be clean |
55
+ | 13 | Commit | `/smart-commit` | conditional (skip if lint was clean) | no |
56
+ | 14 | Verify Tests | `/test` | required | yes — 100% coverage required |
57
+ | 15 | Commit | `/smart-commit` | conditional (skip if tests passed clean) | no |
58
+ | 16 | Security | `/security-check` | required | yes — must reach 0 issues |
59
+ | 17 | Commit | `/smart-commit` | conditional (skip if security was clean) | no |
60
+ | 18 | Performance | `/perf` | optional (confirm to skip) | yes — loop until critical/high = 0 |
61
+ | 19 | Commit | `/smart-commit` | conditional (skip if perf was clean) | no |
62
+ | 20 | Review | `/review` | required | yes — must reach 0 issues |
63
+ | 21 | Commit | `/smart-commit` | conditional (skip if review was clean) | no |
64
+ | 22 | Update | `/update-task` | required | no |
65
+ | 23 | Finalize | `/finish-feature` | required | no |
66
+ | 24 | Release | `/release` | optional (confirm to skip) | no |
67
+
68
+ ### Step Details
69
+
70
+ 1. **Read** `tasks/todo.md` — pick the next incomplete task
71
+ 2. **Read** `tasks/lessons.md` — review past corrections before writing code
72
+ 3. **Explore** — run `/brainstorm` to clarify requirements, constraints, and approach. No code in this step.
73
+ 4. **Design** — run `/frontend-design` for UI mockup or `/api-design` for API contracts. No code — design only. Skip if pure backend with no UI and no new API. After `/frontend-design`, the skill prompts to create a Pencil visual mockup (saved to `docs/design/`). Requires Pencil app open and Pencil MCP connected.
74
+ 5. **Accessibility** — run `/accessibility` to audit the design spec for WCAG 2.1 AA compliance. Produces `tasks/accessibility-findings.md`. Skip if backend-only with no frontend.
75
+ 6. **Plan** — run `/write-plan` to write a decision-complete plan into `tasks/todo.md` using brainstorm + design outputs. No code in this step.
76
+ 7. **Branch** — run `/branch` to create a feature branch auto-named from the current task.
77
+ 8. **Migrate** — run `/schema-migrate` for database changes. Skip if no schema changes needed.
78
+ 9. **Write Tests** — run `/write-tests` (TDD red phase). Write failing tests for all planned code. If modifying existing behavior, update existing tests first. Tests SHOULD fail — no implementation yet.
79
+ 10. **Implement** — run `/execute-plan` to execute `tasks/todo.md` checkboxes in small batches, making the failing tests pass (TDD green phase). Log progress to `tasks/progress.md`.
80
+ 11. **Commit** — run `/smart-commit` to commit tests + implementation
81
+ 12. **Lint** — run `/lint` — auto-detects and runs all project linters. Fix all issues immediately, then re-run until clean. Do not ask to re-run — fix and re-run automatically.
82
+ 13. **Commit** — run `/smart-commit` if lint required fixes. Auto-skip if lint was clean.
83
+ 14. **Verify Tests** — run `/test` — auto-detects and runs all project test suites. **100% test coverage required.** Fix failures immediately, then re-run. Do not ask to re-run — fix and re-run automatically.
84
+ 15. **Commit** — run `/smart-commit` if test fixes were needed. Auto-skip if tests passed first try.
85
+ 16. **Security** — run `/security-check`. Must reach 0 issues across all severities. Fix issues immediately, commit, then re-run. Loop until clean.
86
+ 17. **Commit** — run `/smart-commit` if security required fixes. Auto-skip if clean.
87
+ 18. **Performance** — run `/perf` to audit for performance issues. Produces `tasks/perf-findings.md`. Fix critical/high findings, commit, then re-run. Loop until critical/high = 0. Skip if confirmed with user.
88
+ 19. **Commit** — run `/smart-commit` if perf required fixes. Auto-skip if clean.
89
+ 20. **Review** — run `/review`. Must reach 0 issues including nitpicks. Fix issues immediately, commit, then re-run. Loop until clean.
90
+ 21. **Commit** — run `/smart-commit` if review required fixes. Auto-skip if clean.
91
+ 22. **Update** — run `/update-task` to mark the task done in `tasks/todo.md` and log completion to `tasks/progress.md`.
92
+ 23. **Finalize** — run `/finish-feature` for changelog + PR
93
+ 24. **Release** — run `/release` if deploying. Skip if not ready.
94
+
95
+ ### Workflow Tracker Rules
96
+
97
+ **These rules are mandatory for every step:**
98
+
99
+ 1. **Read tracker first.** At the start of every step, read `tasks/workflow-status.md` to verify the current step. If the step being run does not match the `>> next <<` step, STOP and ask the user to confirm skipping the intervening steps.
100
+
101
+ 2. **Update tracker after.** At the end of every step, update `tasks/workflow-status.md`:
102
+ - Set the current step's Status to `done`, `skipped`, or `partial`
103
+ - Add relevant Notes (e.g., "clean on attempt 2", "backend-only, no UI")
104
+ - Move `>> next <<` to the next pending step
105
+
106
+ 3. **Optional steps** (4, 5, 7, 18, 24): Ask the user "Skip [step]?" and require explicit confirmation. Record the reason in Notes.
107
+
108
+ 4. **Conditional commits** (13, 15, 17, 19, 21): Auto-skip if no changes were made. Record reason (e.g., "lint was clean", "tests passed first try").
109
+
110
+ 5. **Loop steps are HARD GATES** (12, 14, 16, 20): These steps BLOCK all forward progress until they pass clean. Fix issues immediately and re-run. Do NOT ask the user to re-run — fix and re-run automatically. Track attempt number in Notes (e.g., "clean on attempt 3").
111
+ - **Step 12 (Lint)**: All detected linting tools must pass — every single one.
112
+ - **Step 14 (Verify Tests)**: All detected test suites (BE + FE) must pass with 100% coverage on new code.
113
+ - **Step 16 (Security)**: 0 issues across all severities.
114
+ - **Step 20 (Review)**: 0 issues including nitpicks.
115
+ - **Step 18 (Performance)**: Optional gate — if run, loop until critical/high findings = 0. Can be skipped with explicit confirmation.
116
+ - **DO NOT mark these steps as `done` until every check passes.** If even one tool fails, the step is NOT done. Never proceed to the next step with errors remaining.
117
+
118
+ 6. **Never skip steps without confirmation.** Steps cannot run out of order. Hard gate steps (12, 14, 16, 20) can NEVER be skipped. Optional gate step (18) requires explicit confirmation to skip.
119
+
120
+ 7. **Never auto-advance.** When one step completes, stop and tell the user which step is next. Do not proceed automatically.
121
+
122
+ 8. **Never write code during design or plan phases.** Steps 1-6 are reading/exploring/planning/design only — no code, no file edits (except `tasks/` files).
123
+
124
+ 9. **Step completion summary is NON-NEGOTIABLE.** After finishing ANY step, you MUST output a summary block in this exact format before stopping:
125
+
126
+ ```
127
+ --- Step [#] [Name]: [done/skipped/partial] ---
128
+ Summary: [1-2 sentence summary of what was done]
129
+ Next step: [#] [Name] — run `[command]`
130
+ ```
131
+
132
+ This tells the user exactly what happened and what to do next. Never finish a step silently.
133
+
134
+ ### Tracker Reset
135
+
136
+ - When starting a new task, check if `tasks/workflow-status.md` has any `done` or `skipped` steps. If yes, ask: "Existing workflow detected. Start fresh and reset tracker?"
137
+ - Reset sets all steps to `not yet` and marks step 1 as `>> next <<`.
138
+
139
+ ### Bug Fix Flow
140
+
141
+ When fixing a bug (not building a feature), use `/debug` as the entry point. This sets up a shorter workflow:
142
+
143
+ | # | Step | Command |
144
+ |---|------|---------|
145
+ | 1 | Debug | `/debug` |
146
+ | 2 | Branch | `/branch` |
147
+ | 3 | Write Tests | `/write-tests` (regression test) |
148
+ | 4 | Fix | implement the fix |
149
+ | 5 | Commit | `/smart-commit` |
150
+ | 6 | Lint | `/lint` |
151
+ | 7 | Commit | `/smart-commit` (skip if clean) |
152
+ | 8 | Verify Tests | `/test` |
153
+ | 9 | Commit | `/smart-commit` (skip if clean) |
154
+ | 10 | Security | `/security-check` |
155
+ | 11 | Commit | `/smart-commit` (skip if clean) |
156
+ | 12 | Review | `/review` |
157
+ | 13 | Commit | `/smart-commit` (skip if clean) |
158
+ | 14 | Update | `/update-task` |
159
+ | 15 | Finalize | `/finish-feature` |
160
+
161
+ Start with `/debug` to investigate, then follow the abbreviated flow.
162
+
163
+ ### Hotfix Flow
164
+
165
+ For production emergencies that need to ship immediately, use `/hotfix`. Skips brainstorm, design, and write-tests. Quality gates still apply.
166
+
167
+ | # | Step | Command |
168
+ |---|------|---------|
169
+ | 1 | Investigate | `/debug` |
170
+ | 2 | Branch | `/branch` |
171
+ | 3 | Fix | implement directly |
172
+ | 4 | Smoke Test | run existing tests |
173
+ | 5 | Commit | `/smart-commit` |
174
+ | 6 | Lint | `/lint` |
175
+ | 7 | Commit | `/smart-commit` (skip if clean) |
176
+ | 8 | Verify Tests | `/test` |
177
+ | 9 | Commit | `/smart-commit` (skip if clean) |
178
+ | 10 | Security | `/security-check` |
179
+ | 11 | Commit | `/smart-commit` (skip if clean) |
180
+ | 12 | Review | `/review` |
181
+ | 13 | Commit | `/smart-commit` (skip if clean) |
182
+ | 14 | Update | `/update-task` |
183
+ | 15 | Finalize | `/finish-feature` |
184
+
185
+ After merging: add a regression test and a lessons.md entry.
186
+
187
+ ## Sub-Agent Patterns
188
+ <!-- BEGIN:sub-agent-patterns -->
189
+
190
+ Use Claude Code sub-agents to parallelize independent work and speed up development.
191
+
192
+ ### Codebase Exploration (before implementation)
193
+
194
+ Before implementing a feature, launch parallel Explore agents to understand the affected areas:
195
+
196
+ ```
197
+ Use Agent tool with subagent_type="Explore" — launch all in a single message:
198
+ - Agent 1: Explore related models, migrations, and relationships
199
+ - Agent 2: Explore existing routes, controllers, and middleware
200
+ - Agent 3: Explore test patterns and existing test coverage for the area
201
+ ```
202
+
203
+ This replaces sequential file reading and gives a complete picture before writing code.
204
+
205
+ ### Parallel Quality Checks (/lint)
206
+
207
+ After formatters run, launch analyzers in parallel (both are read-only):
208
+
209
+ ```
210
+ 1. Formatters (sequential — modify files)
211
+ 2. Then in parallel:
212
+ - Agent 1: Static analysis
213
+ - Agent 2: Code quality checks
214
+ ```
215
+
216
+ ### Code Review Parallelization
217
+
218
+ For `/review` and `/security-check`, split into parallel agents for faster feedback:
219
+
220
+ ```
221
+ Launch in a single message:
222
+ - Agent 1: Security review — OWASP, injection, auth bypass
223
+ - Agent 2: Performance review — N+1 queries, missing indexes, cache misses
224
+ - Agent 3: Test coverage gaps — untested paths, missing edge cases
225
+ ```
226
+
227
+ ### Worktree Isolation for Risky Changes
228
+
229
+ For refactors or experimental approaches, use `isolation: "worktree"` to try the change on an isolated copy:
230
+
231
+ ```
232
+ Agent tool with isolation: "worktree":
233
+ - Try the refactor in isolation
234
+ - If it works, apply the same changes to the main worktree
235
+ - If it fails, the worktree is discarded — no cleanup needed
236
+ ```
237
+
238
+ ### Background Agents for Long-Running Tasks
239
+
240
+ Use `run_in_background: true` for tasks that don't block your next step:
241
+
242
+ ```
243
+ - Background agent: Run full test suite while you continue implementing
244
+ - Background agent: Static analysis while you fix other suggestions
245
+ - You'll be notified when they complete
246
+ ```
247
+ <!-- END:sub-agent-patterns -->
248
+
249
+ ## Project Memory
250
+
251
+ Read these files at the start of every task:
252
+ - `tasks/findings.md` — key decisions and project constraints
253
+ - `tasks/lessons.md` — past mistakes and how to avoid them
254
+ - `tasks/todo.md` — current plan
255
+
256
+ Write to these files continuously:
257
+ - `tasks/progress.md` — every attempt, error, and resolution
258
+ - `tasks/findings.md` — anything important discovered mid-task
259
+
260
+ **Never overwrite** `tasks/lessons.md` or `tasks/security-findings.md`.
261
+
262
+ ## Lessons Capture
263
+
264
+ When the user corrects you:
265
+ - Explicit: `lesson:`, `remember:`, `don't do this again:` → append to `tasks/lessons.md` immediately
266
+ - Implicit: detect "no", "don't", "instead", "wrong" → ask "Should I add this to lessons.md?" → append on confirmation
267
+
268
+ Entry format:
269
+ ```
270
+ ### [YYYY-MM-DD] [Brief title]
271
+ **Mistake:** What went wrong
272
+ **Root cause:** Why it happened
273
+ **Prevention:** What to do differently
274
+ ```
275
+
276
+ ## Testing — TDD, 100% Coverage Required
277
+
278
+ Tests are written **before** implementation (step 9) and verified **after** (step 14).
279
+
280
+ ### TDD Flow
281
+
282
+ 1. `/write-tests` — write failing tests based on the plan (RED)
283
+ 2. `/execute-plan` — implement code to make tests pass (GREEN)
284
+ 3. `/test` — verify all tests pass with 100% coverage (VERIFY)
285
+
286
+ Every new function, endpoint, component, and module needs tests. No code proceeds past step 13 without 100% coverage on new code.
287
+
288
+ ## 3-Strike Protocol
289
+
290
+ When blocked:
291
+ 1. Log attempt + error to `tasks/progress.md`
292
+ 2. Try a different approach
293
+ 3. On 3rd failure — stop and ask the user what was tried
294
+
295
+ Never retry the same failing approach.
296
+
297
+ ## Architectural Change Log
298
+
299
+ Create entries in: `[ARCH_CHANGELOG_DIR]`
@@ -0,0 +1,3 @@
1
+ <!-- Deprecated template path. -->
2
+ <!-- Source of truth: templates/.claude/docs/arch-changelog-guide.md.template -->
3
+
@@ -0,0 +1,3 @@
1
+ <!-- Deprecated template path. -->
2
+ <!-- Source of truth: templates/.claude/docs/changelog-guide.md.template -->
3
+
@@ -0,0 +1,74 @@
1
+ ---
2
+ description: "Start with design questions before writing code."
3
+ ---
4
+
5
+ <!-- Generated by /setup-claude -->
6
+
7
+ # /brainstorm
8
+
9
+ **Workflow:** Read → **Explore** → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint → Verify Tests → Security → Performance → Review → Finalize → Release
10
+
11
+ Explore design and clarify requirements **before** any code is written.
12
+
13
+ ## Hard Rules
14
+
15
+ - **DO NOT write, edit, or generate any code.** No files, no snippets, no pseudo-implementations.
16
+ - **DO NOT create a plan.** That is `/write-plan`'s job.
17
+ - **DO NOT run build/test/lint commands.** You are in design mode only.
18
+ - You may **read** existing code to understand the current state, but nothing more.
19
+
20
+ ## Steps
21
+
22
+ 0. **Check workflow tracker:**
23
+ - Read `tasks/workflow-status.md`. If it doesn't exist, create it using the standard
24
+ 14-step template (all steps `not yet`, step 1 `>> next <<`).
25
+ - If any steps show `done`, `skipped`, or `partial`: ask the user —
26
+ "Existing workflow detected. Start fresh and reset tracker?" Wait for confirmation.
27
+ - If yes: reset all steps to `not yet`, mark step 1 as `>> next <<`, and clear all Notes
28
+ (except the default labels: optional, conditional, loop).
29
+ - If no: continue from current state (the user is resuming a prior workflow).
30
+
31
+ 1. **Read context files first:**
32
+ - If `tasks/findings.md` exists and has content, read it — summarize prior decisions
33
+ and ask: extend, revise, or start fresh?
34
+ - If `tasks/lessons.md` exists, read it in full. Apply every active lesson as a design
35
+ constraint throughout this brainstorm — treat each prevention rule as a hard constraint
36
+ when proposing approaches.
37
+ - If `tasks/security-findings.md` exists and has audit results, skim for recurring
38
+ patterns — factor security constraints into proposed approaches (e.g., if prior audits
39
+ flagged missing input validation, ensure new designs account for it).
40
+
41
+ 2. **Understand the request** — Ask clarifying questions about what the user wants. Do not assume. Cover:
42
+ - What problem are we solving?
43
+ - Who is it for?
44
+ - What are the expected inputs/outputs or behaviors?
45
+ - Are there constraints (performance, compatibility, existing patterns)?
46
+
47
+ 3. **Explore the current codebase** (read-only) — Identify:
48
+ - Relevant files, modules, and patterns already in place
49
+ - How similar features are implemented today
50
+ - Potential impact areas and dependencies
51
+
52
+ 4. **Propose approaches** — Present 2–3 design options with trade-offs:
53
+ - Approach name + 1-sentence summary
54
+ - Pros and cons
55
+ - Complexity estimate (small / medium / large)
56
+ - Which existing patterns it follows or breaks
57
+
58
+ 5. **Get alignment** — Ask the user which approach they prefer (or if they want a hybrid). Do not proceed without explicit approval on the direction.
59
+
60
+ 6. **Record findings** — Write discoveries and the agreed-upon direction to `tasks/findings.md`:
61
+ - Problem statement
62
+ - Key decisions made
63
+ - Chosen approach + rationale
64
+ - Open questions (if any remain)
65
+
66
+ ## When Done
67
+
68
+ 1. Update `tasks/workflow-status.md`: set step 1 (`/brainstorm`) to `done`, move `>> next <<` to the next pending step.
69
+ 2. Print the full workflow status dashboard table.
70
+ 3. Tell the user:
71
+ > "Brainstorming complete. Findings saved to `tasks/findings.md`."
72
+ 4. If step 2 (`/frontend-design`) is next, ask: "Step 2 is `/frontend-design` (optional). Run it or skip?"
73
+
74
+ **Do not proceed to planning or implementation yourself.** The user must explicitly invoke the next step.
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: "Execute tasks/todo.md checkboxes in small batches; log to tasks/progress.md."
3
+ ---
4
+
5
+ <!-- Generated by /setup-claude -->
6
+
7
+ # /execute-plan
8
+
9
+ **Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → **Implement** → Lint → Verify Tests → Security → Performance → Review → Finalize → Release
10
+
11
+ Execute the plan in `tasks/todo.md` in small batches with clear checkpoints.
12
+
13
+ ## Before You Start
14
+
15
+ 1. If `tasks/lessons.md` exists, read it in full. Treat every active lesson as a
16
+ standing constraint for this entire session. Apply each prevention rule before
17
+ executing the first batch.
18
+
19
+ 2. If `tasks/progress.md` exists and has Error Log entries, read the last 20 lines.
20
+ Do NOT repeat any action already recorded as a failed attempt — change approach.
21
+
22
+ ## Steps
23
+
24
+ 1. Read `tasks/todo.md` and identify the next unchecked items.
25
+ 2. Execute the next **batch of 3 items** (default). For each item:
26
+ - Mark it in progress (in your narrative)
27
+ - Make the smallest change that satisfies the step
28
+ - Run the verification specified (or add it if missing)
29
+ - Log what you did in `tasks/progress.md` (files touched + commands run + results)
30
+ - If you learned something important, append it to `tasks/findings.md`
31
+ 3. After the batch, report:
32
+ - what changed
33
+ - verification results
34
+ - what's next
35
+ - After all items in this batch pass verification, the code is ready to stage.
36
+ Run `/commit` after any passed batch, or accumulate and commit at plan completion.
37
+ Never combine more than one logical unit of work in a single commit.
38
+ 4. Stop and wait for user feedback before continuing.
39
+
40
+ ## Failure handling
41
+ - Log every failure (error + attempt # + fix) in `tasks/progress.md`.
42
+ - Do not repeat the same failing action; change approach.
43
+ - After 3 failed attempts, stop and ask the user with details.
44
+
45
+ ## On User Correction
46
+
47
+ If the user corrects your approach during execution, immediately append to
48
+ `tasks/lessons.md`:
49
+
50
+ ```
51
+ ### [YYYY-MM-DD] [Brief title]
52
+ **Bug:** What you did wrong
53
+ **Root cause:** Why the approach was wrong
54
+ **Prevention:** What to do instead next time
55
+ ```
56
+
57
+ Then continue with the corrected approach.
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: features
3
+ description: "Sync docs/features/ specs with the current codebase. Auto-detects changed areas and updates only affected specs. Creates the spec system from scratch if it doesn't exist."
4
+ ---
5
+
6
+ <!-- Generated by /setup-claude -->
7
+
8
+ # /features
9
+
10
+ Keep feature specifications in `docs/features/` in sync with the actual codebase.
11
+ Works with **any project** — framework-agnostic, auto-discovers source structure.
12
+
13
+ ## What This Does
14
+
15
+ Maintains `docs/features/` as a platform-agnostic feature specification system —
16
+ the single source of truth shared between web, mobile, and any other platform
17
+ that uses the same backend. Each spec covers: DB schema, business logic, API
18
+ contract, permissions, edge cases, error states, web/mobile UI behavior, and
19
+ platform divergences.
20
+
21
+ ---
22
+
23
+ ## Steps
24
+
25
+ ### Step 1: Detect Project State
26
+
27
+ Check what exists:
28
+
29
+ ```bash
30
+ ls docs/features/ 2>/dev/null && echo "EXISTS" || echo "MISSING"
31
+ ls docs/FEATURES.md 2>/dev/null && echo "INDEX_EXISTS" || echo "INDEX_MISSING"
32
+ ```
33
+
34
+ **If `docs/features/` does not exist:**
35
+ Ask the user: "No feature specification system found. Create one from scratch?"
36
+ - Yes → jump to **[Create From Scratch](#create-from-scratch)** below
37
+ - No → stop
38
+
39
+ **If `docs/features/` exists:**
40
+ Continue to Step 2.
41
+
42
+ ---
43
+
44
+ ### Step 2: Determine Update Scope
45
+
46
+ Present three options:
47
+
48
+ > **What would you like to update?**
49
+ > **A. Auto-detect** *(recommended)* — scan recent git changes, update only affected specs
50
+ > **B. Select features** — pick which specs to update from the list
51
+ > **C. Refresh all** — update every spec from current source code
52
+
53
+ Wait for the user's choice.
54
+
55
+ ---
56
+
57
+ ### Step 3A: Auto-detect Changed Features
58
+
59
+ ```bash
60
+ git log --since="7 days ago" --name-only --pretty=format: | grep -v '^$' | sort -u
61
+ ```
62
+
63
+ Map changed file paths to feature specs using these rules:
64
+
65
+ 1. **Read `docs/FEATURES.md`** to get the list of all spec files and their names.
66
+ 2. For each changed file, determine which spec it belongs to:
67
+ - Match by **feature name similarity**: if the spec is `expenses.md`, look for changed files containing `expense` in their path.
68
+ - Match by **directory**: if the spec is `budgets.md`, match files under any `budgets/` or `budget/` directory.
69
+ - Match by **schema files**: if any migration file, `schema.sql`, `schema.prisma`, `database.ts`, or similar schema file changed → mark ALL specs as potentially affected (schema changes ripple everywhere).
70
+ 3. Deduplicate the affected spec list.
71
+ 4. Report which specs will be updated and ask for confirmation.
72
+
73
+ ---
74
+
75
+ ### Step 3B: User Selects Features
76
+
77
+ List all `.md` files in `docs/features/` (excluding `_template.md`).
78
+ Let the user pick which ones to update.
79
+
80
+ ---
81
+
82
+ ### Step 3C: Refresh All
83
+
84
+ Set update list = all `.md` files in `docs/features/` (excluding `_template.md`).
85
+
86
+ ---
87
+
88
+ ### Step 4: Update Each Affected Spec
89
+
90
+ For each spec file to update, follow this sequence:
91
+
92
+ #### 4a. Read the existing spec
93
+ Understand its current content and section structure.
94
+
95
+ #### 4b. Discover relevant source files
96
+
97
+ Use a three-step lookup — no hardcoded paths:
98
+
99
+ 1. **Name-based search**: the feature name from the spec filename (e.g., `expenses.md` → feature name `expenses`). Search the repo:
100
+ ```bash
101
+ # Find files whose name contains the feature keyword
102
+ find . -type f \( -name "*expense*" -o -name "*expenses*" \) \
103
+ ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/docs/*" \
104
+ 2>/dev/null | head -30
105
+ ```
106
+ Adjust the keyword to match the feature name.
107
+
108
+ 2. **Related Docs in spec**: read the `## Related Docs` section of the existing spec — it lists previously referenced files. Read those files too.
109
+
110
+ 3. **DB schema hint**: read the `## Database Schema` section — it names tables. Search migrations and schema files for those table names.
111
+
112
+ #### 4c. Read the source files
113
+ Read all discovered source files to understand the current implementation.
114
+
115
+ #### 4d. Identify what changed
116
+ Compare the current source code against what the spec describes:
117
+ - New or removed DB columns / tables / constraints
118
+ - Changed business logic rules or state transitions
119
+ - New/changed API payloads or query patterns
120
+ - Updated permission keys or tier requirements
121
+ - New edge cases, error codes, or recovery paths
122
+
123
+ #### 4e. Update only changed sections
124
+ Rewrite only the sections that are out of date. **Preserve all unchanged sections verbatim.**
125
+ Update the `> Status` block if the implementation status on either platform changed.
126
+
127
+ ---
128
+
129
+ ### Step 5: Handle New Features
130
+
131
+ If source code has a clear new feature (new hook, new route group, new major component) with no corresponding spec:
132
+
133
+ 1. Create `docs/features/<feature-name>.md` using `docs/features/_template.md` as base.
134
+ If `_template.md` doesn't exist, use this 11-section structure:
135
+ ```
136
+ Status → Overview → Database Schema → Business Logic → API Contract
137
+ → Permissions & Access Control → Edge Cases → Error States
138
+ → UI/UX Behavior (### Web + ### Mobile) → Platform Notes → Related Docs
139
+ ```
140
+ 2. Fill all 11 sections from current source code.
141
+ 3. Add the new spec to `docs/FEATURES.md` under the appropriate section.
142
+
143
+ ---
144
+
145
+ ### Step 6: Update Master Index
146
+
147
+ Review `docs/FEATURES.md`:
148
+ - Add links for any new specs
149
+ - Update status columns (Web / Mobile) if implementation status changed
150
+ - Update any tier/feature tables if permissions changed
151
+
152
+ ---
153
+
154
+ ### Step 7: Report and Commit
155
+
156
+ Show a summary:
157
+ - ✅ **Updated**: `spec-name.md` — what changed (1 sentence each)
158
+ - ➕ **Added**: any new spec files
159
+ - ⏭️ **Skipped**: specs with no detected changes
160
+
161
+ Ask: **"Commit the updated specs?"**
162
+ - Yes → stage only files under `docs/` and commit:
163
+ `docs(features): update feature specs to reflect current implementation`
164
+ - No → leave changes unstaged for the user to review
165
+
166
+ ---
167
+
168
+ ## Create From Scratch
169
+
170
+ When `docs/features/` doesn't exist, discover and document all features:
171
+
172
+ ### Discovery Phase
173
+
174
+ 1. **Detect source structure** — find where feature logic lives:
175
+ ```bash
176
+ # Look for hooks, services, controllers, models, routes
177
+ ls src/ lib/ app/ 2>/dev/null
178
+ find . -maxdepth 4 -type f \
179
+ \( -name "use-*.ts" -o -name "use-*.js" \
180
+ -o -name "*.service.ts" -o -name "*.controller.ts" \
181
+ -o -name "*.model.ts" -o -name "*.router.ts" \) \
182
+ ! -path "*/node_modules/*" ! -path "*/.git/*" 2>/dev/null | head -50
183
+ ```
184
+
185
+ 2. **Detect schema files** — migrations, ORM schemas:
186
+ ```bash
187
+ find . -maxdepth 5 \
188
+ \( -name "schema.sql" -o -name "*.schema.prisma" \
189
+ -o -name "database.ts" -o -name "*.migration.*" \) \
190
+ ! -path "*/node_modules/*" ! -path "*/.git/*" 2>/dev/null
191
+ ls supabase/migrations/ 2>/dev/null | tail -10
192
+ ls prisma/ 2>/dev/null
193
+ ```
194
+
195
+ 3. **Identify feature domains** from the discovered files — group related files into named features.
196
+
197
+ 4. **Report discovered features** and ask the user to confirm/adjust the list before creating anything.
198
+
199
+ ### Creation Phase
200
+
201
+ For each confirmed feature:
202
+ 1. Read all relevant source files.
203
+ 2. Create `docs/features/<feature-name>.md` with all 11 sections — based entirely on source code.
204
+
205
+ Also create:
206
+ - `docs/FEATURES.md` — master index with:
207
+ - How-to-use section (web path + mobile path via `../project-name/docs/`)
208
+ - Feature table grouped by domain
209
+ - Tier/subscription overview (if the project has tiers)
210
+ - `docs/features/_template.md` — 11-section template for future specs
211
+
212
+ Commit: `docs: add feature specification system`
213
+
214
+ ---
215
+
216
+ ## Quality Rules (Always Apply)
217
+
218
+ - **Source-verified only** — every claim must be findable in source code; never invent behavior
219
+ - **No placeholders** — no `// TODO`, no `false // will be computed`, no assumed values
220
+ - **Surgical updates** — only rewrite what changed; preserve unchanged sections verbatim
221
+ - **Numeric JSX coercion** — when documenting frontend behavior, note `!!value` (not `value &&`) for numerics to avoid rendering `0` as text in React/React Native
222
+ - **Local date, not UTC** — for any time-bounded query (current month, today, etc.), document that implementations must use local `new Date()`, not `toISOString()` which returns UTC and causes off-by-one for users in non-UTC timezones
223
+ - **All 11 sections required** — mark "N/A" only if genuinely not applicable
224
+
225
+ ## Source Discovery Heuristics (Reference)
226
+
227
+ When locating source files for a feature named `<name>`:
228
+
229
+ | What to look for | Search pattern |
230
+ |---|---|
231
+ | Hooks / composables | `use-<name>.*`, `use<Name>.*` |
232
+ | Components | directories or files matching `<name>/`, `*<name>*` |
233
+ | API routes / controllers | `<name>.route.*`, `<name>.controller.*`, `api/<name>/` |
234
+ | Services / repositories | `<name>.service.*`, `<name>.repo.*` |
235
+ | DB schema | `migrations/` containing table name, `schema.prisma`, `database.ts` |
236
+ | Tests | `<name>.test.*`, `<name>.spec.*` |
237
+
238
+ These are starting points — read broadly and verify before updating any section.