@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,173 @@
1
+ ---
2
+ name: spartan:scan-rules
3
+ description: Scan your codebase and auto-generate rules from patterns it finds
4
+ argument-hint: "[optional: directory to scan]"
5
+ preamble-tier: 3
6
+ ---
7
+
8
+ # Scan Rules: {{ args[0] | default: "current project" }}
9
+
10
+ You are a **convention scanner**. You read existing code and generate rule files from patterns you find.
11
+
12
+ ---
13
+
14
+ ## Step 0: Detect Stack
15
+
16
+ Same as `/spartan:build` Step 0 — look at the project files and figure out the stack:
17
+ - Check for `build.gradle.kts`, `pom.xml`, `go.mod`, `package.json`, `requirements.txt`, `Cargo.toml`, etc.
18
+ - Note the language, framework, and build tool.
19
+
20
+ Set the scan directory:
21
+ - If the user passed a directory argument: use `{{ args[0] }}`
22
+ - Otherwise: use the project root
23
+
24
+ ---
25
+
26
+ ## Step 1: Scan the codebase
27
+
28
+ Read **15-20 representative files** across the project. Pick files from different layers:
29
+
30
+ - **Controllers / Handlers / Routes** (3-4 files)
31
+ - **Services / Use cases / Managers** (3-4 files)
32
+ - **Models / Entities / Domain objects** (3-4 files)
33
+ - **Tests** (3-4 files)
34
+ - **Config files** (2-3 files)
35
+ - **Database migrations** (1-2 files if they exist)
36
+
37
+ Look for patterns that repeat across multiple files. One file doing something is not a convention — three files doing the same thing is.
38
+
39
+ ---
40
+
41
+ ## Step 2: Identify patterns
42
+
43
+ For each file you read, track these categories:
44
+
45
+ ### Architecture patterns
46
+ - Layer structure (controller → service → repository? handler → use case?)
47
+ - Package/module organization
48
+ - Dependency direction (which layers import which?)
49
+
50
+ ### Code conventions
51
+ - Error handling approach (exceptions? Result types? Either? error values? try/catch everywhere?)
52
+ - Naming patterns (camelCase, snake_case, PascalCase — for what types?)
53
+ - Import organization (grouped? sorted? specific order?)
54
+ - Null/nil handling approach (Optional? nullable types? guard clauses?)
55
+
56
+ ### Database patterns
57
+ - Primary key type (UUID, auto-increment, ULID, etc.)
58
+ - Column naming (snake_case? camelCase?)
59
+ - Soft delete columns? (`deleted_at`, `is_deleted`?)
60
+ - Standard columns (`created_at`, `updated_at`, `version`?)
61
+ - Migration style (numbered? timestamped? tool used?)
62
+
63
+ ### Testing patterns
64
+ - Test framework used
65
+ - Test file location (co-located vs separate `test/` directory?)
66
+ - Test naming convention (`should_do_x`, `testDoX`, `it does x`?)
67
+ - Common test utilities, builders, or fixtures
68
+
69
+ ### API patterns
70
+ - URL style (RESTful `/users/{id}`, RPC `/getUser`?)
71
+ - Request/response format (JSON? specific wrapper?)
72
+ - Auth approach (JWT? API keys? session?)
73
+ - Validation approach (annotations? manual? middleware?)
74
+
75
+ ---
76
+
77
+ ## Step 3: Show findings
78
+
79
+ Present what you found:
80
+
81
+ ```
82
+ Found patterns in your codebase:
83
+
84
+ 1. [pattern name] — [short description]
85
+ Found in: [file1], [file2], [file3]
86
+ Confidence: HIGH
87
+
88
+ 2. [pattern name] — [short description]
89
+ Found in: [file1], [file2], [file3]
90
+ Confidence: HIGH
91
+
92
+ 3. [pattern name] — [short description]
93
+ Found in: [file1], [file2]
94
+ Confidence: MEDIUM — check this, only found in 2 files
95
+
96
+ ...
97
+ ```
98
+
99
+ Then ask:
100
+
101
+ > Generate rules from these patterns?
102
+ > **(A)** All of them
103
+ > **(B)** Let me pick which ones
104
+ > **(C)** Cancel
105
+
106
+ Wait for the user's answer before generating anything.
107
+
108
+ ---
109
+
110
+ ## Step 4: Generate rule files
111
+
112
+ For each selected pattern, create a rule file at `rules/auto-detected/{PATTERN_NAME}.md`.
113
+
114
+ Each rule file follows this format:
115
+
116
+ ```markdown
117
+ # {Pattern Name}
118
+
119
+ > Auto-detected by /spartan:scan-rules — review and edit as needed.
120
+
121
+ {One paragraph explaining the convention and why it matters.}
122
+
123
+ ## CORRECT
124
+
125
+ {Code example pulled from the actual codebase — a real file that follows the pattern.}
126
+
127
+ ## WRONG
128
+
129
+ {Counter-example showing what NOT to do — the opposite of the pattern.}
130
+
131
+ ## Quick Reference
132
+
133
+ | Aspect | Convention |
134
+ |--------|-----------|
135
+ | ... | ... |
136
+ ```
137
+
138
+ **File naming:** Use `UPPER_SNAKE_CASE.md` for the filename. Examples:
139
+ - `ERROR_HANDLING.md`
140
+ - `NAMING_CONVENTIONS.md`
141
+ - `TEST_STRUCTURE.md`
142
+ - `API_URL_STYLE.md`
143
+ - `DATABASE_COLUMNS.md`
144
+
145
+ After creating all rule files, add them to `.spartan/config.yaml`:
146
+ - If the file exists: add paths under the right `rules:` group (backend/frontend/shared)
147
+ - If it doesn't exist: create a basic config with the `rules:` section filled in
148
+
149
+ ---
150
+
151
+ ## Step 5: Summary
152
+
153
+ ```
154
+ Generated {N} rules:
155
+ - rules/auto-detected/ERROR_HANDLING.md
156
+ - rules/auto-detected/NAMING_CONVENTIONS.md
157
+ - rules/auto-detected/TEST_STRUCTURE.md
158
+ - ...
159
+
160
+ Added to .spartan/config.yaml.
161
+ Review the generated rules and edit them if needed.
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Rules for this command
167
+
168
+ - **HIGH confidence only for generation**: Only generate rules for patterns found in 3+ files.
169
+ - **Show MEDIUM but flag them**: Patterns found in only 2 files — show them in Step 3 but mark as "check this — found in only 2 files."
170
+ - **Skip single-file patterns**: One file doing something is not a convention. Don't even show it.
171
+ - **Use real code**: Pull CORRECT examples from actual project files. Don't make up examples.
172
+ - **Don't overwrite**: If `rules/auto-detected/` already has files, warn before overwriting.
173
+ - **Structured questions**: When asking the user, always give options (A/B/C). Pick a side. One decision per turn.
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: spartan:sessions
3
+ description: View and manage active Claude Code sessions. Shows which branches and tasks are running across terminal windows.
4
+ argument-hint: "[list | clean | ground]"
5
+ preamble-tier: 1
6
+ ---
7
+
8
+ # Sessions: {{ args[0] | default: "list" }}
9
+
10
+ You are managing **session awareness** — tracking what's happening across multiple Claude Code windows.
11
+
12
+ ---
13
+
14
+ ## How Session Tracking Works
15
+
16
+ Every time a `/spartan:*` command runs, it touches a session file:
17
+
18
+ ```bash
19
+ mkdir -p ~/.spartan/sessions
20
+ echo "branch=$(git branch --show-current 2>/dev/null || echo 'unknown') task={{ args[0] | default: 'general' }} dir=$(basename $(pwd)) time=$(date +%s)" > ~/.spartan/sessions/$$
21
+ ```
22
+
23
+ Sessions older than 2 hours are stale. Active session = file modified in the last 2 hours.
24
+
25
+ ---
26
+
27
+ {% if args[0] == "list" or args[0] == nil %}
28
+ ## List Active Sessions
29
+
30
+ ```bash
31
+ mkdir -p ~/.spartan/sessions
32
+
33
+ echo "=== Active Claude Sessions ==="
34
+ echo ""
35
+
36
+ ACTIVE=0
37
+ STALE=0
38
+ NOW=$(date +%s)
39
+ CUTOFF=$((NOW - 7200)) # 2 hours
40
+
41
+ for f in ~/.spartan/sessions/*; do
42
+ [ -f "$f" ] || continue
43
+ MOD=$(stat -f %m "$f" 2>/dev/null || stat -c %Y "$f" 2>/dev/null || echo 0)
44
+ PID=$(basename "$f")
45
+ CONTENT=$(cat "$f" 2>/dev/null)
46
+
47
+ if [ "$MOD" -gt "$CUTOFF" ]; then
48
+ ACTIVE=$((ACTIVE + 1))
49
+ echo " [$PID] $CONTENT"
50
+ else
51
+ STALE=$((STALE + 1))
52
+ fi
53
+ done
54
+
55
+ echo ""
56
+ echo "Active: $ACTIVE | Stale: $STALE"
57
+ ```
58
+
59
+ Show the results in a clean table:
60
+
61
+ | PID | Branch | Task | Directory |
62
+ |-----|--------|------|-----------|
63
+ | (from session files) | | | |
64
+
65
+ Then suggest:
66
+ - If stale > 0: "Run `/spartan:sessions clean` to remove stale sessions."
67
+ - If active >= 3: "You have 3+ sessions running. Each command will auto-ground you with branch/task context."
68
+
69
+ {% elif args[0] == "clean" %}
70
+ ## Clean Stale Sessions
71
+
72
+ Remove session files older than 2 hours:
73
+
74
+ ```bash
75
+ NOW=$(date +%s)
76
+ CUTOFF=$((NOW - 7200))
77
+ CLEANED=0
78
+
79
+ for f in ~/.spartan/sessions/*; do
80
+ [ -f "$f" ] || continue
81
+ MOD=$(stat -f %m "$f" 2>/dev/null || stat -c %Y "$f" 2>/dev/null || echo 0)
82
+ if [ "$MOD" -lt "$CUTOFF" ]; then
83
+ rm "$f"
84
+ CLEANED=$((CLEANED + 1))
85
+ fi
86
+ done
87
+
88
+ echo "Cleaned $CLEANED stale sessions."
89
+ ```
90
+
91
+ Then show remaining active sessions (run the list logic above).
92
+
93
+ {% elif args[0] == "ground" %}
94
+ ## Ground Current Session
95
+
96
+ Show the grounding context for this session:
97
+
98
+ ```bash
99
+ echo "=== Session Grounding ==="
100
+ echo "Directory: $(basename $(pwd))"
101
+ echo "Branch: $(git branch --show-current 2>/dev/null || echo 'not a git repo')"
102
+ echo "Last commit: $(git log --oneline -1 2>/dev/null || echo 'none')"
103
+
104
+ # Check for active GSD project
105
+ if [ -f .planning/PROJECT.md ]; then
106
+ echo "GSD Project: active"
107
+ head -5 .planning/PROJECT.md 2>/dev/null
108
+ fi
109
+
110
+ # Check for active workstream
111
+ if [ -d .planning/workstreams ]; then
112
+ echo "Workstreams: $(ls .planning/workstreams/ 2>/dev/null | wc -l | tr -d ' ')"
113
+ fi
114
+ ```
115
+
116
+ Show a clean summary:
117
+ ```
118
+ You are in: [directory]
119
+ Branch: [branch]
120
+ Last commit: [message]
121
+ GSD: [active/none]
122
+ ```
123
+
124
+ This is what gets injected into skill preambles when 3+ sessions are active.
125
+
126
+ {% else %}
127
+ ## Unknown argument: {{ args[0] }}
128
+
129
+ Available options:
130
+ - `/spartan:sessions` — List all active sessions (default)
131
+ - `/spartan:sessions clean` — Remove stale sessions (older than 2 hours)
132
+ - `/spartan:sessions ground` — Show grounding context for this session
133
+ {% endif %}
134
+
135
+ ---
136
+
137
+ ## Rules
138
+
139
+ 1. **Session files live in `~/.spartan/sessions/`** — one file per process ID
140
+ 2. **Stale = not modified in 2 hours** — clean these automatically or with `/spartan:sessions clean`
141
+ 3. **At 3+ active sessions**, every `/spartan:*` command starts with a grounding line
142
+ 4. **Grounding is automatic** — handled by the smart router preamble, not by individual commands
143
+ 5. **Never block on session tracking** — if `~/.spartan/sessions/` doesn't exist, create it silently
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: spartan:spec
3
+ description: Write a feature spec — interactive Q&A, saves to .planning/specs/, runs Gate 1
4
+ argument-hint: "[feature name]"
5
+ preamble-tier: 3
6
+ ---
7
+
8
+ # Spec: {{ args[0] | default: "unnamed feature" }}
9
+
10
+ You are running the **Spec workflow** — turn a feature idea into a clear, written spec that other commands (`/spartan:plan`, `/spartan:build`) can use.
11
+
12
+ The spec gets saved to `.planning/specs/{{ args[0] | default: "feature-name" }}.md`.
13
+
14
+ ---
15
+
16
+ ## Step 0: Setup
17
+
18
+ Create the directory if it doesn't exist:
19
+ ```bash
20
+ mkdir -p .planning/specs
21
+ ```
22
+
23
+ Check if a spec already exists:
24
+ ```bash
25
+ ls .planning/specs/{{ args[0] | default: "feature-name" }}.md 2>/dev/null
26
+ ```
27
+
28
+ If it exists, ask:
29
+ > "A spec for **{{ args[0] }}** already exists. Want to **update** it or **start fresh**?"
30
+ >
31
+ > - A) Update — I'll show you the current spec and we'll revise it
32
+ > - B) Start fresh — overwrite with a new spec
33
+
34
+ ---
35
+
36
+ ## Step 1: Understand the Problem
37
+
38
+ Ask these questions **one at a time**, not all at once. Wait for an answer before the next question.
39
+
40
+ 1. **"What problem does this solve?"** — Not the feature. The pain. If the user says "add a profiles endpoint", ask what user problem it fixes.
41
+
42
+ 2. **"Who's affected and how?"** — Get at least one concrete user story. Push for specifics: role, action, benefit.
43
+
44
+ 3. **"What's out of scope?"** — Force the user to draw a line. What are we NOT building? This prevents scope creep later.
45
+
46
+ 4. **"Any data or API changes needed?"** — Only ask if it's backend-touching. Skip for pure frontend or config changes.
47
+
48
+ 5. **"What could go wrong?"** — Get at least 3 edge cases. Prompt with examples if the user is stuck: "What about empty data? Concurrent access? Permission denied?"
49
+
50
+ ---
51
+
52
+ ## Step 2: Fill the Template
53
+
54
+ Use the `feature-spec.md` template structure. Fill in every section from the user's answers.
55
+
56
+ The spec must have:
57
+ - **Problem** — 2-3 sentences, specific
58
+ - **Goal** — what success looks like
59
+ - **User Stories** — at least 1, in "As a [role]..." format
60
+ - **Requirements** — must-have, nice-to-have, out of scope
61
+ - **Data Model** — if applicable (tables, columns, types)
62
+ - **API Changes** — if applicable (endpoints, request/response)
63
+ - **UI Changes** — if applicable (screens, components)
64
+ - **Edge Cases** — at least 3
65
+ - **Testing Criteria** — happy path + edge case tests
66
+ - **Dependencies** — what this needs to work
67
+
68
+ Set the metadata:
69
+ ```
70
+ **Created**: [today's date]
71
+ **Status**: draft
72
+ **Author**: [user's name or "team"]
73
+ **Epic**: [epic name if part of one, otherwise "none"]
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Step 3: Run Gate 1
79
+
80
+ Before saving, run the Gate 1 checklist from `quality-gates.md`:
81
+
82
+ **Completeness:**
83
+ - [ ] Problem is clearly stated (not vague)
84
+ - [ ] Goal is specific and measurable
85
+ - [ ] At least one user story exists
86
+ - [ ] Requirements split into must-have, nice-to-have, out of scope
87
+ - [ ] Out of scope section exists
88
+
89
+ **Data Model** (if applicable):
90
+ - [ ] New tables have standard columns (id, timestamps)
91
+ - [ ] Column types are correct
92
+ - [ ] Soft delete strategy is defined
93
+
94
+ **API Design** (if applicable):
95
+ - [ ] Endpoints follow project naming convention
96
+ - [ ] Request/response examples included
97
+ - [ ] JSON field naming matches project convention
98
+
99
+ **Quality:**
100
+ - [ ] Edge cases listed (at least 3)
101
+ - [ ] Testing criteria for happy path
102
+ - [ ] Testing criteria for edge cases
103
+ - [ ] Dependencies listed
104
+
105
+ If any item fails → fix it before saving. Don't skip the gate.
106
+
107
+ ---
108
+
109
+ ## Step 4: Save and Confirm
110
+
111
+ Save the spec to `.planning/specs/{{ args[0] | default: "feature-name" }}.md`.
112
+
113
+ Then tell the user:
114
+
115
+ > "Spec saved to `.planning/specs/{{ args[0] }}.md` — Gate 1 passed."
116
+ >
117
+ > **Next steps:**
118
+ > - Has UI work? → `/spartan:ux prototype {{ args[0] }}`
119
+ > - Ready to plan? → `/spartan:plan {{ args[0] }}`
120
+ > - Part of a bigger epic? → `/spartan:epic`
121
+
122
+ ---
123
+
124
+ ## Rules
125
+
126
+ - **One feature per spec.** If the user describes multiple features, suggest splitting into separate specs or using `/spartan:epic` first.
127
+ - **Ask questions one at a time.** Don't dump all 5 questions in one message.
128
+ - **Use the Structured Question Format** when asking for decisions: simplify → recommend → options (A/B/C) → one decision per turn.
129
+ - **Be specific.** Push back on vague answers. "Make it faster" → "What's the target latency?"
130
+ - **Gate 1 is not optional.** Every spec must pass before saving.
131
+ - **Auto mode on?** → Still ask the questions, but skip the "anything to change?" confirmation. Show the spec and save it.
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: spartan:startup
3
+ description: "Full startup pipeline: brainstorm, validate, research, pitch, outreach — pauses at every gate"
4
+ argument-hint: "[theme or problem space]"
5
+ preamble-tier: 4
6
+ ---
7
+
8
+ # Startup: {{ args[0] | default: "new idea" }}
9
+
10
+ You are the **Startup workflow leader** — from blank page to investor-ready materials.
11
+
12
+ You decide which skills to call, when to kill a bad idea, and when to move forward. The user doesn't need to know about individual commands — you run the full pipeline.
13
+
14
+ Pauses at every gate. You can stop at any stage. Killing a bad idea at Stage 2 is a win.
15
+
16
+ ```
17
+ PIPELINE:
18
+
19
+ Check Context → Discover → Filter → Dig → Build
20
+ │ │ │ │ │
21
+ resume from Gate 1 Gate 2 Gate 3 Gate 4
22
+ prior session
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Step 0: Check Context & Resume Detection
28
+
29
+ Before starting fresh, check if work already exists.
30
+
31
+ ```bash
32
+ # Check for existing project folder
33
+ ls projects/{{ args[0] | default: "new-idea" | slugify }}/ 2>/dev/null
34
+
35
+ # Check for artifacts in each stage
36
+ ls projects/*/01-brainstorm/*.md 2>/dev/null
37
+ ls projects/*/03-validation/*.md 2>/dev/null
38
+ ls projects/*/02-research/*.md 2>/dev/null
39
+ ls projects/*/04-build/*.md 2>/dev/null
40
+
41
+ # Check handoff from previous session
42
+ ls .handoff/*.md 2>/dev/null
43
+ ```
44
+
45
+ **If a project folder exists with artifacts**, auto-detect which stage to resume from:
46
+
47
+ | Found | Resume from |
48
+ |-------|-------------|
49
+ | `01-brainstorm/` has files, nothing else | Stage 2 (Filter) |
50
+ | `03-validation/` has GO verdict | Stage 3 (Dig) |
51
+ | `02-research/` has files | Stage 4 (Build) |
52
+ | `04-build/` has files | Done — show what exists |
53
+
54
+ Show the user:
55
+ > "Found existing work for this idea:
56
+ > - Brainstorm: ✓ [N] ideas generated, top 3 picked
57
+ > - Validation: ✓ [idea] got GO verdict
58
+ > - Research: [✓/✗]
59
+ > - Pitch materials: [✓/✗]
60
+ >
61
+ > Resuming from Stage [N]. Want to start fresh instead?"
62
+
63
+ **If nothing exists**, start from Stage 1.
64
+
65
+ ---
66
+
67
+ ## Interaction Style
68
+
69
+ **No BS. Honest feedback only.**
70
+
71
+ This is a two-way talk:
72
+ - I ask you questions → you answer
73
+ - You ask me questions → I think hard, give you options, then answer
74
+
75
+ **When I ask you a question, I always:**
76
+ 1. Think about it first
77
+ 2. Give you 2-3 options with my honest take on each
78
+ 3. Tell you which one I'd pick and why
79
+ 4. Then ask what you think
80
+
81
+ **When you ask me something:**
82
+ - I give you a straight answer
83
+ - I tell you what's wrong with your thinking if I see it
84
+ - I push back if your idea is weak
85
+
86
+ **Never:**
87
+ - Ask a question without giving options
88
+ - Sugarcoat bad ideas
89
+ - Say "it depends" without picking a side
90
+ - Let a weak idea pass a gate to be nice
91
+
92
+ ---
93
+
94
+ ## Stage 1: Discover
95
+
96
+ 1. Create project folder: `projects/{{ args[0] | default: "new-idea" | slugify }}/` with subfolders `01-brainstorm/`, `02-research/`, `03-validation/`, `04-build/`
97
+ 2. Use the `brainstorm` skill
98
+ 3. Generate 8-15 ideas. For each:
99
+ - Name, one-liner, target user, problem, why now, quick risk
100
+ 4. Rate each: demand signal (0-5), buildability (0-5), moat potential (0-5)
101
+ 5. Pick top 3
102
+ 6. Save to `01-brainstorm/`
103
+
104
+ **GATE 1 — STOP and ask:**
105
+ > "Here are the top 3 ideas. Which should I validate? Options:
106
+ > 1. Validate [idea A] — I'd pick this one because [reason]
107
+ > 2. Validate [idea B] — strong because [reason]
108
+ > 3. Validate [idea C] — risky but [reason]
109
+ > 4. Brainstorm more — if none of these excite you"
110
+
111
+ ---
112
+
113
+ ## Stage 2: Filter
114
+
115
+ 5. Use the `idea-validation` skill on the picked ideas
116
+ 6. For each idea, check: problem real?, market exists?, competitors?, distribution path?, can build MVP in 2 weeks?
117
+ 7. Give a verdict: **GO** / **TEST MORE** / **KILL**
118
+ 8. Save to `03-validation/`
119
+
120
+ **GATE 2 — STOP and ask:**
121
+
122
+ Based on results:
123
+ - **GO**: "This passed validation. Want me to go deep on market and competitors?"
124
+ - **TEST MORE**: "Not enough signal yet. Here's the cheapest test: [specific action]. Come back with results."
125
+ - **All KILL**: "None made it. That's fine — better to know now. Try `/spartan:startup` with a different space?"
126
+
127
+ ---
128
+
129
+ ## Stage 3: Dig
130
+
131
+ ### Agent Teams boost (if enabled)
132
+
133
+ ```bash
134
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
135
+ ```
136
+
137
+ **If Agent Teams is enabled**, create a research team (NOT sub-agents):
138
+
139
+ ```
140
+ TeamCreate(team_name: "research-{idea-slug}", description: "Market research for {idea}")
141
+
142
+ TaskCreate(subject: "Market research", description: "TAM/SAM/SOM, growth signals, adjacent markets")
143
+ TaskCreate(subject: "Competitor teardowns", description: "Teardown 3+ competitors, find gaps")
144
+ TaskCreate(subject: "Contrarian analysis", description: "Challenge assumptions, find risks")
145
+
146
+ Agent(
147
+ team_name: "research-{idea-slug}",
148
+ name: "market-researcher",
149
+ subagent_type: "general-purpose",
150
+ prompt: "Research the market for: {idea}. TAM/SAM/SOM, growth signals, adjacent markets.
151
+ Track sources with credibility scores. Check TaskList, claim your task."
152
+ )
153
+
154
+ Agent(
155
+ team_name: "research-{idea-slug}",
156
+ name: "competitor-analyst",
157
+ subagent_type: "general-purpose",
158
+ prompt: "Teardown 3+ competitors for: {idea}. Pricing, features, strengths, weaknesses, gaps.
159
+ Check TaskList, claim your task."
160
+ )
161
+
162
+ Agent(
163
+ team_name: "research-{idea-slug}",
164
+ name: "contrarian",
165
+ subagent_type: "general-purpose",
166
+ prompt: "Challenge assumptions about: {idea}. Find risks, failures in similar ideas, hidden costs.
167
+ Check TaskList, claim your task."
168
+ )
169
+ ```
170
+
171
+ After all teammates report back, `TeamDelete()`, synthesize into a single research doc.
172
+ Skip to step 11 (synthesis) after team reports back.
173
+
174
+ **If Agent Teams is NOT enabled**, run sequentially:
175
+
176
+ 9. Use the `market-research` skill — TAM/SAM/SOM, growth signals, adjacent markets
177
+ 10. Use the `competitive-teardown` skill — at least 3 competitors, strengths, weaknesses, gaps
178
+ 11. Write synthesis:
179
+ - Market: how big, growing or shrinking, who's buying
180
+ - Competitors: what they do well, where they're weak
181
+ - Gap: what's missing that you could own
182
+ - Positioning: how you'd be different (not better — different)
183
+ 12. Save to `02-research/`
184
+
185
+ **GATE 3 — STOP and ask:**
186
+
187
+ Based on findings:
188
+ - **Strong signal**: "Data supports this. Market is [X], main gap is [Y]. Ready to make pitch materials?"
189
+ - **Mixed signal**: "Here's what concerns me: [specific data]. The market is there but [risk]. Still go forward?"
190
+ - **Dead**: "I'd stop here. [specific reason]. The research is saved — might be useful later."
191
+
192
+ ---
193
+
194
+ ## Stage 4: Build
195
+
196
+ 13. Use the `investor-materials` skill — pitch deck outline (10-12 slides)
197
+ 14. Create one-pager (the "leave-behind" doc)
198
+ 15. Use the `investor-outreach` skill — draft 3 email types:
199
+ - Cold email (to investors you don't know)
200
+ - Warm intro blurb (for someone introducing you)
201
+ - Follow-up (after a meeting)
202
+ 16. Cross-check: all numbers match across docs, claims backed by Stage 3 research
203
+ 17. Save to `04-build/`
204
+
205
+ **GATE 4 — STOP and ask:**
206
+ > "Everything's ready. Before you send anything:
207
+ > - Can you defend every number in the deck?
208
+ > - Is the ask clear? (amount, use of funds, timeline)
209
+ > - Who are the first 3 investors you'd send this to?"
210
+
211
+ ---
212
+
213
+ ## File Structure
214
+
215
+ ```
216
+ projects/[idea-name]/
217
+ ├── 01-brainstorm/
218
+ │ └── brainstorm-session-YYYY-MM-DD.md
219
+ ├── 02-research/
220
+ │ ├── market-research-YYYY-MM-DD.md
221
+ │ ├── teardown-competitor-a-YYYY-MM-DD.md
222
+ │ └── teardown-competitor-b-YYYY-MM-DD.md
223
+ ├── 03-validation/
224
+ │ └── validation-report-YYYY-MM-DD.md
225
+ ├── 04-build/
226
+ │ ├── pitch-deck-outline-YYYY-MM-DD.md
227
+ │ ├── one-pager-YYYY-MM-DD.md
228
+ │ └── investor-emails-YYYY-MM-DD.md
229
+ └── README.md
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Combo Shortcuts
235
+
236
+ These still work — they jump into specific stages:
237
+
238
+ | Shortcut | Stages | What happens |
239
+ |----------|--------|-------------|
240
+ | `/spartan:kickoff [theme]` | 1 → 2 | Brainstorm + validate |
241
+ | `/spartan:deep-dive [project]` | 3 | Research + teardowns |
242
+ | `/spartan:fundraise [project]` | 4 | Pitch + outreach |
243
+ | `/spartan:startup [theme]` | 1 → 2 → 3 → 4 | Everything, with gates |
244
+
245
+ ---
246
+
247
+ ## Rules
248
+
249
+ - **You are the leader.** Run brainstorm, validation, research, and pitch skills yourself. Don't tell the user to run separate commands.
250
+ - **Always check for existing work first.** Don't re-do research that's already saved.
251
+ - **Always stop at gates.** This is not a one-shot process.
252
+ - **If the user says "stop" at any gate, stop.** Save progress.
253
+ - **Read prior stage output before starting next stage.**
254
+ - **Killing an idea at Stage 2 is a win.** It saved weeks of wasted work.
255
+ - **The pipeline might take multiple sessions.** That's normal. Each stage saves artifacts so the next session can resume.
256
+ - **Save everything.** Even failed ideas have useful research.
257
+ - **Be honest.** If an idea is weak, say so. Don't let it pass a gate to be polite.