@jamie-tam/forge 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,81 @@
1
+ # Database Schema
2
+
3
+ ## Entity Relationship Diagram
4
+
5
+ ```
6
+ ┌──────────┐ ┌──────────┐ ┌─────────────┐ ┌──────────┐
7
+ │ USERS │──1:N──│ ORDERS │──1:N──│ ORDER_ITEMS │──N:1──│ PRODUCTS │
8
+ │──────────│ │──────────│ │─────────────│ │──────────│
9
+ │ id PK │ │ id PK │ │ id PK │ │ id PK │
10
+ │ email │ │ user_id FK│ │ order_id FK │ │ name │
11
+ │ name │ │ status │ │ product_id FK│ │ price │
12
+ │created_at│ │created_at│ │ quantity │ └──────────┘
13
+ └──────────┘ └──────────┘ └─────────────┘
14
+ ```
15
+
16
+ ## Tables
17
+
18
+ ### Table: {table_name}
19
+
20
+ **Description**: {What this table stores and its role in the system.}
21
+
22
+ #### Columns
23
+
24
+ | Column | Type | Nullable | Default | Constraints | Description |
25
+ |--------|------|----------|---------|-------------|-------------|
26
+ | id | UUID | No | gen_random_uuid() | PRIMARY KEY | Unique identifier |
27
+ | {column_name} | {type} | {Yes/No} | {default or —} | {UNIQUE, CHECK, etc.} | {description} |
28
+ | {column_name} | {type} | {Yes/No} | {default or —} | {constraints} | {description} |
29
+ | created_at | TIMESTAMPTZ | No | now() | — | Record creation time |
30
+ | updated_at | TIMESTAMPTZ | No | now() | — | Last modification time |
31
+
32
+ #### Indexes
33
+
34
+ | Name | Columns | Type | Description |
35
+ |------|---------|------|-------------|
36
+ | {index_name} | {column(s)} | BTREE / GIN / GIST / HASH | {why this index exists — what query it optimizes} |
37
+ | {index_name} | {column(s)} | UNIQUE | {enforces uniqueness on...} |
38
+
39
+ #### Foreign Keys
40
+
41
+ | Column | References | On Delete | On Update | Description |
42
+ |--------|-----------|-----------|-----------|-------------|
43
+ | {column} | {table.column} | CASCADE / SET NULL / RESTRICT | CASCADE | {description} |
44
+
45
+ ---
46
+
47
+ ### Table: {next_table_name}
48
+
49
+ **Description**: {What this table stores.}
50
+
51
+ #### Columns
52
+
53
+ | Column | Type | Nullable | Default | Constraints | Description |
54
+ |--------|------|----------|---------|-------------|-------------|
55
+ | id | UUID | No | gen_random_uuid() | PRIMARY KEY | Unique identifier |
56
+
57
+ #### Indexes
58
+
59
+ | Name | Columns | Type | Description |
60
+ |------|---------|------|-------------|
61
+
62
+ #### Foreign Keys
63
+
64
+ | Column | References | On Delete | On Update | Description |
65
+ |--------|-----------|-----------|-----------|-------------|
66
+
67
+ ---
68
+
69
+ ## Relationships Summary
70
+
71
+ | Relationship | Type | Description |
72
+ |-------------|------|-------------|
73
+ | {table_a} -> {table_b} | One-to-Many | {description} |
74
+ | {table_c} -> {table_d} | Many-to-Many (via {junction}) | {description} |
75
+ | {table_e} -> {table_f} | One-to-One | {description} |
76
+
77
+ ## Migration Notes
78
+
79
+ - {Any special migration considerations}
80
+ - {Data backfill requirements}
81
+ - {Backward compatibility notes}
@@ -0,0 +1,111 @@
1
+ # System Design
2
+
3
+ ## 1. System Overview
4
+
5
+ {One paragraph describing what this system does, who it serves, and its primary value proposition.}
6
+
7
+ ## 2. Component Diagram
8
+
9
+ ```
10
+ ┌────────────────┐ ┌─────────────┐
11
+ │ Client App │────>│ API Gateway │
12
+ └────────────────┘ └──────┬──────┘
13
+
14
+ ┌─────────┼─────────┐
15
+ v v
16
+ ┌────────────┐ ┌──────────┐
17
+ │ Auth Service│ │Core Service│
18
+ └────────────┘ └─────┬────┘
19
+
20
+ ┌─────────┬───┴───┬──────────┐
21
+ v v v v
22
+ ┌──────────┐ ┌─────┐ ┌─────────┐ ┌────────┐
23
+ │ Database │ │Cache│ │Msg Queue│ │ Worker │
24
+ └──────────┘ └─────┘ └─────────┘ └───┬────┘
25
+
26
+ v
27
+ ┌──────────┐
28
+ │ Database │
29
+ └──────────┘
30
+ ```
31
+
32
+ ## 3. Component Responsibilities
33
+
34
+ ### {Component Name}
35
+ - **Purpose**: {what this component does}
36
+ - **Technology**: {language, framework, runtime}
37
+ - **Owns**: {what data/domain this component is responsible for}
38
+ - **Depends on**: {what other components it calls}
39
+ - **Depended on by**: {what components call it}
40
+ - **Scaling**: {how this component scales — horizontal, vertical, auto}
41
+
42
+ ### {Component Name}
43
+ - **Purpose**: {what this component does}
44
+ - **Technology**: {language, framework, runtime}
45
+ - **Owns**: {what data/domain this component is responsible for}
46
+ - **Depends on**: {what other components it calls}
47
+ - **Depended on by**: {what components call it}
48
+ - **Scaling**: {how this component scales}
49
+
50
+ ## 4. Data Flow
51
+
52
+ ### Primary Flow: {flow name, e.g., "User creates an order"}
53
+ ```
54
+ Client API Service Database
55
+ │ │ │ │
56
+ │──POST /resource──>│ │ │
57
+ │ │──validate + process──>│ │
58
+ │ │ │──INSERT──>│
59
+ │ │ │<──confirmation──│
60
+ │ │<──result──│ │
61
+ │<──201 Created──│ │ │
62
+ ```
63
+
64
+ ### Secondary Flow: {flow name}
65
+ {Describe or diagram the flow.}
66
+
67
+ ## 5. API Boundaries
68
+
69
+ | Boundary | Protocol | Auth | Rate Limit |
70
+ |----------|----------|------|------------|
71
+ | Client -> API | HTTPS/REST | JWT | 100 req/min |
72
+ | API -> Service | gRPC / HTTP | Service token | None (internal) |
73
+ | Service -> Database | TCP | Connection pool | N/A |
74
+ | Service -> Cache | TCP | N/A | N/A |
75
+
76
+ ## 6. Infrastructure
77
+
78
+ ### Environments
79
+ | Environment | Purpose | URL | Notes |
80
+ |-------------|---------|-----|-------|
81
+ | Local | Development | localhost:{port} | Docker Compose |
82
+ | Staging | Pre-production testing | {url} | Mirrors production |
83
+ | Production | Live users | {url} | Auto-scaled |
84
+
85
+ ### Infrastructure Components
86
+ - **Compute**: {e.g., Kubernetes, ECS, Lambda, bare VM}
87
+ - **Database**: {e.g., PostgreSQL on RDS, MongoDB Atlas}
88
+ - **Cache**: {e.g., Redis on ElastiCache}
89
+ - **Queue**: {e.g., SQS, RabbitMQ, Kafka}
90
+ - **Storage**: {e.g., S3 for file uploads}
91
+ - **CDN**: {e.g., CloudFront for static assets}
92
+ - **Monitoring**: {e.g., Datadog, Prometheus + Grafana}
93
+ - **Logging**: {e.g., CloudWatch, ELK stack}
94
+
95
+ ## 7. Scalability Considerations
96
+
97
+ ### Current Capacity
98
+ - Expected concurrent users: {number}
99
+ - Expected requests per second: {number}
100
+ - Expected data volume: {size over time}
101
+
102
+ ### Scaling Strategy
103
+ - **Horizontal**: {which components scale horizontally and how}
104
+ - **Vertical**: {which components need vertical scaling}
105
+ - **Caching**: {what is cached, invalidation strategy}
106
+ - **Database**: {read replicas, sharding, partitioning plans}
107
+
108
+ ### Bottlenecks and Mitigations
109
+ | Bottleneck | When It Hits | Mitigation |
110
+ |-----------|-------------|------------|
111
+ | {component} | {at what scale} | {what to do} |
@@ -0,0 +1,433 @@
1
+ ---
2
+ name: plan-brainstorm
3
+ description: "Use when the user wants to explore approaches before coding — says 'brainstorm', 'compare options', 'figure out the approach', 'what's the best way to', 'kick around ideas', 'design discussion' — and the work is not prototype-driven (library extraction, internal tool, refactor). For prototype-shaped work, /feature and /greenfield use wireframe + prototype phases instead — skip this skill there."
4
+ ---
5
+
6
+ # Plan Brainstorm
7
+
8
+ Turn ideas into fully formed designs through collaborative dialogue. Explore approaches with the user, evaluate tradeoffs, and produce an approved design spec that feeds into architecture and task decomposition.
9
+
10
+ **When this skill is the wrong fit:** v6's prototype-driven default flow (concept → wireframe → prototype → iterate → codify) uses the working prototype itself as design exploration. The `harden` skill at Phase 5 codifies the decisions the prototype implicitly made. This skill is the non-prototype fallback — invoke it only when prototype/wireframe phases were skipped for legitimate reasons (e.g., headless library work).
11
+
12
+ **Announce at start:** "I'm using the plan-brainstorm skill to explore approaches for this feature."
13
+
14
+ <HARD-GATE>
15
+ When this skill is invoked: do NOT proceed to plan-architecture, plan-task-decompose, or any implementation skill until you have presented a design and the user has approved it. Once this skill is on the path, the gate applies. The gate does NOT apply in v6 prototype-driven flow because this skill is not on the path there.
16
+ </HARD-GATE>
17
+
18
+ ---
19
+
20
+ ## I/O Contract
21
+
22
+ | Field | Value |
23
+ |---|---|
24
+ | **Requires** | Requirements doc (`.forge/work/{type}/{name}/requirements.md`) or user description. Codebase analysis (`.forge/work/{type}/{name}/codebase-analysis.md`) if existing project. |
25
+ | **Produces** | `.forge/work/{type}/{name}/brainstorm-approved.md` |
26
+ | **Feeds into** | `plan-architecture` |
27
+ | **Updates manifest** | `artifacts.brainstorm` |
28
+
29
+ ---
30
+
31
+ ## Anti-Pattern: "This Is Too Simple To Need A Design"
32
+
33
+ Every feature gets a brainstorm. Short designs are fine, but a design must exist and be approved.
34
+
35
+ ---
36
+
37
+ ## Checklist
38
+
39
+ Complete these steps in order:
40
+
41
+ 1. **Review inputs** -- read requirements, codebase analysis, and decision log
42
+ 2. **Ask clarifying questions** -- one at a time, understand purpose, constraints, success criteria
43
+ 3. **Propose 2-3 approaches** -- with tradeoffs and your recommendation
44
+ 4. **Present design** -- in sections scaled to complexity, get approval after each section
45
+ 5. **Write design doc** -- save to `.forge/work/{type}/{name}/brainstorm-approved.md`
46
+ 6. **Spec review loop** -- dispatch spec-reviewer subagent (max 3 iterations)
47
+ 7. **User reviews written spec** -- ask user to review before proceeding
48
+ 8. **Update feature manifest** -- record approval
49
+ 9. **Transition to architecture** -- invoke plan-architecture skill
50
+
51
+ ---
52
+
53
+ ## Process
54
+
55
+ ### Step 1: Review Inputs
56
+
57
+ Before asking any questions, gather context:
58
+
59
+ **Read requirements document:**
60
+ - Open `.forge/work/{type}/{name}/requirements.md` if it exists
61
+ - Identify must-have vs should-have requirements
62
+ - Note acceptance criteria that will constrain the design
63
+ - Flag any open questions that should have been resolved in requirements
64
+
65
+ **Read codebase analysis (if existing project):**
66
+ - Open `.forge/work/{type}/{name}/codebase-analysis.md` if it exists
67
+ - Note existing patterns that the design should follow
68
+ - Identify constraints from the current architecture
69
+ - Note flagged risks that the design should address
70
+
71
+ **Check decision log:**
72
+ - Read `aiwiki/decisions/` for existing architectural decisions
73
+ - Identify patterns already established in prior features
74
+ - Do NOT propose approaches that contradict existing decisions without explicitly acknowledging the deviation and justifying it
75
+
76
+ **Assess scope:**
77
+ Before asking detailed questions, evaluate scope. If the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately:
78
+
79
+ > "This looks like it covers multiple independent subsystems. Rather than designing everything at once, I recommend we break it into sub-projects and brainstorm each one separately. Here's how I'd split it: [list]. Which should we start with?"
80
+
81
+ Each sub-project gets its own brainstorm -> architecture -> tasks cycle.
82
+
83
+ ### Step 1.5: Codex Mode Check
84
+
85
+ Now that inputs are reviewed, run the Codex consent flow from `protocols/codex.md`. The selected mode applies for the rest of this skill's invocation.
86
+
87
+ - **Takeover:** Dispatch Codex with the inputs + skill methodology to propose approaches. Claude handles user-facing clarifying questions and critiques Codex's proposals.
88
+ - **Verify** or **Skip / Codex unavailable:** Proceed with the steps below. Step 3.5 will dispatch Codex to critique Claude's proposed approaches (Verify only).
89
+
90
+ ### Step 2: Ask Clarifying Questions
91
+
92
+ Rules:
93
+
94
+ - **One question per message.** Never bundle multiple questions into one message.
95
+ - **Multiple choice preferred.** When possible, present 3-5 options with descriptions. Always include "Other" as a choice.
96
+ - **Open-ended is fine** when the question genuinely cannot be multiple choice (e.g., "Describe the user journey").
97
+ - **Build on context.** Reference requirements, codebase analysis, and previous answers.
98
+ - **Stop when confident.** Do not ask questions for completeness -- ask questions because the answer changes the design.
99
+
100
+ Focus areas for questions:
101
+
102
+ 1. **Intent** -- What problem does this solve? Why now?
103
+ 2. **Users** -- Who benefits? How do they interact with it?
104
+ 3. **Constraints** -- Technical, business, time, compliance limitations?
105
+ 4. **Integration** -- How does this fit with existing systems?
106
+ 5. **Scale** -- Expected usage volume? Growth expectations?
107
+ 6. **Success criteria** -- How do we know this worked?
108
+
109
+ ### Step 3: Propose 2-3 Approaches
110
+
111
+ After you have enough context, present approaches in a structured format:
112
+
113
+ ```markdown
114
+ ## Approach A: {Name} (Recommended)
115
+
116
+ **Summary:** One paragraph describing the approach.
117
+
118
+ **How it works:**
119
+ 1. {Step 1}
120
+ 2. {Step 2}
121
+ 3. {Step 3}
122
+
123
+ **Pros:**
124
+ - {Advantage 1}
125
+ - {Advantage 2}
126
+
127
+ **Cons:**
128
+ - {Disadvantage 1}
129
+ - {Disadvantage 2}
130
+
131
+ **Best when:** {Conditions where this approach shines}
132
+
133
+ ---
134
+
135
+ ## Approach B: {Name}
136
+
137
+ {Same structure}
138
+
139
+ ---
140
+
141
+ ## Approach C: {Name}
142
+
143
+ {Same structure}
144
+
145
+ ---
146
+
147
+ ## Recommendation
148
+
149
+ I recommend **Approach {X}** because {reasoning that references the specific requirements and constraints discussed}.
150
+ ```
151
+
152
+ Rules for approaches:
153
+
154
+ - **Minimum 2, maximum 3 approaches.** Two is fine when the decision is binary. Four is too many.
155
+ - **Lead with your recommendation.** Explain why.
156
+ - **Be honest about tradeoffs.** Do not present a straw man to make your preferred approach look better.
157
+ - **Reference existing patterns.** If the codebase analysis found specific patterns, approaches should work with them, not against them.
158
+ - **Check decision log.** If a similar decision was made before, reference it. Propose consistency unless there is a good reason to deviate.
159
+ - **Include effort estimates.** Rough relative sizing (e.g., "Approach A: ~3 tasks, Approach B: ~7 tasks").
160
+
161
+ ### Step 3.5: Critic Review of Approaches
162
+
163
+ Before presenting approaches to the user, dispatch the **critic** subagent (Opus) to review all proposed approaches for feasibility, gaps, and risks. Provide the critic with the requirements document, the codebase analysis (if available), and the generated approaches.
164
+
165
+ Present the critic's verdict alongside the approaches to the user. If the critic identifies critical gaps, address them before presenting.
166
+
167
+ **Codex Verify:** Check the mode recorded at Step 1.5. If **Verify** was selected, dispatch Codex alongside the critic to critique the proposed approaches for feasibility blind spots, missing constraints, and underestimated risks. If **Takeover** was selected, skip this step (Codex already proposed approaches). If **Skip**, do nothing. Do NOT re-run the consent flow.
168
+
169
+ #### Codex Integration
170
+
171
+ **Modes:** Verify or Takeover | **Protocol:** `protocols/codex.md`
172
+
173
+ - **Verify:** Claude proposes approaches, Codex critiques feasibility.
174
+ - **Takeover:** Codex proposes approaches, Claude reviews and critiques.
175
+
176
+ **When:** Step 3.5 — after generating approaches, alongside the critic review.
177
+
178
+ **Context to pass:**
179
+ - Path to requirements document (`.forge/work/{type}/{name}/requirements.md`)
180
+ - Path to codebase analysis (`.forge/work/{type}/{name}/codebase-analysis.md`)
181
+ - Write proposed approaches to `.forge/work/{type}/{name}/brainstorm-approaches-draft.md` before invoking Codex (temp file — delete after critic review completes)
182
+
183
+ **What Codex reviews:**
184
+ - Feasibility blind spots in each approach
185
+ - Missing constraints or requirements not addressed
186
+ - Risks that the approaches underestimate
187
+
188
+ **Prompt focus:** "Critique these proposed approaches. For each: what could go wrong that isn't acknowledged? What requirement is unaddressed? Which risks are underestimated?"
189
+
190
+ **Presentation:** Present Claude critic + Codex critic findings together before the user selects an approach. Label each source.
191
+
192
+ Wait for user to select an approach before proceeding.
193
+
194
+ ### Step 4: Present Design
195
+
196
+ Once an approach is selected, present the detailed design in sections. Scale each section to its complexity -- a few sentences if straightforward, up to 200-300 words if nuanced.
197
+
198
+ **After each section, ask if it looks right before continuing.** Do not dump the entire design at once.
199
+
200
+ Sections to cover:
201
+
202
+ **4a. Architecture Overview**
203
+ - High-level component structure
204
+ - How components communicate
205
+ - Where this fits in the existing system (if applicable)
206
+
207
+ **4b. Data Model**
208
+ - Key entities and their relationships
209
+ - Storage strategy (database tables, cache keys, file storage)
210
+ - Data flow: where data enters, how it transforms, where it persists
211
+
212
+ **4c. API Design**
213
+ - Key endpoints or interfaces
214
+ - Input/output shapes (high level -- exact contracts come in architecture skill)
215
+ - Authentication and authorization approach
216
+
217
+ **4d. User-Facing Behavior**
218
+ - What the user sees and does
219
+ - Key interaction flows
220
+ - Error states and how they are communicated
221
+
222
+ **4e. Error Handling Strategy**
223
+ - How errors are detected, propagated, and reported
224
+ - Retry strategies if applicable
225
+ - Degradation behavior (what happens when a dependency fails)
226
+
227
+ **4f. Testing Strategy**
228
+ - What types of tests are needed
229
+ - Key test scenarios
230
+ - Any special testing infrastructure required
231
+
232
+ **4g. Migration / Rollout Plan** (if modifying existing system)
233
+ - How to deploy without breaking existing functionality
234
+ - Rollback strategy
235
+ - Data migration approach if needed
236
+
237
+ Not every section applies to every feature. Skip sections that are not relevant, but do not skip sections because they seem simple -- briefly address them and move on.
238
+
239
+ ### Step 5: Write Design Doc
240
+
241
+ After the user approves all sections, write the complete design to `.forge/work/{type}/{name}/brainstorm-approved.md`.
242
+
243
+ The document MUST include:
244
+
245
+ ```markdown
246
+ # Design: {Feature Name}
247
+
248
+ **Date:** YYYY-MM-DD
249
+ **Status:** Approved
250
+ **Approach:** {Selected approach name}
251
+
252
+ ## Context
253
+ {Why this feature exists, what problem it solves}
254
+
255
+ ## Requirements Summary
256
+ {Link to requirements doc, key must-haves listed}
257
+
258
+ ## Selected Approach
259
+ {The chosen approach with full rationale}
260
+
261
+ ## Alternatives Considered
262
+ {Brief summary of rejected approaches and why}
263
+
264
+ ## Design
265
+
266
+ ### Architecture Overview
267
+ {Component structure, communication patterns}
268
+
269
+ ### Data Model
270
+ {Entities, relationships, storage}
271
+
272
+ ### API Design
273
+ {Endpoints, interfaces, auth}
274
+
275
+ ### User-Facing Behavior
276
+ {Interaction flows, UI behavior}
277
+
278
+ ### Error Handling
279
+ {Error strategy}
280
+
281
+ ### Testing Strategy
282
+ {Test types and key scenarios}
283
+
284
+ ### Migration / Rollout
285
+ {Deployment strategy, rollback plan}
286
+
287
+ ## I/O Contract
288
+ {What this design requires from other systems and what it provides}
289
+
290
+ ## Open Decisions
291
+ {Any decisions deferred to architecture phase -- should be minimal}
292
+
293
+ ## Decision Log References
294
+ {Links to relevant ADRs in aiwiki/decisions/}
295
+ ```
296
+
297
+ ### Step 6: Spec Review Loop
298
+
299
+ After writing the spec document, dispatch a spec-reviewer subagent:
300
+
301
+ 1. **Dispatch spec-reviewer** with precisely crafted review context -- provide the path to the spec document and the requirements document. Never send your session history. This keeps the reviewer focused on the plan.
302
+ 2. **If issues found:** Fix the issues in the spec, then re-dispatch the reviewer.
303
+ 3. **If approved:** Proceed to user review.
304
+ 4. **Max 3 iterations.** If the review loop exceeds 3 iterations without convergence, surface the remaining issues to the user for guidance.
305
+
306
+ The reviewer checks for:
307
+ - Completeness against requirements (every must-have addressed)
308
+ - Internal consistency (no contradictions within the design)
309
+ - Feasibility (no hand-waving over hard problems)
310
+ - Clarity (another developer could implement from this spec)
311
+
312
+ ### Step 7: User Reviews Written Spec
313
+
314
+ After the spec review loop passes:
315
+
316
+ > "Design spec written and saved to `.forge/work/{type}/{name}/brainstorm-approved.md`. Please review it and let me know if you want to make any changes before we move to architecture."
317
+
318
+ Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user explicitly approves.
319
+
320
+ ### Step 8: Update Feature Manifest
321
+
322
+ After approval, update `.forge/work/{type}/{name}/manifest.yaml`:
323
+
324
+ ```yaml
325
+ artifacts:
326
+ brainstorm:
327
+ path: brainstorm-approved.md
328
+ status: approved
329
+ approved_at: YYYY-MM-DD
330
+ approach: {selected approach name}
331
+ review_iterations: N
332
+ ```
333
+
334
+ ### Step 9: Transition to Architecture
335
+
336
+ After the user approves the spec:
337
+
338
+ > "Design approved. Next step: generating technical artifacts (API contracts, DB schemas, system diagrams). I'll use the plan-architecture skill."
339
+
340
+ Invoke `plan-architecture`. Do NOT invoke any other skill. plan-architecture is the next step.
341
+
342
+ ---
343
+
344
+ ## Key Rules
345
+
346
+ 1. **NO implementation during brainstorming.** Design only. No code, no scaffolding, no file creation beyond the spec document.
347
+ 2. **No "too simple" exemption.** Every feature gets a brainstorm. The design can be short, but it must exist and be approved.
348
+ 3. **One question per message.** Do not overwhelm the user with multiple questions.
349
+ 4. **Multiple choice preferred.** Easier to answer than open-ended.
350
+ 5. **YAGNI ruthlessly.** If a capability is not in the requirements, do not design it. If the user suggests gold-plating, gently push back.
351
+ 6. **Check the decision log.** Before proposing a new pattern, check if a prior decision already covers it. Consistency matters more than novelty.
352
+ 7. **Incremental validation.** Present design in sections. Get approval per section. Do not present a 2000-word design and ask "does this look good?"
353
+ 8. **Explore alternatives before settling.** Always propose 2-3 approaches. Never jump to "the obvious solution" without showing why it is better than alternatives.
354
+ 9. **Reference codebase conventions.** If the codebase analysis found specific patterns, the design must work with them or explicitly justify deviation.
355
+
356
+ ---
357
+
358
+ ## Anti-Patterns
359
+
360
+ | Anti-Pattern | Why It Is Wrong | What To Do Instead |
361
+ |---|---|---|
362
+ | **Jumping to implementation** | Designs are cheap. Rework is expensive. | Present the design. Wait for approval. |
363
+ | **Asking all questions at once** | Users give incomplete answers to question lists | One question per message. Build on answers. |
364
+ | **Proposing only one approach** | No comparison means no informed decision | Always propose 2-3 with tradeoffs. |
365
+ | **Ignoring existing patterns** | Fighting the codebase creates maintenance burden | Read codebase analysis. Follow conventions. |
366
+ | **Skipping the review loop** | Unreviewed specs have gaps | Always dispatch spec-reviewer. |
367
+ | **Hand-waving hard parts** | "We'll figure out auth later" becomes a crisis | Address every component, even briefly. |
368
+ | **Over-designing simple features** | 10-page spec for a config change wastes time | Scale sections to complexity. Short is fine. |
369
+ | **Contradicting prior decisions** | Inconsistency across features confuses everyone | Check decision log. Reference existing ADRs. |
370
+
371
+ ---
372
+
373
+ ## Design for Isolation and Clarity
374
+
375
+ Break the system into units with one clear purpose, each communicating through well-defined interfaces. If a consumer can't be insulated from a unit's internals, the boundary needs work.
376
+
377
+ ---
378
+
379
+ ## Working in Existing Codebases
380
+
381
+ - Explore the current structure before proposing changes. Follow existing patterns.
382
+ - Where existing code has problems that affect the work (e.g., a file that has grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design.
383
+ - Do not propose unrelated refactoring. Stay focused on what serves the current goal.
384
+ - Reference specific files and patterns from the codebase analysis document.
385
+
386
+ ---
387
+
388
+ ## Process Flow
389
+
390
+ ```
391
+ Review inputs (requirements + codebase analysis + decision log)
392
+ |
393
+ v
394
+ Ask clarifying questions (one per message)
395
+ |
396
+ v
397
+ Propose 2-3 approaches with tradeoffs
398
+ |
399
+ v
400
+ User selects approach
401
+ |
402
+ v
403
+ Present design in sections (approve each)
404
+ |
405
+ v
406
+ All sections approved?
407
+ | |
408
+ no yes
409
+ | |
410
+ v v
411
+ Revise Write design doc
412
+ |
413
+ v
414
+ Spec review loop (max 3)
415
+ |
416
+ v
417
+ Review passed?
418
+ | |
419
+ no yes
420
+ | |
421
+ v v
422
+ Fix User reviews spec
423
+ | |
424
+ no yes
425
+ | |
426
+ v v
427
+ Revise Update manifest
428
+ |
429
+ v
430
+ Invoke plan-architecture
431
+ ```
432
+
433
+ **The terminal state is invoking plan-architecture.** Do NOT invoke build-tdd, build-scaffold, or any other implementation skill. The ONLY skill you invoke after plan-brainstorm is plan-architecture.