@c0x12c/ai-toolkit 1.15.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 (255) hide show
  1. package/.claude-plugin/marketplace.json +16 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/README.md +439 -0
  4. package/VERSION +1 -0
  5. package/agents/design-critic.md +127 -0
  6. package/agents/idea-killer.md +72 -0
  7. package/agents/infrastructure-expert.md +49 -0
  8. package/agents/micronaut-backend-expert.md +45 -0
  9. package/agents/phase-reviewer.md +150 -0
  10. package/agents/research-planner.md +70 -0
  11. package/agents/solution-architect-cto.md +49 -0
  12. package/agents/sre-architect.md +49 -0
  13. package/agents/team-coordinator.md +111 -0
  14. package/bin/cli.js +780 -0
  15. package/claude-md/00-header.md +39 -0
  16. package/claude-md/01-core.md +105 -0
  17. package/claude-md/05-database.md +20 -0
  18. package/claude-md/11-backend-micronaut.md +19 -0
  19. package/claude-md/20-frontend-react.md +44 -0
  20. package/claude-md/25-ux-design.md +56 -0
  21. package/claude-md/30-infrastructure.md +24 -0
  22. package/claude-md/30-project-mgmt.md +119 -0
  23. package/claude-md/40-product.md +39 -0
  24. package/claude-md/50-ops.md +34 -0
  25. package/claude-md/60-research.md +27 -0
  26. package/claude-md/90-footer.md +21 -0
  27. package/commands/spartan/brainstorm.md +134 -0
  28. package/commands/spartan/brownfield.md +157 -0
  29. package/commands/spartan/build.md +435 -0
  30. package/commands/spartan/careful.md +94 -0
  31. package/commands/spartan/commit-message.md +112 -0
  32. package/commands/spartan/content.md +17 -0
  33. package/commands/spartan/context-save.md +161 -0
  34. package/commands/spartan/contribute.md +140 -0
  35. package/commands/spartan/daily.md +42 -0
  36. package/commands/spartan/debug.md +308 -0
  37. package/commands/spartan/deep-dive.md +55 -0
  38. package/commands/spartan/deploy.md +207 -0
  39. package/commands/spartan/e2e.md +264 -0
  40. package/commands/spartan/env-setup.md +166 -0
  41. package/commands/spartan/epic.md +199 -0
  42. package/commands/spartan/fe-review.md +181 -0
  43. package/commands/spartan/figma-to-code.md +260 -0
  44. package/commands/spartan/forensics.md +46 -0
  45. package/commands/spartan/freeze.md +84 -0
  46. package/commands/spartan/fundraise.md +53 -0
  47. package/commands/spartan/gate-review.md +229 -0
  48. package/commands/spartan/gsd-upgrade.md +376 -0
  49. package/commands/spartan/guard.md +42 -0
  50. package/commands/spartan/init-project.md +178 -0
  51. package/commands/spartan/init-rules.md +298 -0
  52. package/commands/spartan/interview.md +154 -0
  53. package/commands/spartan/kickoff.md +73 -0
  54. package/commands/spartan/kotlin-service.md +109 -0
  55. package/commands/spartan/lean-canvas.md +222 -0
  56. package/commands/spartan/lint-rules.md +122 -0
  57. package/commands/spartan/map-codebase.md +124 -0
  58. package/commands/spartan/migration.md +82 -0
  59. package/commands/spartan/next-app.md +317 -0
  60. package/commands/spartan/next-feature.md +212 -0
  61. package/commands/spartan/onboard.md +326 -0
  62. package/commands/spartan/outreach.md +16 -0
  63. package/commands/spartan/phase.md +142 -0
  64. package/commands/spartan/pitch.md +18 -0
  65. package/commands/spartan/plan.md +210 -0
  66. package/commands/spartan/pr-ready.md +202 -0
  67. package/commands/spartan/project.md +106 -0
  68. package/commands/spartan/qa.md +222 -0
  69. package/commands/spartan/research.md +254 -0
  70. package/commands/spartan/review.md +132 -0
  71. package/commands/spartan/scan-rules.md +173 -0
  72. package/commands/spartan/sessions.md +143 -0
  73. package/commands/spartan/spec.md +131 -0
  74. package/commands/spartan/startup.md +257 -0
  75. package/commands/spartan/team.md +570 -0
  76. package/commands/spartan/teardown.md +161 -0
  77. package/commands/spartan/testcontainer.md +97 -0
  78. package/commands/spartan/tf-cost.md +123 -0
  79. package/commands/spartan/tf-deploy.md +116 -0
  80. package/commands/spartan/tf-drift.md +100 -0
  81. package/commands/spartan/tf-import.md +107 -0
  82. package/commands/spartan/tf-module.md +121 -0
  83. package/commands/spartan/tf-plan.md +100 -0
  84. package/commands/spartan/tf-review.md +106 -0
  85. package/commands/spartan/tf-scaffold.md +109 -0
  86. package/commands/spartan/tf-security.md +147 -0
  87. package/commands/spartan/think.md +221 -0
  88. package/commands/spartan/unfreeze.md +13 -0
  89. package/commands/spartan/update.md +134 -0
  90. package/commands/spartan/ux.md +1233 -0
  91. package/commands/spartan/validate.md +193 -0
  92. package/commands/spartan/web-to-prd.md +706 -0
  93. package/commands/spartan/workstreams.md +109 -0
  94. package/commands/spartan/write.md +16 -0
  95. package/commands/spartan.md +386 -0
  96. package/frameworks/00-framework-comparison-guide.md +317 -0
  97. package/frameworks/01-lean-canvas.md +196 -0
  98. package/frameworks/02-design-sprint.md +304 -0
  99. package/frameworks/03-foundation-sprint.md +337 -0
  100. package/frameworks/04-business-model-canvas.md +391 -0
  101. package/frameworks/05-customer-development.md +426 -0
  102. package/frameworks/06-jobs-to-be-done.md +358 -0
  103. package/frameworks/07-mom-test.md +392 -0
  104. package/frameworks/08-value-proposition-canvas.md +488 -0
  105. package/frameworks/09-javelin-board.md +428 -0
  106. package/frameworks/10-build-measure-learn.md +467 -0
  107. package/frameworks/11-mvp-approaches.md +533 -0
  108. package/frameworks/think-before-build.md +593 -0
  109. package/lib/assembler.js +197 -0
  110. package/lib/assembler.test.js +159 -0
  111. package/lib/detector.js +166 -0
  112. package/lib/detector.test.js +221 -0
  113. package/lib/packs.js +16 -0
  114. package/lib/resolver.js +272 -0
  115. package/lib/resolver.test.js +298 -0
  116. package/lib/worktree.sh +104 -0
  117. package/package.json +50 -0
  118. package/packs/backend-micronaut.yaml +35 -0
  119. package/packs/backend-nodejs.yaml +15 -0
  120. package/packs/backend-python.yaml +15 -0
  121. package/packs/core.yaml +37 -0
  122. package/packs/database.yaml +21 -0
  123. package/packs/frontend-react.yaml +24 -0
  124. package/packs/infrastructure.yaml +40 -0
  125. package/packs/ops.yaml +16 -0
  126. package/packs/packs.compiled.json +371 -0
  127. package/packs/product.yaml +22 -0
  128. package/packs/project-mgmt.yaml +24 -0
  129. package/packs/research.yaml +39 -0
  130. package/packs/shared-backend.yaml +14 -0
  131. package/packs/ux-design.yaml +21 -0
  132. package/rules/backend-micronaut/API_DESIGN.md +313 -0
  133. package/rules/backend-micronaut/BATCH_PROCESSING.md +92 -0
  134. package/rules/backend-micronaut/CONTROLLERS.md +388 -0
  135. package/rules/backend-micronaut/KOTLIN.md +414 -0
  136. package/rules/backend-micronaut/RETROFIT_PLACEMENT.md +290 -0
  137. package/rules/backend-micronaut/SERVICES_AND_BEANS.md +325 -0
  138. package/rules/core/NAMING_CONVENTIONS.md +208 -0
  139. package/rules/core/SKILL_AUTHORING.md +174 -0
  140. package/rules/core/TIMEZONE.md +316 -0
  141. package/rules/database/ORM_AND_REPO.md +289 -0
  142. package/rules/database/SCHEMA.md +146 -0
  143. package/rules/database/TRANSACTIONS.md +311 -0
  144. package/rules/frontend-react/FRONTEND.md +344 -0
  145. package/rules/infrastructure/MODULES.md +260 -0
  146. package/rules/infrastructure/NAMING.md +196 -0
  147. package/rules/infrastructure/PROVIDERS.md +309 -0
  148. package/rules/infrastructure/SECURITY.md +310 -0
  149. package/rules/infrastructure/STATE_AND_BACKEND.md +237 -0
  150. package/rules/infrastructure/STRUCTURE.md +234 -0
  151. package/rules/infrastructure/VARIABLES.md +285 -0
  152. package/rules/shared-backend/ARCHITECTURE.md +46 -0
  153. package/rules/ux-design/DESIGN_PROCESS.md +176 -0
  154. package/skills/api-endpoint-creator/SKILL.md +455 -0
  155. package/skills/api-endpoint-creator/error-handling-guide.md +244 -0
  156. package/skills/api-endpoint-creator/examples.md +522 -0
  157. package/skills/api-endpoint-creator/testing-patterns.md +302 -0
  158. package/skills/article-writing/SKILL.md +109 -0
  159. package/skills/article-writing/examples.md +59 -0
  160. package/skills/backend-api-design/SKILL.md +84 -0
  161. package/skills/backend-api-design/code-patterns.md +138 -0
  162. package/skills/brainstorm/SKILL.md +95 -0
  163. package/skills/browser-qa/SKILL.md +87 -0
  164. package/skills/browser-qa/playwright-snippets.md +110 -0
  165. package/skills/ci-cd-patterns/SKILL.md +108 -0
  166. package/skills/ci-cd-patterns/workflows.md +149 -0
  167. package/skills/competitive-teardown/SKILL.md +93 -0
  168. package/skills/competitive-teardown/example-analysis.md +50 -0
  169. package/skills/content-engine/SKILL.md +131 -0
  170. package/skills/content-engine/examples.md +72 -0
  171. package/skills/database-patterns/SKILL.md +72 -0
  172. package/skills/database-patterns/code-templates.md +114 -0
  173. package/skills/database-table-creator/SKILL.md +141 -0
  174. package/skills/database-table-creator/examples.md +552 -0
  175. package/skills/database-table-creator/kotlin-templates.md +400 -0
  176. package/skills/database-table-creator/migration-template.sql +68 -0
  177. package/skills/database-table-creator/validation-checklist.md +337 -0
  178. package/skills/deep-research/SKILL.md +80 -0
  179. package/skills/design-intelligence/SKILL.md +268 -0
  180. package/skills/design-workflow/SKILL.md +127 -0
  181. package/skills/design-workflow/checklists.md +45 -0
  182. package/skills/idea-validation/SKILL.md +129 -0
  183. package/skills/idea-validation/example-report.md +50 -0
  184. package/skills/investor-materials/SKILL.md +122 -0
  185. package/skills/investor-materials/example-outline.md +70 -0
  186. package/skills/investor-outreach/SKILL.md +112 -0
  187. package/skills/investor-outreach/examples.md +76 -0
  188. package/skills/kotlin-best-practices/SKILL.md +58 -0
  189. package/skills/kotlin-best-practices/code-patterns.md +132 -0
  190. package/skills/market-research/SKILL.md +99 -0
  191. package/skills/security-checklist/SKILL.md +65 -0
  192. package/skills/security-checklist/audit-reference.md +95 -0
  193. package/skills/service-debugging/SKILL.md +116 -0
  194. package/skills/service-debugging/common-issues.md +65 -0
  195. package/skills/startup-pipeline/SKILL.md +152 -0
  196. package/skills/terraform-best-practices/SKILL.md +244 -0
  197. package/skills/terraform-module-creator/SKILL.md +284 -0
  198. package/skills/terraform-review/SKILL.md +222 -0
  199. package/skills/terraform-security-audit/SKILL.md +280 -0
  200. package/skills/terraform-service-scaffold/SKILL.md +574 -0
  201. package/skills/testing-strategies/SKILL.md +116 -0
  202. package/skills/testing-strategies/examples.md +103 -0
  203. package/skills/testing-strategies/integration-test-setup.md +71 -0
  204. package/skills/ui-ux-pro-max/SKILL.md +238 -0
  205. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  206. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  207. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  208. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  209. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  210. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  211. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  212. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  213. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  214. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  215. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  216. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  217. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  218. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  219. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  220. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  221. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  222. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  223. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  224. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  225. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  226. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  227. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  228. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  229. package/skills/ui-ux-pro-max/python-setup.md +146 -0
  230. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  231. package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  232. package/skills/ui-ux-pro-max/scripts/search.py +114 -0
  233. package/skills/web-to-prd/SKILL.md +478 -0
  234. package/templates/build-config.yaml +44 -0
  235. package/templates/commands-config.yaml +55 -0
  236. package/templates/competitor-analysis.md +60 -0
  237. package/templates/content/AGENT_TEMPLATE.md +47 -0
  238. package/templates/content/COMMAND_TEMPLATE.md +27 -0
  239. package/templates/content/RULE_TEMPLATE.md +40 -0
  240. package/templates/content/SKILL_TEMPLATE.md +41 -0
  241. package/templates/design-config.md +105 -0
  242. package/templates/design-doc.md +207 -0
  243. package/templates/epic.md +100 -0
  244. package/templates/feature-spec.md +181 -0
  245. package/templates/idea-canvas.md +47 -0
  246. package/templates/implementation-plan.md +159 -0
  247. package/templates/prd-template.md +86 -0
  248. package/templates/preamble.md +89 -0
  249. package/templates/project-readme.md +35 -0
  250. package/templates/quality-gates.md +230 -0
  251. package/templates/spartan-config.yaml +164 -0
  252. package/templates/user-interview.md +69 -0
  253. package/templates/validation-checklist.md +108 -0
  254. package/templates/workflow-backend-micronaut.md +409 -0
  255. package/templates/workflow-frontend-react.md +233 -0
