@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,65 @@
1
+ # Common Service Issues — Quick Reference
2
+
3
+ > This file is referenced by SKILL.md. Skim it when investigating a bug to see if it matches a known pattern.
4
+
5
+ ## Database Issues
6
+
7
+ ### "Connection pool exhausted"
8
+ **Cause:** Tests or code not returning connections, or pool too small for load.
9
+ **Fix:** Increase `maxPoolSize` in config. Check for leaked connections (queries without proper transaction blocks).
10
+
11
+ ### "Column X does not exist"
12
+ **Cause:** Migration not applied, or table definition doesn't match the Kotlin code.
13
+ **Fix:** Run `./gradlew flywayMigrate`. Compare SQL column names with Kotlin Table object.
14
+
15
+ ### "Unique constraint violation"
16
+ **Cause:** Trying to insert a duplicate value on a unique index.
17
+ **Fix:** Check if the record exists first, or use upsert pattern. Remember: soft-deleted records might not violate the constraint if the unique index has `WHERE deleted_at IS NULL`.
18
+
19
+ ### Query returns no results but data exists
20
+ **Cause:** Missing `deletedAt.isNull()` filter, wrong join condition, or querying the wrong database (replica lag).
21
+ **Fix:** Check the query for soft-delete filter. If using replica, check if the write has propagated.
22
+
23
+ ---
24
+
25
+ ## API Issues
26
+
27
+ ### 401 on every request
28
+ **Cause:** Token expired, wrong auth header format, or @Secured misconfiguration.
29
+ **Fix:** Check token expiry. Verify header is `Authorization: Bearer <token>`. Check controller has correct @Secured annotation.
30
+
31
+ ### 400 with no helpful message
32
+ **Cause:** Jackson deserialization failure — field name mismatch between JSON and Kotlin DTO.
33
+ **Fix:** Check if frontend sends `snake_case` but Kotlin expects `camelCase` (or vice versa). Verify Jackson SNAKE_CASE naming strategy is configured.
34
+
35
+ ### Endpoint returns empty list but data exists
36
+ **Cause:** Query filter too strict, wrong field comparison, or soft-delete filtering out results.
37
+ **Fix:** Check the manager query logic. Run the equivalent SQL directly to see what comes back.
38
+
39
+ ---
40
+
41
+ ## Build Issues
42
+
43
+ ### "error.NonExistentClass" in kapt
44
+ **Cause:** Retrofit client interface in a module with kapt enabled.
45
+ **Fix:** Move Retrofit interfaces to `module-client` (no kapt). See RETROFIT_PLACEMENT rule.
46
+
47
+ ### Tests pass locally but fail in CI
48
+ **Cause:** Different database state, missing env vars, or timezone differences.
49
+ **Fix:** Check CI environment variables match local `.env`. Ensure tests clean up after themselves (`truncateAllTables` in @BeforeEach).
50
+
51
+ ### Flyway migration fails
52
+ **Cause:** Migration number conflicts, or trying to modify an already-applied migration.
53
+ **Fix:** Never edit deployed migrations. Create a new migration with the next sequence number. Check `flyway_schema_history` table for applied migrations.
54
+
55
+ ---
56
+
57
+ ## Performance Issues
58
+
59
+ ### Endpoint suddenly slow (>1s)
60
+ **Cause:** Missing database index, N+1 query, or full table scan.
61
+ **Fix:** Run `EXPLAIN ANALYZE` on the slow query. Add indexes for columns in WHERE/JOIN clauses. Check for loops that query the database per item.
62
+
63
+ ### Memory growing over time
64
+ **Cause:** Leaked connections, growing caches without eviction, or large result sets loaded into memory.
65
+ **Fix:** Check connection pool metrics. Review cache configurations. Use pagination for large queries (never `findAll()` without limit).
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: startup-pipeline
3
+ description: "Coordinates the full startup idea pipeline from brainstorm to investor outreach. Use when the user starts a new idea project, asks for the 'full pipeline', or references stages/gates."
4
+ allowed_tools:
5
+ - WebSearch
6
+ - Read
7
+ ---
8
+
9
+ # Startup Pipeline
10
+
11
+ The full flow for taking an idea from zero to investor-ready.
12
+
13
+ ## The Pipeline
14
+
15
+ ```
16
+ STAGE 1: DISCOVER STAGE 2: FILTER STAGE 3: DIG STAGE 4: BUILD
17
+ ───────────────── ─────────────── ───────────── ──────────────
18
+ /brainstorm /validate /research /pitch
19
+ /teardown /outreach
20
+ /content
21
+
22
+ Generate ideas ──► Kill bad ones fast ──► Go deep on survivors ──► Make materials
23
+ 8-15 ideas GO / TEST / PASS Market + competitors Deck, memo, emails
24
+ Pick top 3 Need data? Move on Real numbers Ready to send
25
+
26
+ 📁 01-brainstorm/ 📁 03-validation/ 📁 02-research/ 📁 04-build/
27
+ ```
28
+
29
+ ## Setup
30
+
31
+ On first run, check for a `config.json` in the project root. If it doesn't exist, ask the user and create one:
32
+
33
+ ```json
34
+ {
35
+ "projectName": "my-idea",
36
+ "outputDir": "projects/my-idea",
37
+ "defaultAudience": "B2B SaaS founders",
38
+ "fundingGoal": "bootstrap",
39
+ "currentStage": 1
40
+ }
41
+ ```
42
+
43
+ Update `currentStage` as the user progresses through gates. This lets the pipeline resume across sessions.
44
+
45
+ ## Stage Gates
46
+
47
+ Each stage has a gate. Don't move forward unless you pass.
48
+
49
+ ### Gate 1: Worth Testing?
50
+ After brainstorm, you need at least 1 idea where:
51
+ - The problem is real (people feel pain)
52
+ - You can build a v1 in 2 weeks
53
+ - You know who the user is
54
+
55
+ If none pass → brainstorm again or pick a new space.
56
+
57
+ ### Gate 2: Worth Researching?
58
+ After validation, you need:
59
+ - Verdict: **GO** or **TEST MORE**
60
+ - At least some demand signal (people search for it, pay for alternatives, complain online)
61
+ - No obvious killer (market too small, already dominated, illegal)
62
+
63
+ If PASS → stop here. Move to next idea.
64
+ If TEST MORE → do one cheap test first, then re-validate.
65
+
66
+ ### Gate 3: Worth Building?
67
+ After deep research, you need:
68
+ - Market big enough (>$100M TAM for VC, >$1M for bootstrap)
69
+ - Clear gap in competitors (something nobody does well)
70
+ - Realistic distribution path (you can get first 100 users)
71
+ - You understand the customer better than before
72
+
73
+ If no → archive the project. Save the research for later.
74
+
75
+ ### Gate 4: Ready to Send?
76
+ After pitch materials, check:
77
+ - All numbers match across docs
78
+ - Claims are backed by your research
79
+ - You can answer tough questions about each slide
80
+ - The ask is clear
81
+
82
+ ## File Naming
83
+
84
+ Each stage saves files with a prefix so they stay sorted:
85
+
86
+ ```
87
+ projects/my-idea/
88
+ ├── 01-brainstorm/
89
+ │ └── brainstorm-session-2026-03-02.md
90
+ ├── 02-research/
91
+ │ ├── market-research-2026-03-03.md
92
+ │ ├── teardown-competitor-a-2026-03-03.md
93
+ │ └── teardown-competitor-b-2026-03-03.md
94
+ ├── 03-validation/
95
+ │ └── validation-report-2026-03-02.md
96
+ ├── 04-build/
97
+ │ ├── pitch-deck-outline-2026-03-04.md
98
+ │ ├── one-pager-2026-03-04.md
99
+ │ └── investor-emails-2026-03-04.md
100
+ └── README.md
101
+ ```
102
+
103
+ ## How Combo Commands Map
104
+
105
+ | Combo | Stages | What happens |
106
+ |-------|--------|-------------|
107
+ | `/kickoff [theme]` | 1 → 2 | Brainstorm + validate top ideas |
108
+ | `/deep-dive [project]` | 3 | Research + teardown competitors |
109
+ | `/fundraise [project]` | 4 | Pitch materials + outreach drafts |
110
+ | `/startup [theme]` | 1 → 2 → 3 → 4 | Everything, with pauses at each gate |
111
+
112
+ ## Interaction Style
113
+
114
+ **No BS. Honest feedback only.**
115
+
116
+ This is a two-way talk:
117
+ - I ask you questions → you answer
118
+ - You ask me questions → I think hard, give you options, then answer
119
+
120
+ **When I ask you a question, I always:**
121
+ 1. Think about it first
122
+ 2. Give you 2-3 options with my honest take on each
123
+ 3. Tell you which one I'd pick and why
124
+ 4. Then ask what you think
125
+
126
+ **When you ask me something:**
127
+ - I give you a straight answer
128
+ - I tell you if an idea should die at the gate
129
+ - I don't let you skip ahead just because you're excited
130
+
131
+ **Never:**
132
+ - Ask a question without giving options
133
+ - Let a weak idea pass a gate to be nice
134
+ - Say "it depends" without picking a side
135
+ - Skip the gate check
136
+ - Pretend every idea deserves Stage 4
137
+
138
+ ## Gotchas
139
+
140
+ - **Don't let excitement skip gates.** Users will want to jump from brainstorm to pitch deck. The gates exist to kill bad ideas early -- enforce them.
141
+ - **"TEST MORE" is the most common verdict, not GO.** Most ideas need cheap validation before deep research. Don't treat the pipeline as a straight path.
142
+ - **Stage 3 kills are normal and healthy.** Finding out a market is too small during research is a success, not a failure. You saved weeks of building.
143
+ - **Pipeline files get stale.** If the user comes back after a week, re-read all prior stage files before continuing. Context drifts fast.
144
+ - **One idea at a time through stages 3-4.** Brainstorm many, validate a few, but only deep-dive one at a time. Parallel research = shallow research.
145
+
146
+ ## Rules
147
+
148
+ - Always pause at gates. Don't skip ahead.
149
+ - Each stage builds on the last. Read prior work first.
150
+ - If you're at Stage 3 and find a killer, be honest. Move to archive.
151
+ - The pipeline saves time by killing bad ideas early.
152
+ - Not every idea reaches Stage 4. That's the point.
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: terraform-best-practices
3
+ description: Quick reference for Terraform conventions including file organization, naming, modules, state, security, and anti-patterns. Use when writing or reviewing Terraform code.
4
+ ---
5
+
6
+ # Terraform Best Practices — Quick Reference
7
+
8
+ ## File Organization
9
+
10
+ ```
11
+ terraform/
12
+ live/ # Orchestration — providers, backend, module calls
13
+ terraform.tf # backend + provider (ONLY place for providers)
14
+ variables.tf # all input variables
15
+ locals.tf # computed values, remote state refs
16
+ outputs.tf # exported values
17
+ {resource-group}.tf # module invocations grouped by concern
18
+ modules/{name}/ # Reusable — no providers, no hardcoded values
19
+ main.tf # locals, data sources
20
+ variables.tf # inputs with descriptions + types
21
+ outputs.tf # consumed values only
22
+ versions.tf # required_providers
23
+ {resource}.tf # one file per resource type
24
+ envs/{env}/ # Per-environment config
25
+ state.config # backend partial config
26
+ terraform.tfvars # non-sensitive values
27
+ secrets.tfvars # sensitive values (gitignored)
28
+ ```
29
+
30
+ ## Naming
31
+
32
+ | Thing | Convention | Example |
33
+ |-------|-----------|---------|
34
+ | Resource prefix | `{project}-{service}-{env}` | `acme-payments-prod` |
35
+ | Variables | `snake_case` | `instance_class` |
36
+ | Locals | `snake_case` | `name_prefix` |
37
+ | Outputs | `snake_case` | `repository_url` |
38
+ | Resources | `this` (primary) or descriptive | `aws_db_instance.this` |
39
+ | Security groups | `name_prefix` (not `name`) | `"${local.name_prefix}-app-"` |
40
+ | Files | `{resource-type}.tf` | `rds.tf`, `sg.tf`, `ecr.tf` |
41
+ | Modules | `kebab-case` directory | `modules/ecs-service/` |
42
+ | Tags | PascalCase keys | `Project`, `Environment`, `ManagedBy` |
43
+
44
+ ## Module Patterns
45
+
46
+ Use modules from the [c0x12c Terraform Registry](https://registry.terraform.io/namespaces/c0x12c).
47
+ Each module source follows `c0x12c/{name}/aws` — see the registry for available modules and versions.
48
+
49
+ ```hcl
50
+ # Calling a registry module — always version-pin
51
+ module "database" {
52
+ source = "c0x12c/rds/aws"
53
+ version = "~> 0.6.6"
54
+
55
+ name = "${local.name_prefix}-db"
56
+ vpc_id = local.vpc_id
57
+ subnet_ids = local.private_subnet_ids
58
+ tags = local.common_tags
59
+ }
60
+
61
+ # Inside a module — no provider, explicit interface
62
+ # versions.tf
63
+ terraform {
64
+ required_version = ">= 1.5.0"
65
+ required_providers {
66
+ aws = {
67
+ source = "hashicorp/aws"
68
+ version = ">= 5.0"
69
+ }
70
+ }
71
+ }
72
+
73
+ # variables.tf — every var has description + type
74
+ variable "name" {
75
+ description = "Resource name prefix"
76
+ type = string
77
+ }
78
+
79
+ # outputs.tf — only what consumers need
80
+ output "endpoint" {
81
+ description = "Connection endpoint"
82
+ value = aws_db_instance.this.endpoint
83
+ }
84
+ ```
85
+
86
+ ## State Management
87
+
88
+ ```hcl
89
+ # Backend config — S3 + DynamoDB locking
90
+ terraform {
91
+ backend "s3" {}
92
+ }
93
+
94
+ # envs/dev/state.config
95
+ bucket = "{project}-terraform-state"
96
+ key = "{service}/dev/terraform.tfstate"
97
+ region = "us-east-1"
98
+ dynamodb_table = "{project}-terraform-locks"
99
+ encrypt = true
100
+
101
+ # Init with partial config
102
+ # terraform init -backend-config=../envs/dev/state.config
103
+ ```
104
+
105
+ ```hcl
106
+ # Remote state for cross-stack references
107
+ data "terraform_remote_state" "infra" {
108
+ backend = "s3"
109
+ config = {
110
+ bucket = "{project}-terraform-state"
111
+ key = "infra/terraform.tfstate"
112
+ region = var.region
113
+ }
114
+ }
115
+
116
+ locals {
117
+ vpc_id = data.terraform_remote_state.infra.outputs.vpc_id
118
+ }
119
+ ```
120
+
121
+ ## Security Checklist
122
+
123
+ ```hcl
124
+ # Sensitive variables
125
+ variable "db_password" {
126
+ type = string
127
+ sensitive = true
128
+ }
129
+
130
+ # S3 — block public, encrypt, version
131
+ module "s3" {
132
+ versioning = true
133
+ server_side_encryption = { sse_algorithm = "aws:kms" }
134
+ block_public_access = {
135
+ block_public_acls = true
136
+ block_public_policy = true
137
+ ignore_public_acls = true
138
+ restrict_public_buckets = true
139
+ }
140
+ }
141
+
142
+ # RDS — encrypt, private subnet, protect
143
+ resource "aws_db_instance" "this" {
144
+ storage_encrypted = true
145
+ deletion_protection = var.env == "prod"
146
+ publicly_accessible = false # ALWAYS false
147
+ }
148
+
149
+ # Security groups — source SG, not CIDR
150
+ resource "aws_security_group_rule" "app_to_db" {
151
+ source_security_group_id = aws_security_group.app.id # not cidr_blocks
152
+ from_port = 5432
153
+ to_port = 5432
154
+ }
155
+
156
+ # Default tags at provider level
157
+ provider "aws" {
158
+ default_tags {
159
+ tags = {
160
+ Project = var.project
161
+ Service = var.service
162
+ Environment = var.env
163
+ ManagedBy = "terraform"
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ ## Common Anti-Patterns
170
+
171
+ ```hcl
172
+ # WRONG — provider in module
173
+ # modules/rds/main.tf
174
+ provider "aws" { region = "us-east-1" } # NEVER in a module
175
+
176
+ # WRONG — no version pin
177
+ module "rds" {
178
+ source = "git::https://github.com/{project}/terraform-modules.git//rds"
179
+ # missing ?ref=vX.Y.Z
180
+ }
181
+
182
+ # WRONG — hardcoded values
183
+ resource "aws_s3_bucket" "assets" {
184
+ bucket = "acme-prod-assets" # use ${local.name_prefix}-assets
185
+ }
186
+
187
+ # WRONG — secrets in code
188
+ resource "aws_db_instance" "main" {
189
+ password = "hunter2" # use var.db_password (sensitive)
190
+ }
191
+
192
+ # WRONG — wildcard IAM
193
+ resource "aws_iam_policy" "app" {
194
+ policy = jsonencode({
195
+ Statement = [{ Action = "*", Resource = "*", Effect = "Allow" }]
196
+ })
197
+ }
198
+
199
+ # WRONG — public database
200
+ resource "aws_db_instance" "main" {
201
+ publicly_accessible = true # NEVER for databases
202
+ }
203
+
204
+ # WRONG — no state locking
205
+ terraform {
206
+ backend "s3" {
207
+ # missing dynamodb_table for locking
208
+ }
209
+ }
210
+
211
+ # WRONG — all resources in one file
212
+ # main.tf with 500+ lines of mixed RDS, S3, SQS, IAM...
213
+ # Split into rds.tf, s3.tf, sqs.tf, iam.tf
214
+ ```
215
+
216
+ ## CI/CD Patterns
217
+
218
+ ```yaml
219
+ # Standard workflow
220
+ # PR: fmt check → validate → plan (comment on PR)
221
+ # Merge to main: init → plan → apply
222
+
223
+ # Key rules:
224
+ # - Never auto-apply on PR
225
+ # - Always post plan output as PR comment
226
+ # - Lock state during apply (DynamoDB)
227
+ # - Inject secrets via CI environment variables
228
+ # - Pin Terraform version in CI to match team
229
+ ```
230
+
231
+ ## What to Avoid
232
+
233
+ - Provider blocks in modules
234
+ - Unpinned module versions
235
+ - Hardcoded names, IDs, or account numbers
236
+ - Secrets in `.tf` files or committed `.tfvars`
237
+ - Wildcard IAM policies (`*` on `*`)
238
+ - Public databases or caches
239
+ - Missing encryption on storage
240
+ - Monolithic files (split by resource type)
241
+ - `terraform import` in automation (use `import` blocks)
242
+ - Missing `description` on variables and outputs
243
+ - Nested locals maps (keep flat)
244
+ - `count` for conditional resources (use `for_each` with a set)