@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,222 @@
1
+ ---
2
+ name: spartan:qa
3
+ description: Run real browser QA on your app using Playwright. Opens Chromium, clicks through flows, finds bugs, and reports issues. Use after building a feature to test it like a real user.
4
+ argument-hint: "[URL or localhost port] [optional: feature to test]"
5
+ ---
6
+
7
+ # Browser QA: {{ args[1] | default: "full app" }}
8
+
9
+ You are running **real browser QA** — not unit tests, not mocks. A real Chromium browser hitting a real running app.
10
+
11
+ **Target:** {{ args[0] | default: "http://localhost:3000" }}
12
+
13
+ ---
14
+
15
+ ## Step 0: Pre-flight Check
16
+
17
+ ```bash
18
+ # Is the app running?
19
+ TARGET="{{ args[0] | default: 'http://localhost:3000' }}"
20
+ curl -s -o /dev/null -w "%{http_code}" "$TARGET" || echo "APP_NOT_RUNNING"
21
+
22
+ # Is Playwright installed?
23
+ npx playwright --version 2>/dev/null || echo "PLAYWRIGHT_MISSING"
24
+ ```
25
+
26
+ **If app not running:**
27
+ > "Your app isn't running at $TARGET. Start it first (`npm run dev` or `./gradlew run`), then re-run `/spartan:qa`."
28
+
29
+ **If Playwright missing:**
30
+ > "Playwright isn't installed. Run `npm install -D @playwright/test && npx playwright install chromium` first."
31
+
32
+ ---
33
+
34
+ ## Step 1: Discover What to Test
35
+
36
+ {% if args[1] %}
37
+ Focus QA on: **{{ args[1] }}**
38
+
39
+ Find the routes and components related to this feature:
40
+ ```bash
41
+ # Find related pages
42
+ find . -path "*/app/**/page.tsx" -o -path "*/pages/**/*.tsx" 2>/dev/null | head -20
43
+
44
+ # Find related API routes
45
+ find . -path "*/app/api/**/route.ts" -o -path "*/pages/api/**/*.ts" 2>/dev/null | head -20
46
+ ```
47
+
48
+ Build a test plan for this specific feature.
49
+ {% else %}
50
+ No specific feature given — run a **full smoke test**.
51
+
52
+ Discover all routes:
53
+ ```bash
54
+ # Next.js App Router pages
55
+ find . -path "*/app/**/page.tsx" -not -path "*/node_modules/*" 2>/dev/null | sort
56
+
57
+ # Next.js Pages Router
58
+ find . -path "*/pages/**/*.tsx" -not -path "*/node_modules/*" -not -name "_*" 2>/dev/null | sort
59
+
60
+ # API routes
61
+ find . -path "*/app/api/**/route.ts" -o -path "*/pages/api/**/*.ts" 2>/dev/null | sort
62
+ ```
63
+
64
+ Build a test plan that hits every discoverable page.
65
+ {% endif %}
66
+
67
+ ### Test Plan Format
68
+
69
+ Before testing, show the plan:
70
+
71
+ ```
72
+ QA Plan: [feature or "full smoke"]
73
+ Target: [URL]
74
+
75
+ Flows to test:
76
+ 1. [Page/flow name] — [what to check]
77
+ 2. [Page/flow name] — [what to check]
78
+ 3. ...
79
+
80
+ Checks per page:
81
+ - Page loads without console errors
82
+ - No broken images or missing assets
83
+ - Interactive elements respond (buttons, links, forms)
84
+ - Mobile viewport doesn't break layout
85
+ - API calls return 2xx
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Step 2: Run QA Tests
91
+
92
+ Use Playwright to test each flow. Write and run tests inline:
93
+
94
+ ```typescript
95
+ import { chromium } from 'playwright'
96
+
97
+ const browser = await chromium.launch({ headless: true })
98
+ const context = await browser.newContext({
99
+ viewport: { width: 1280, height: 720 },
100
+ })
101
+ const page = await context.newPage()
102
+
103
+ // Collect console errors
104
+ const consoleErrors: string[] = []
105
+ page.on('console', msg => {
106
+ if (msg.type() === 'error') consoleErrors.push(msg.text())
107
+ })
108
+
109
+ // Collect failed network requests
110
+ const networkErrors: string[] = []
111
+ page.on('requestfailed', req => {
112
+ networkErrors.push(`${req.method()} ${req.url()} — ${req.failure()?.errorText}`)
113
+ })
114
+
115
+ // Test each flow...
116
+ await page.goto('TARGET_URL')
117
+ // [test logic here]
118
+
119
+ await browser.close()
120
+ ```
121
+
122
+ ### What to Check on Every Page
123
+
124
+ 1. **Console errors** — collect all `console.error` messages
125
+ 2. **Network failures** — any 4xx/5xx responses or failed requests
126
+ 3. **Missing assets** — broken images, failed CSS/JS loads
127
+ 4. **Layout issues** — check at 1280px and 375px (mobile) viewports
128
+ 5. **Interactive elements** — click buttons, fill forms, check they respond
129
+ 6. **Navigation** — links go where they should, no dead ends
130
+
131
+ ### What to Check for Specific Features
132
+
133
+ - **Forms:** Submit with valid data → success. Submit empty → validation shows.
134
+ - **Auth flows:** Login → redirect to dashboard. Protected page → redirect to login.
135
+ - **CRUD:** Create → appears in list. Edit → shows updated. Delete → gone from list.
136
+ - **Search/filter:** Type → results update. Clear → back to full list.
137
+
138
+ ---
139
+
140
+ ## Step 3: Report Findings
141
+
142
+ After testing, produce a QA report:
143
+
144
+ ```markdown
145
+ ## QA Report: [feature or "full smoke"]
146
+ Date: [today]
147
+ Target: [URL]
148
+
149
+ ### Summary
150
+ - Pages tested: [N]
151
+ - Bugs found: [N]
152
+ - Warnings: [N]
153
+ - All clear: [N pages with no issues]
154
+
155
+ ### Bugs (fix these)
156
+
157
+ #### BUG-1: [title]
158
+ - **Page:** [URL]
159
+ - **Steps:** [how to reproduce]
160
+ - **Expected:** [what should happen]
161
+ - **Actual:** [what happened]
162
+ - **Severity:** [blocker / major / minor]
163
+ - **Fix suggestion:** [if obvious]
164
+
165
+ ### Warnings (review these)
166
+
167
+ #### WARN-1: [title]
168
+ - **Page:** [URL]
169
+ - **Issue:** [what's not ideal]
170
+ - **Suggestion:** [how to improve]
171
+
172
+ ### Passed
173
+ - [page] — all checks passed
174
+ - [page] — all checks passed
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Step 4: Auto-Fix (when possible)
180
+
181
+ For simple issues, offer to fix them right away:
182
+
183
+ **Auto-fixable:**
184
+ - Missing alt text on images
185
+ - Console errors from missing env vars
186
+ - Broken internal links (wrong href)
187
+ - Missing viewport meta tag
188
+ - Unclosed HTML tags
189
+
190
+ **NOT auto-fixable (just report):**
191
+ - Layout bugs (need design decision)
192
+ - Logic errors (need understanding of intent)
193
+ - Performance issues (need profiling)
194
+ - API errors (need backend investigation)
195
+
196
+ For each auto-fixable bug:
197
+ > "BUG-1 is auto-fixable. Want me to fix it? [Y/n]"
198
+
199
+ Fix one at a time. Re-run that specific check after each fix to verify.
200
+
201
+ ---
202
+
203
+ ## Step 5: Next Steps
204
+
205
+ After the report, suggest:
206
+
207
+ - Bugs found → "Want me to fix these? I'll go one by one."
208
+ - All clear → "QA passed. Ready for `/spartan:pr-ready`."
209
+ - Need deeper testing → "For E2E test coverage, run `/spartan:e2e` to scaffold permanent Playwright tests."
210
+
211
+ ---
212
+
213
+ ## Rules
214
+
215
+ 1. **Always check if the app is running first.** Don't waste time if there's nothing to test.
216
+ 2. **Real browser only.** No curl-based testing. No mock browsers. Playwright with real Chromium.
217
+ 3. **Headless by default.** Don't pop up browser windows unless user asks for `--headed`.
218
+ 4. **Report ALL issues found.** Don't stop at the first bug.
219
+ 5. **Mobile viewport is not optional.** Always check at 375px width.
220
+ 6. **Console errors are bugs.** Even if the page "looks fine," console errors need fixing.
221
+ 7. **Auto-fix only with permission.** Show the fix, ask before applying.
222
+ 8. **This is a one-shot run.** No persistent daemon. Spin up browser, test, close, done.
@@ -0,0 +1,254 @@
1
+ ---
2
+ name: spartan:research
3
+ description: "Deep research on any topic — frame the question, gather sources, analyze, and produce a structured report"
4
+ argument-hint: "[topic to research]"
5
+ ---
6
+
7
+ # Research: {{ args[0] | default: "your topic" }}
8
+
9
+ You are running the **Research workflow** — turn a question into an actionable report backed by real sources.
10
+
11
+ ```
12
+ STAGE 1: FRAME STAGE 2: GATHER STAGE 3: ANALYZE STAGE 4: REPORT
13
+ ────────────── ────────────── ──────────────── ───────────────
14
+ Sharpen the question Web search (multiple) Cross-reference Structured report
15
+ What's useful output? Read sources Patterns + contradictions Key findings
16
+ Source strategy Track credibility Form a clear view Recommendations
17
+
18
+ Gate 1 Gate 2 Gate 3
19
+ "Right question?" "Key findings so far" "Full report"
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Style
25
+
26
+ Be direct. Give options with your honest take. Pick a side — never say "it depends" without choosing. No filler.
27
+
28
+ ---
29
+
30
+ ## Stage 1: Frame
31
+
32
+ **Goal:** Turn a vague topic into a specific, answerable question.
33
+
34
+ ### Sharpen the question
35
+ The user's topic is probably too broad. Narrow it:
36
+
37
+ | Too broad | Better |
38
+ |-----------|--------|
39
+ | "AI dev tools" | "Which AI coding assistants have >10k paying users and why?" |
40
+ | "competitor landscape" | "Who are the top 5 competitors in [space], what do they charge, and where are the gaps?" |
41
+ | "market for X" | "How big is the [X] market, who's buying, and is it growing?" |
42
+
43
+ ### Define useful output
44
+ Ask: "What would a useful answer look like?"
45
+
46
+ Options:
47
+ - **Comparison table** — if comparing things (competitors, tools, approaches)
48
+ - **Number + context** — if sizing a market or measuring something
49
+ - **Recommendation** — if deciding between options
50
+ - **Landscape map** — if understanding a space
51
+
52
+ ### Pick source strategy
53
+
54
+ | Research type | Best sources |
55
+ |---------------|-------------|
56
+ | Market sizing | Industry reports, investor decks, public filings |
57
+ | Competitor analysis | Product pages, pricing pages, reviews, job postings |
58
+ | Tech evaluation | Docs, GitHub repos, benchmarks, community forums |
59
+ | Trend research | News, social media, conference talks, funding announcements |
60
+ | Academic/deep | Papers, books, expert blogs |
61
+
62
+ **GATE 1 — STOP and ask:**
63
+ > "Here's how I'd frame the research:
64
+ > - Question: [specific question]
65
+ > - Output format: [table/number/recommendation/map]
66
+ > - Sources: [what I'll search for]
67
+ >
68
+ > Right direction, or should I adjust the focus?"
69
+ >
70
+ > **Auto mode on?** → Show framing, continue immediately.
71
+
72
+ ---
73
+
74
+ ## Stage 2: Gather
75
+
76
+ **Goal:** Find real data from real sources. Track everything.
77
+
78
+ ### Agent Teams boost (if enabled)
79
+
80
+ ```bash
81
+ echo "${CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS:-not_set}"
82
+ ```
83
+
84
+ **If Agent Teams is enabled**, create a research team (NOT sub-agents):
85
+
86
+ ```
87
+ TeamCreate(team_name: "research-{topic-slug}", description: "Research: {topic}")
88
+
89
+ TaskCreate(subject: "Breadth search", description: "Run direct + alternative + adjacent queries, collect 8-15 sources with credibility scores")
90
+ TaskCreate(subject: "Depth analysis", description: "Deep dive on top 3-5 sources from breadth search")
91
+ TaskCreate(subject: "Contrarian search", description: "Find counterarguments, failures, criticism")
92
+
93
+ Agent(
94
+ team_name: "research-{topic-slug}",
95
+ name: "breadth-researcher",
96
+ subagent_type: "general-purpose",
97
+ prompt: "Search broadly for: {topic}. Run direct + alternative + adjacent queries.
98
+ Collect 8-15 sources. Track each with: title, URL, credibility (1-5), key data points.
99
+ Check TaskList, claim your task. Message depth-researcher when you have initial findings."
100
+ )
101
+
102
+ Agent(
103
+ team_name: "research-{topic-slug}",
104
+ name: "depth-researcher",
105
+ subagent_type: "general-purpose",
106
+ prompt: "Go deep on the top 3-5 sources for: {topic}.
107
+ Extract detailed data, cross-reference claims, note contradictions.
108
+ Check TaskList, claim your task. Wait for breadth-researcher findings if needed."
109
+ )
110
+
111
+ Agent(
112
+ team_name: "research-{topic-slug}",
113
+ name: "contrarian-researcher",
114
+ subagent_type: "general-purpose",
115
+ prompt: "Find counterarguments and criticism for: {topic}.
116
+ Search for failures, risks, overhyped claims, hidden costs.
117
+ Check TaskList, claim your task."
118
+ )
119
+ ```
120
+
121
+ After all teammates report back, merge source lists, `TeamDelete()`, continue to Stage 3 (Analyze).
122
+
123
+ **If Agent Teams is NOT enabled**, gather sequentially:
124
+
125
+ ### Search strategy
126
+ Use the `deep-research` skill. Run multiple search queries — not just one:
127
+
128
+ 1. **Direct query** — the obvious search
129
+ 2. **Alternative framing** — same question, different words
130
+ 3. **Adjacent query** — related topic that might have useful data
131
+ 4. **Contrarian query** — "why [topic] is wrong/failing/overhyped"
132
+
133
+ ### For each source found, track:
134
+
135
+ ```markdown
136
+ **Source:** [title]
137
+ **URL:** [link]
138
+ **Credibility:** [1-5, where 5 = primary data/official, 1 = random blog]
139
+ **Key data points:**
140
+ - [fact 1]
141
+ - [fact 2]
142
+ **Notes:** [anything to flag — bias, outdated, contradicts other sources]
143
+ ```
144
+
145
+ ### Source credibility rules
146
+ - **5 — Primary data:** Company filings, official announcements, published research with methodology
147
+ - **4 — Expert source:** Industry analyst, domain expert blog, respected publication
148
+ - **3 — Good secondary:** Tech publication, well-sourced article, community consensus
149
+ - **2 — Weak secondary:** Random blog, social media opinion, anonymous source
150
+ - **1 — Unreliable:** Unsourced claims, obvious bias, marketing material presented as research
151
+
152
+ **Don't stop at 3 sources.** Aim for 8-15 depending on topic size. More sources = more signal.
153
+
154
+ **No gate here — continue to Analyze.** But if the data is thin, say so:
155
+ > "I found limited data on this. Here's what exists: [X]. Want me to dig in a different direction?"
156
+
157
+ ---
158
+
159
+ ## Stage 3: Analyze
160
+
161
+ **Goal:** Turn raw data into insight. Form a view.
162
+
163
+ ### Cross-reference
164
+ - Do multiple sources agree? That's stronger signal.
165
+ - Do sources contradict? Flag it — and say which you trust more and why.
166
+ - Is there a pattern across sources that none of them call out directly?
167
+
168
+ ### Separate fact from opinion
169
+ For every claim in your notes, tag it:
170
+ - **FACT** — backed by data, multiple sources agree
171
+ - **LIKELY** — strong signal but not confirmed
172
+ - **OPINION** — one source's view, not proven
173
+ - **CONTESTED** — sources disagree
174
+
175
+ ### Form a view
176
+ Don't be neutral. After analyzing the data, take a position:
177
+ - "The data says [X]."
178
+ - "Most sources agree on [Y] but I think [Z] is more accurate because [evidence]."
179
+ - "There's not enough data to be confident, but the best guess is [W]."
180
+
181
+ **GATE 2 — STOP and ask:**
182
+ > "Here's what I found:
183
+ > - [Key finding 1]
184
+ > - [Key finding 2]
185
+ > - [Key finding 3]
186
+ > - Surprise: [something unexpected]
187
+ >
188
+ > Want the full report, or should I dig deeper on any of these?"
189
+ >
190
+ > **Auto mode on?** → Show findings, continue to report.
191
+
192
+ ---
193
+
194
+ ## Stage 4: Report
195
+
196
+ **Goal:** Structured, actionable document. No filler.
197
+
198
+ ### Report format
199
+
200
+ ```markdown
201
+ # Research Report: [topic]
202
+ Date: [YYYY-MM-DD]
203
+
204
+ ## Question
205
+ [The specific, sharpened question from Stage 1]
206
+
207
+ ## Key Findings
208
+ 1. [Most important finding — one paragraph]
209
+ 2. [Second finding]
210
+ 3. [Third finding]
211
+
212
+ ## Analysis
213
+
214
+ ### [Section based on question type]
215
+ [Deep analysis with data. Every claim linked to a source.]
216
+
217
+ ### What the data doesn't tell us
218
+ [Gaps in the research. What you couldn't find or confirm.]
219
+
220
+ ### Surprises
221
+ [Anything unexpected that changes the picture.]
222
+
223
+ ## Recommendation
224
+ [Clear, actionable recommendation. Not "it depends."]
225
+ [If the user needs to make a decision, pick a side and explain why.]
226
+
227
+ ## Sources
228
+ | # | Source | Credibility | Key contribution |
229
+ |---|--------|-------------|-----------------|
230
+ | 1 | [name + URL] | [1-5] | [what it provided] |
231
+ | 2 | ... | ... | ... |
232
+
233
+ ## Methodology
234
+ [What you searched for, how many sources reviewed, what was excluded and why]
235
+ ```
236
+
237
+ ### Save the report
238
+ If a project folder exists → save to `02-research/research-[topic-slug]-YYYY-MM-DD.md`
239
+ If no project folder → save to current directory or ask where.
240
+
241
+ **GATE 3 — Done.**
242
+ > "Report saved to [path]. Key takeaway: [one sentence]. Want me to go deeper on anything, or use this for something? (e.g., `/spartan:content` to turn it into a blog post)"
243
+
244
+ ---
245
+
246
+ ## Rules
247
+
248
+ - **Sharpen the question first.** A vague question gets a vague answer. Always narrow it at Stage 1.
249
+ - **Track credibility.** Not all sources are equal. Say which you trust and why.
250
+ - **Take a position.** "The data suggests..." is better than "there are many perspectives."
251
+ - **Flag what you don't know.** Honest gaps are better than padded content.
252
+ - **Aim for 8-15 sources.** Less than 5 is usually too thin. More than 20 is diminishing returns.
253
+ - **No filler.** Every sentence should add information. If you can cut a paragraph without losing meaning, cut it.
254
+ - **Separate facts from opinions.** Label them. The reader needs to know what's proven vs. guessed.
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: spartan:review
3
+ description: Perform a thorough PR review using your project's configured rules
4
+ argument-hint: "[optional: branch name or PR description]"
5
+ ---
6
+
7
+ # Code Review: {{ args[0] | default: "current changes" }}
8
+
9
+ Perform a thorough review of the current changes. Use `git diff` to inspect all modified files.
10
+
11
+ ---
12
+
13
+ ## Step 0: Load rules
14
+
15
+ ```bash
16
+ # 1. Check for project config
17
+ cat .spartan/config.yaml 2>/dev/null || cat ~/.spartan/config.yaml 2>/dev/null
18
+
19
+ # 2. Classify changed files
20
+ git diff main...HEAD --name-only
21
+ ```
22
+
23
+ **If `.spartan/config.yaml` exists:**
24
+ - Read `rules.backend`, `rules.frontend`, `rules.shared` — these are the rules to check against
25
+ - Read `file-types` — use these to classify changed files into backend/frontend/migration
26
+ - Read `review-stages` — only run enabled stages
27
+ - If `extends` is set, load the base profile, then apply `rules-add`/`rules-remove`/`rules-override`
28
+ - If `conditional-rules` is set, match rules to changed files by glob pattern
29
+
30
+ **If no config — auto-generate from installed packs:**
31
+
32
+ ```bash
33
+ cat .claude/.spartan-packs 2>/dev/null || cat ~/.claude/.spartan-packs 2>/dev/null
34
+ ```
35
+
36
+ If packs file exists, generate config from the matching profile (same logic as `/spartan:build` Step 1). Copy the profile to `.spartan/config.yaml` and tell the user it was generated.
37
+
38
+ **If no packs file either (bare fallback):**
39
+ - Scan `rules/` for all `.md` files, group by subdirectory
40
+ - If no `rules/`, check `.claude/rules/` then `~/.claude/rules/`
41
+ - Use all stages below
42
+ - Classify files by extension: `.kt/.java/.go/.py` = backend, `.tsx/.ts/.vue` = frontend, `.sql` = migration
43
+
44
+ **Read all matched rule files** before reviewing any code. These are the source of truth.
45
+
46
+ ---
47
+
48
+ ## Review Checklist
49
+
50
+ Run each enabled stage. Skip stages that are disabled in the config.
51
+
52
+ ### Stage 1: Correctness & Business Logic
53
+ - [ ] Does the code match the stated requirements/ticket?
54
+ - [ ] Are all edge cases handled?
55
+ - [ ] Is error handling following the project's pattern? (check the loaded rules)
56
+ - [ ] Are there any banned patterns? (check the loaded rules for forbidden items)
57
+
58
+ ### Stage 2: Stack Conventions
59
+ - [ ] Code follows the patterns in the loaded rule files
60
+ - [ ] Stack idioms are correct for this language/framework
61
+ - [ ] Naming conventions match the project style (check NAMING rules if loaded)
62
+
63
+ ### Stage 3: Test Coverage
64
+ - [ ] New code has tests
65
+ - [ ] Tests are independent (no test order dependencies)
66
+ - [ ] Edge cases are tested
67
+ - [ ] Tests verify behavior, not implementation details
68
+
69
+ ### Stage 4: Clean Code & Architecture
70
+ - [ ] Architecture matches what the config says (layered, hexagonal, clean, mvc, etc.)
71
+ - [ ] No business logic in the wrong layer (check loaded arch rules)
72
+ - [ ] No cyclic dependencies between packages/modules
73
+ - [ ] Functions are small and single-purpose
74
+
75
+ ### Stage 5: Database & API
76
+ - [ ] Schema follows the loaded database rules (if any)
77
+ - [ ] API design follows the loaded API rules (if any)
78
+ - [ ] Input validation on all public endpoints
79
+ - [ ] No sensitive data logged or exposed
80
+
81
+ ### Stage 6: Security
82
+ - [ ] Auth checks present where needed
83
+ - [ ] Input validated and sanitized
84
+ - [ ] No injection risks (SQL, XSS, command injection)
85
+ - [ ] No sensitive data in logs or error responses
86
+ - [ ] No hardcoded secrets or credentials
87
+
88
+ ### Stage 7: Documentation Gap Analysis
89
+ After reviewing, check if any patterns should be documented:
90
+ - [ ] New pattern used that isn't in the rules yet? → flag for rules update
91
+ - [ ] New convention established? → flag for `.memory/patterns/` or new rule file
92
+ - [ ] Recurring issue? → suggest creating a rule so it gets caught automatically
93
+
94
+ ---
95
+
96
+ ## Output Format
97
+
98
+ ```
99
+ ## PR Review Summary
100
+
101
+ ### Approved / Needs Changes / Blocked
102
+
103
+ ### Rules Checked
104
+ - [list of rule files that were loaded and checked against]
105
+
106
+ ### Critical Issues (must fix)
107
+ - [issue with file:line reference and which rule it breaks]
108
+
109
+ ### Suggestions (nice to have)
110
+ - [suggestion]
111
+
112
+ ### Praise (what was done well)
113
+ - [positive note]
114
+
115
+ ### Documentation Updates Needed
116
+ - [rule file or .memory/ path]: [what to add/update] — OR "none"
117
+
118
+ ### Verdict
119
+ [Final recommendation]
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Rules
125
+
126
+ - Always use `git diff` to inspect actual changes — don't guess from filenames
127
+ - Read rule files from config BEFORE reviewing code — they're the source of truth
128
+ - Every finding must include file:line reference
129
+ - Every finding must cite which rule it breaks (or which checklist item)
130
+ - Separate "must fix" from "nice to have" — don't block PRs on style nits
131
+ - Praise good code — reviews aren't just for finding problems
132
+ - If no config and no rules found, still review using the generic checklist above