@@ -0,0 +1,376 @@
1
+ ---
2
+ name: spartan:gsd-upgrade
3
+ description: Upgrade GSD workflow to v5 — adds decompose step, agent memory layer, and wave-based parallel execution inspired by Service Insight's 6-step agent workflow. Run once to migrate an existing GSD project or set up the new workflow.
4
+ argument-hint: "[migrate | fresh]"
5
+ ---
6
+
7
+ # GSD v5 Upgrade: {{ args[0] | default: "fresh" }}
8
+
9
+ You are upgrading the GSD (Get Shit Done) workflow to incorporate three key concepts
10
+ from the Service Insight agent workflow:
11
+
12
+ 1. **Decompose step** — break complex requirements into atomic, independent work units before planning
13
+ 2. **Agent memory layer** — persistent knowledge base that survives across sessions (not just .handoff/)
14
+ 3. **Wave-based execution** — parallel task execution in waves, with dependency-aware ordering
15
+
16
+ ---
17
+
18
+ ## What Changes from GSD v4
19
+
20
+ | Aspect | GSD v4 | GSD v5 |
21
+ |---|---|---|
22
+ | Requirement handling | User describes → plan directly | User describes → **decompose** → spec → plan |
23
+ | Context persistence | `.handoff/` files (session-based) | `.handoff/` + `.memory/` (project-lifetime) |
24
+ | Task execution | Sequential within phase | **Wave-parallel** within phase |
25
+ | Knowledge capture | In chat history (lost) | In `.memory/knowledge/` (permanent) |
26
+ | Cross-session state | `.planning/` only | `.planning/` + `.memory/decisions/` + `.memory/patterns/` |
27
+
28
+ ---
29
+
30
+ ## New Directory Structure
31
+
32
+ ```
33
+ .planning/ ← GSD state (unchanged)
34
+ PROJECT.md
35
+ ROADMAP.md
36
+ milestones/
37
+ M1/
38
+ PLAN.md
39
+ phases/
40
+
41
+ .memory/ ← NEW: Agent memory layer
42
+ index.md ← Quick reference of all knowledge
43
+ decisions/ ← Architectural decisions (ADRs)
44
+ 001-chose-cloudinary.md
45
+ 002-cents-as-long.md
46
+ patterns/ ← Reusable patterns discovered during work
47
+ api-client-pattern.md
48
+ error-handling-pattern.md
49
+ knowledge/ ← Domain knowledge captured from conversations
50
+ stripe-webhook-gotchas.md
51
+ cloudinary-transform-rules.md
52
+ blockers/ ← Known issues and workarounds
53
+ react-konva-ssr.md
54
+
55
+ .handoff/ ← Session handoffs (unchanged, but now references .memory/)
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Step 1: Set Up Memory Layer
61
+
62
+ {% if args[0] == "migrate" %}
63
+ ### Migrate from existing GSD project
64
+
65
+ ```bash
66
+ # Create memory structure
67
+ mkdir -p .memory/{decisions,patterns,knowledge,blockers}
68
+
69
+ # Scan existing handoff files for knowledge to extract
70
+ ls .handoff/ 2>/dev/null
71
+ ```
72
+
73
+ Read each `.handoff/` file and extract:
74
+ - **Decisions made** → save to `.memory/decisions/NNN-description.md`
75
+ - **Patterns discovered** → save to `.memory/patterns/name.md`
76
+ - **Domain knowledge** → save to `.memory/knowledge/topic.md`
77
+ - **Known blockers/gotchas** → save to `.memory/blockers/topic.md`
78
+
79
+ {% else %}
80
+ ### Fresh setup
81
+
82
+ ```bash
83
+ mkdir -p .memory/{decisions,patterns,knowledge,blockers}
84
+ ```
85
+ {% endif %}
86
+
87
+ Create `.memory/index.md`:
88
+
89
+ ```markdown
90
+ # Project Memory Index
91
+ Last updated: [date]
92
+
93
+ ## Decisions
94
+ - [link to each decision file with one-line summary]
95
+
96
+ ## Patterns
97
+ - [link to each pattern file]
98
+
99
+ ## Knowledge
100
+ - [link to each knowledge file]
101
+
102
+ ## Blockers & Workarounds
103
+ - [link to each blocker file]
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Step 2: Decompose Workflow
109
+
110
+ The decompose step sits between "user describes what they want" and "plan tasks".
111
+ It breaks complex requirements into **atomic work units** that can be independently:
112
+ - Specified
113
+ - Planned
114
+ - Executed
115
+ - Tested
116
+ - Reviewed
117
+
118
+ ### Decompose Template
119
+
120
+ When `/gsd:discuss-phase` receives a complex requirement, decompose it:
121
+
122
+ ```markdown
123
+ ## Decomposition: [requirement name]
124
+
125
+ ### Work Units
126
+ Each unit is independently implementable and testable.
127
+
128
+ #### WU-1: [name]
129
+ - **What:** [specific deliverable]
130
+ - **Dependencies:** [none / WU-N]
131
+ - **Wave:** [1 = no deps, 2 = depends on wave 1, etc.]
132
+ - **Estimated size:** [S/M/L — S < 2h, M < 4h, L < 1 day]
133
+ - **Acceptance:** [how to verify it's done]
134
+
135
+ #### WU-2: [name]
136
+ ...
137
+
138
+ ### Wave Execution Plan
139
+ - **Wave 1** (parallel, no deps): WU-1, WU-3, WU-5
140
+ - **Wave 2** (after wave 1): WU-2, WU-4
141
+ - **Wave 3** (after wave 2): WU-6
142
+
143
+ ### Risk Assessment
144
+ - [which units are highest risk?]
145
+ - [which units have uncertain scope?]
146
+ ```
147
+
148
+ **Rules for decomposition:**
149
+ - Each work unit touches **max 3 files** (ideal: 1-2)
150
+ - Each work unit has **exactly one commit**
151
+ - No work unit takes longer than **half a day**
152
+ - If a unit is too big → decompose further
153
+ - Dependencies only flow forward (Wave 2 depends on Wave 1, never reverse)
154
+
155
+ ---
156
+
157
+ ## Step 3: Wave-Based Execution
158
+
159
+ Replace sequential task execution with wave-parallel:
160
+
161
+ ### How waves work in Claude Code
162
+
163
+ Since Claude Code runs in a single terminal, "parallel" means:
164
+ 1. All tasks in a wave are **independent** — can be done in any order
165
+ 2. Within a wave, use separate commits for each task
166
+ 3. Between waves, verify all previous wave tasks pass tests
167
+ 4. **Multi-tab parallel:** User can run multiple Claude Code tabs, each on a different WU from the same wave
168
+
169
+ ### Wave execution protocol
170
+
171
+ ```
172
+ Wave 1: [list of independent work units]
173
+ ├── WU-1: [assign to Tab A or execute sequentially]
174
+ ├── WU-3: [assign to Tab B]
175
+ └── WU-5: [assign to Tab C]
176
+
177
+ ── Verify: all Wave 1 tests pass ──
178
+ ── Merge/integrate if needed ──
179
+
180
+ Wave 2: [depends on Wave 1]
181
+ ├── WU-2: [can now use WU-1's output]
182
+ └── WU-4: [can now use WU-3's output]
183
+
184
+ ── Verify: all tests pass ──
185
+
186
+ Wave 3: [integration / final assembly]
187
+ └── WU-6: [ties everything together]
188
+ ```
189
+
190
+ ### Multi-tab execution (recommended for waves with 2+ units)
191
+
192
+ ```bash
193
+ # Tab 1:
194
+ claude
195
+ > "Execute WU-1 from Wave 1. Context: [link to decomposition]"
196
+
197
+ # Tab 2:
198
+ claude
199
+ > "Execute WU-3 from Wave 1. Context: [link to decomposition]"
200
+
201
+ # Tab 3:
202
+ claude
203
+ > "Execute WU-5 from Wave 1. Context: [link to decomposition]"
204
+ ```
205
+
206
+ Each tab reads `.memory/` for shared context but writes to separate files/branches.
207
+
208
+ ---
209
+
210
+ ## Step 4: Memory Capture Protocol
211
+
212
+ After EVERY significant session, capture knowledge:
213
+
214
+ ### Decision Record Template (`.memory/decisions/NNN-title.md`)
215
+
216
+ ```markdown
217
+ # ADR-NNN: [Decision Title]
218
+ Date: [date]
219
+ Status: accepted
220
+
221
+ ## Context
222
+ [What situation led to this decision?]
223
+
224
+ ## Decision
225
+ [What was decided?]
226
+
227
+ ## Consequences
228
+ - Good: [positive outcomes]
229
+ - Bad: [tradeoffs accepted]
230
+ - Neutral: [side effects]
231
+
232
+ ## Alternatives Considered
233
+ - [Option A] — rejected because [reason]
234
+ - [Option B] — rejected because [reason]
235
+ ```
236
+
237
+ ### Pattern Template (`.memory/patterns/name.md`)
238
+
239
+ ```markdown
240
+ # Pattern: [Name]
241
+ Discovered: [date]
242
+ Used in: [list of files/features]
243
+
244
+ ## Problem
245
+ [What recurring problem does this solve?]
246
+
247
+ ## Solution
248
+ [Code example or approach]
249
+
250
+ ## When to Use
251
+ [Trigger conditions]
252
+
253
+ ## When NOT to Use
254
+ [Anti-patterns or exceptions]
255
+ ```
256
+
257
+ ### Knowledge Template (`.memory/knowledge/topic.md`)
258
+
259
+ ```markdown
260
+ # [Topic]
261
+ Source: [conversation / debugging / documentation]
262
+ Date: [date]
263
+
264
+ ## Key Facts
265
+ - [fact 1]
266
+ - [fact 2]
267
+
268
+ ## Gotchas
269
+ - [gotcha 1 — how to avoid]
270
+
271
+ ## Related
272
+ - [links to relevant decisions or patterns]
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Step 5: Updated GSD Commands
278
+
279
+ The existing GSD commands gain new behavior:
280
+
281
+ ### `/gsd:discuss-phase [n]` — now includes decompose
282
+ 1. Gather requirements (unchanged)
283
+ 2. **NEW:** Run decomposition into work units
284
+ 3. **NEW:** Assign waves based on dependencies
285
+ 4. Present decomposition for approval before planning
286
+
287
+ ### `/gsd:plan-phase [n]` — now wave-aware
288
+ 1. Take approved decomposition
289
+ 2. Generate PLAN.md with wave structure
290
+ 3. **NEW:** Check `.memory/` for relevant patterns and decisions
291
+ 4. **NEW:** Include memory references in task context
292
+
293
+ ### `/gsd:execute-phase [n]` — now wave-parallel
294
+ 1. Execute wave by wave (not task by task)
295
+ 2. **NEW:** Before each wave, read `.memory/` for context
296
+ 3. **NEW:** After each wave, capture knowledge to `.memory/`
297
+ 4. **NEW:** Suggest multi-tab execution for waves with 3+ units
298
+
299
+ ### `/gsd:verify-work [n]` — now captures memory
300
+ 1. Run acceptance criteria checks (unchanged)
301
+ 2. **NEW:** Extract decisions made → `.memory/decisions/`
302
+ 3. **NEW:** Extract patterns discovered → `.memory/patterns/`
303
+ 4. **NEW:** Update `.memory/index.md`
304
+
305
+ ### `/gsd:status` — now memory-aware
306
+ 1. Show current milestone/phase (unchanged)
307
+ 2. **NEW:** Show `.memory/` stats (decisions, patterns, knowledge count)
308
+ 3. **NEW:** Show wave progress within current phase
309
+
310
+ ---
311
+
312
+ ## Step 6: Context-Save Integration
313
+
314
+ Update `/spartan:context-save` to reference memory:
315
+
316
+ Add to handoff template:
317
+ ```markdown
318
+ ## Memory Updates This Session
319
+ - New decisions: [list or "none"]
320
+ - New patterns: [list or "none"]
321
+ - New knowledge: [list or "none"]
322
+ - Memory index updated: [yes/no]
323
+
324
+ ## Resume with Memory
325
+ 1. Read `.memory/index.md` for project knowledge
326
+ 2. Read `.handoff/[this-file]` for session state
327
+ 3. Continue from [specific point]
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Step 7: Updated CLAUDE.md Section
333
+
334
+ Add this block to the project's CLAUDE.md (or global):
335
+
336
+ ```markdown
337
+ ## GSD v5 — Agent Memory & Wave Execution
338
+
339
+ ### Memory Layer
340
+ - `.memory/` contains persistent project knowledge
341
+ - Always check `.memory/index.md` before starting work
342
+ - After significant work, capture decisions/patterns/knowledge
343
+ - Memory survives across all sessions (unlike chat history)
344
+
345
+ ### Wave Execution
346
+ - Complex phases are decomposed into work units (WUs)
347
+ - WUs are grouped into waves by dependency
348
+ - Wave 1 = no dependencies (can run in parallel tabs)
349
+ - Wave N+1 = depends on Wave N outputs
350
+ - Always verify tests between waves
351
+
352
+ ### Decomposition Rules
353
+ - Max 3 files per work unit
354
+ - Max half-day per work unit
355
+ - One commit per work unit
356
+ - Dependencies only flow forward
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Verification
362
+
363
+ After upgrade:
364
+ - [ ] `.memory/` directory created with subdirectories
365
+ - [ ] `.memory/index.md` exists (even if empty for fresh setup)
366
+ - [ ] Existing project knowledge migrated (if migrate mode)
367
+ - [ ] CLAUDE.md updated with v5 section
368
+ - [ ] Next `/gsd:discuss-phase` will use decompose step
369
+
370
+ Say:
371
+ "✅ GSD upgraded to v5. Key changes:
372
+ - **Decompose** step breaks requirements into atomic work units
373
+ - **Wave execution** enables parallel work across Claude Code tabs
374
+ - **Agent memory** in `.memory/` persists knowledge across all sessions
375
+
376
+ Try it: `/gsd:discuss-phase [N]` will now decompose before planning."
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: spartan:guard
3
+ description: Maximum safety — activate both careful mode (destructive operation warnings) and freeze mode (directory lock) simultaneously. Use when working with production configs, database migrations, or any high-risk changes.
4
+ argument-hint: "[directory to lock edits to]"
5
+ ---
6
+
7
+ # Guard Mode — Maximum Safety
8
+
9
+ Activating **both** safety guardrails:
10
+
11
+ ## 1. 🛡️ Careful Mode → ON
12
+ All destructive operations require explicit confirmation.
13
+ (See `/spartan:careful` for full watchlist)
14
+
15
+ ## 2. 🧊 Freeze Mode → ON — locked to: {{ args[0] }}
16
+ File edits restricted to `{{ args[0] }}/` and its corresponding test directory.
17
+ (See `/spartan:freeze` for full rules)
18
+
19
+ ---
20
+
21
+ ## When to Use Guard Mode
22
+
23
+ - **Database migrations** — freeze to `db/migration/`, careful prevents DROP without confirm
24
+ - **Production config** — freeze to `infrastructure/` or `k8s/`, careful prevents destructive terraform/railway ops
25
+ - **Sensitive refactoring** — freeze to the one module being refactored, careful prevents accidental data loss
26
+ - **Hotfix on main** — freeze to the specific fix files, careful prevents force-push
27
+
28
+ ---
29
+
30
+ ## Deactivate
31
+
32
+ | Command | Effect |
33
+ |---|---|
34
+ | `/spartan:unfreeze` | Remove directory lock only, careful stays ON |
35
+ | `/spartan:careful off` | Remove destructive warnings only, freeze stays ON |
36
+ | `/spartan:guard off` | Remove BOTH — back to normal mode |
37
+
38
+ ---
39
+
40
+ Claude should acknowledge:
41
+ "🛡️🧊 Guard mode ON — careful (destructive warnings) + freeze (locked to `{{ args[0] }}/`).
42
+ Đây là chế độ an toàn cao nhất. Nói '/spartan:guard off' để tắt cả hai."
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: spartan:init-project
3
+ description: Scan current codebase and auto-generate a project-level CLAUDE.md with stack detection, conventions, domain context, and team rules. Use when joining a project or setting up AI workflow for an existing repo.
4
+ argument-hint: "[optional: project name]"
5
+ ---
6
+
7
+ # Initialize Project: {{ args[0] | default: "auto-detect" }}
8
+
9
+ You are generating a **project-level CLAUDE.md** by scanning the codebase.
10
+ This file tells Claude Code everything it needs to know about THIS specific project.
11
+
12
+ The global `~/.claude/CLAUDE.md` (Spartan Toolkit) provides generic rules.
13
+ This project CLAUDE.md provides project-specific overrides and context.
14
+
15
+ ---
16
+
17
+ ## Step 1: Auto-Detect Stack
18
+
19
+ ```bash
20
+ # Package managers & frameworks
21
+ ls package.json tsconfig.json next.config.* vite.config.* 2>/dev/null
22
+ ls build.gradle.kts pom.xml Cargo.toml go.mod 2>/dev/null
23
+ ls Dockerfile docker-compose.yml railway.toml 2>/dev/null
24
+ ls terraform/ k8s/ .github/workflows/ 2>/dev/null
25
+
26
+ # Framework detection
27
+ cat package.json 2>/dev/null | grep -E '"next"|"react"|"vue"|"angular"|"svelte"'
28
+ cat build.gradle.kts 2>/dev/null | grep -E 'micronaut|ktor|quarkus'
29
+
30
+ # Language breakdown
31
+ find . -name '*.kt' -not -path '*/build/*' | wc -l
32
+ find . -name '*.tsx' -o -name '*.ts' | grep -v node_modules | wc -l
33
+ find . -name '*.py' -not -path '*/venv/*' | wc -l
34
+
35
+ # Database
36
+ ls src/main/resources/db/migration/ 2>/dev/null | head -3
37
+ cat docker-compose.yml 2>/dev/null | grep -E 'postgres|mysql|redis|kafka|mongo'
38
+ grep -r "prisma\|typeorm\|drizzle" package.json 2>/dev/null
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Step 2: Detect Domain & Conventions
44
+
45
+ ```bash
46
+ # Project description
47
+ cat README.md 2>/dev/null | head -30
48
+
49
+ # Existing AI config
50
+ cat CLAUDE.md AGENTS.md .cursorrules 2>/dev/null
51
+
52
+ # Package structure / architecture pattern
53
+ find src/main/kotlin -type d -maxdepth 4 2>/dev/null | head -20
54
+ ls src/app/ 2>/dev/null | head -20
55
+
56
+ # Key domain entities
57
+ find . -path '*/domain/model/*' -o -path '*/entities/*' -o -path '*/types/*' | head -15
58
+
59
+ # External integrations
60
+ grep -r "stripe\|cloudinary\|aws\|firebase\|supabase\|twilio" \
61
+ --include='*.kt' --include='*.ts' --include='*.yml' -l 2>/dev/null | head -10
62
+
63
+ # Test patterns
64
+ find . -name '*Test*' -o -name '*spec*' -o -name '*.test.*' | head -10
65
+
66
+ # Git conventions
67
+ git log --oneline -20 2>/dev/null
68
+ git log --format='%s' -20 2>/dev/null | grep -oP '^[a-z]+' | sort | uniq -c | sort -rn
69
+
70
+ # Environment variables
71
+ cat .env.example .env.local 2>/dev/null | grep -v '^#' | cut -d= -f1 | head -20
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Step 3: Ask Clarifying Questions
77
+
78
+ Based on scan results, ask the user to fill in gaps:
79
+
80
+ 1. **What does this project do?** (1-2 sentences for the "About" section)
81
+ 2. **Any domain rules that aren't obvious from code?** (e.g., "all amounts in cents", "never call X from Y layer")
82
+ 3. **Current focus / active milestone?** (what's being built right now)
83
+ 4. **Deployment targets?** (Railway staging → AWS prod, etc.)
84
+ 5. **Team size / who else codes here?** (affects review conventions)
85
+
86
+ **Auto mode on?** → Infer what you can from README, git log, and codebase structure. Use sensible defaults for unknowns. Proceed immediately.
87
+ **Auto mode off?** → Wait for answers.
88
+
89
+ ---
90
+
91
+ ## Step 4: Generate CLAUDE.md
92
+
93
+ Write `CLAUDE.md` at project root with this structure:
94
+
95
+ ```markdown
96
+ # Project: [name]
97
+
98
+ ## About
99
+ [1-2 sentences from user + README]
100
+
101
+ ## Tech Stack
102
+ [auto-detected from Step 1]
103
+ - Backend: [framework + language]
104
+ - Frontend: [framework + language]
105
+ - Database: [type]
106
+ - Infrastructure: [Docker/K8s/Terraform]
107
+ - Deployment: [platforms]
108
+ - CI: [pipeline]
109
+
110
+ ## Architecture
111
+ [detected pattern: layered / hexagonal / feature-based]
112
+ - [layer/directory] → [purpose]
113
+
114
+ ## Domain Model
115
+ [key entities from code scan]
116
+ - [Entity1]: [brief description]
117
+ - [Entity2]: [brief description]
118
+
119
+ ## External Integrations
120
+ [from grep scan]
121
+ - [Service]: [what it's used for]
122
+
123
+ ## Specific Rules
124
+ [from user answers + detected patterns]
125
+ - [Rule 1 — e.g., "All monetary amounts stored as Long (cents)"]
126
+ - [Rule 2 — e.g., "!! operator banned — use Either error handling (CORE_RULES)"]
127
+ - [Rule 3]
128
+
129
+ ## Commit Convention
130
+ [detected from git log]
131
+ type(scope): description
132
+ Types: [detected types]
133
+
134
+ ## Environment Variables
135
+ [from .env.example scan]
136
+ Key vars: [list critical ones]
137
+
138
+ ## Current Focus
139
+ [from user answer]
140
+ - Active: [what's being built]
141
+ - Next: [what's planned]
142
+
143
+ ## Testing
144
+ - Unit: [framework + pattern]
145
+ - Integration: [framework — Testcontainers?]
146
+ - E2E: [if configured]
147
+ - Run: [commands]
148
+
149
+ ## GSD State
150
+ [if .planning/ exists, show current milestone/phase]
151
+ [if not, note "Not using GSD yet — run /gsd:new-project to start"]
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Step 5: Validate
157
+
158
+ Read back the generated CLAUDE.md and verify:
159
+ - [ ] Stack detection is accurate (user confirms)
160
+ - [ ] Domain rules are complete
161
+ - [ ] No sensitive information (secrets, internal URLs)
162
+ - [ ] File is under 200 lines (concise enough for Claude to read quickly)
163
+
164
+ ---
165
+
166
+ ## Step 6: Optional — Generate .cursorrules
167
+
168
+ If user also uses Cursor, offer to generate `.cursorrules` with a subset of the same info.
169
+
170
+ **Auto mode on?** → Skip `.cursorrules` generation unless Cursor config already exists in project.
171
+ **Auto mode off?** → Ask: "Also generate `.cursorrules` for Cursor? (y/n)"
172
+
173
+ ---
174
+
175
+ After generating, say:
176
+ "✅ Project CLAUDE.md created. Claude Code will now read this file automatically in every session.
177
+ Review it and edit any details that need correcting.
178
+ The global toolkit rules (from `~/.claude/CLAUDE.md`) still apply — this file adds project-specific context on top."