buildflow-dev 1.0.7 → 4.0.2
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.
- package/README.md +138 -51
- package/package.json +4 -2
- package/src/commands/init.js +19 -0
- package/src/commands/install.js +2 -2
- package/templates/CLAUDE.md +49 -33
- package/templates/commands/build.md +237 -66
- package/templates/commands/check.md +59 -24
- package/templates/commands/hotfix.md +119 -0
- package/templates/commands/modify.md +212 -38
- package/templates/commands/onboard.md +246 -52
- package/templates/commands/plan.md +204 -36
- package/templates/commands/ship.md +109 -47
- package/templates/commands/spec.md +251 -0
- package/templates/commands/start.md +38 -8
- package/templates/commands/think.md +186 -38
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: buildflow-spec
|
|
3
|
+
description: Generate user-story-backed PRD, Technical Design, and Acceptance Criteria with self-critique pass
|
|
4
|
+
allowed-tools: Read, Write, WebSearch
|
|
5
|
+
agent: strategist
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /buildflow-spec
|
|
9
|
+
|
|
10
|
+
Spec-Driven Development layer. Produces formally structured, self-critiqued spec artifacts before any code is planned or written. Every plan task, every build output, and every ship gate references these docs.
|
|
11
|
+
|
|
12
|
+
Run after `/buildflow-start`, before `/buildflow-plan`.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
- `/buildflow-spec` — full spec from vision
|
|
16
|
+
- `/buildflow-spec prd` — regenerate PRD only
|
|
17
|
+
- `/buildflow-spec tdd` — regenerate TDD only
|
|
18
|
+
- `/buildflow-spec acceptance` — regenerate ACs only
|
|
19
|
+
- `/buildflow-spec --fast` — minimal spec for small features (single screen / endpoint)
|
|
20
|
+
- `/buildflow-spec --review` — critique existing specs without regenerating
|
|
21
|
+
|
|
22
|
+
## Context Packet
|
|
23
|
+
- `.buildflow/core/vision.md`
|
|
24
|
+
- `.buildflow/codebase/PATTERNS.md` (if exists — align spec with existing architecture)
|
|
25
|
+
- `.buildflow/memory/light.md` (app_name, framework, phase only)
|
|
26
|
+
- `.buildflow/specs/` (if regenerating)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Step 1: Validate Vision
|
|
31
|
+
Read `.buildflow/core/vision.md`.
|
|
32
|
+
If empty: "Run `/buildflow-start` first."
|
|
33
|
+
|
|
34
|
+
If `PATTERNS.md` exists: note the existing architectural style (component structure, naming, API patterns).
|
|
35
|
+
The TDD must align with these — don't invent new patterns unless explicitly asked.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 2: Clarify (one round, all questions at once)
|
|
40
|
+
Ask only what vision.md left unanswered. Max 5 questions:
|
|
41
|
+
- What does success look like for the **user** — as a measurable outcome, not a feature list?
|
|
42
|
+
- What is explicitly **out of scope** this phase?
|
|
43
|
+
- Any **hard constraints**: tech stack, deadline, team size, compliance?
|
|
44
|
+
- Any **third-party integrations** required?
|
|
45
|
+
- If `--fast`: "Describe the single feature in one sentence."
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Step 3: Generate PRD
|
|
50
|
+
Write `.buildflow/specs/PRD.md`:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
# Product Requirements Document
|
|
54
|
+
**App:** [name] **Phase:** [N] **Date:** [today] **Status:** DRAFT
|
|
55
|
+
|
|
56
|
+
## Problem Statement
|
|
57
|
+
[One paragraph. Must answer: what exists today that's broken/missing, who suffers, why current solutions fail.]
|
|
58
|
+
|
|
59
|
+
## Users & Goals
|
|
60
|
+
| User Type | Job-to-be-Done | Current Pain |
|
|
61
|
+
|-----------|----------------|--------------|
|
|
62
|
+
| [type] | [goal — verb phrase] | [specific friction today] |
|
|
63
|
+
|
|
64
|
+
## User Stories
|
|
65
|
+
| ID | Story | Acceptance Signal |
|
|
66
|
+
|----|-------|------------------|
|
|
67
|
+
| US-01 | As a [user], I want [goal] so that [outcome] | [one-line measurable signal] |
|
|
68
|
+
| US-02 | ... | ... |
|
|
69
|
+
|
|
70
|
+
## Features — In Scope
|
|
71
|
+
| ID | Feature | Linked Stories | Priority | Success Metric |
|
|
72
|
+
|----|---------|---------------|----------|----------------|
|
|
73
|
+
| F-01 | [name] | US-01, US-02 | Must / Should / Could | [number or binary] |
|
|
74
|
+
|
|
75
|
+
## Explicitly Out of Scope
|
|
76
|
+
- [item] — reason: [why excluded this phase]
|
|
77
|
+
|
|
78
|
+
## Constraints
|
|
79
|
+
| Type | Constraint |
|
|
80
|
+
|------|-----------|
|
|
81
|
+
| Tech | [stack lock-in, version requirements] |
|
|
82
|
+
| Timeline | [deadline if any] |
|
|
83
|
+
| Compliance | [GDPR, HIPAA, accessibility level, etc.] |
|
|
84
|
+
| Team | [size, skills] |
|
|
85
|
+
|
|
86
|
+
## Phase Complete When
|
|
87
|
+
- [ ] [measurable outcome — must map to a Success Metric above]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Step 4: Generate TDD
|
|
93
|
+
Write `.buildflow/specs/TDD.md`:
|
|
94
|
+
|
|
95
|
+
If `PATTERNS.md` exists: components and API shapes must follow existing conventions.
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
# Technical Design Document
|
|
99
|
+
**App:** [name] **Phase:** [N] **Date:** [today] **Status:** DRAFT
|
|
100
|
+
|
|
101
|
+
## Architecture Overview
|
|
102
|
+
[2–3 sentences. What components exist, how they communicate, what changes this phase.]
|
|
103
|
+
|
|
104
|
+
## Component Map
|
|
105
|
+
| Component | Responsibility | Linked Feature | Interface Type |
|
|
106
|
+
|-----------|---------------|----------------|----------------|
|
|
107
|
+
| [name] | [single responsibility] | F-01 | REST / gRPC / event / function |
|
|
108
|
+
|
|
109
|
+
## Data Model Changes
|
|
110
|
+
| Entity | Fields Added/Changed | Reason |
|
|
111
|
+
|--------|---------------------|--------|
|
|
112
|
+
| [entity] | [field: type] | [F-01] |
|
|
113
|
+
|
|
114
|
+
## API Contracts
|
|
115
|
+
| Endpoint / Function | Method | Request Shape | Response Shape | Status Codes | Auth |
|
|
116
|
+
|--------------------|--------|---------------|----------------|-------------|------|
|
|
117
|
+
| /api/[path] | POST | `{ field: type }` | `{ field: type }` | 200, 400, 401, 500 | yes/no |
|
|
118
|
+
|
|
119
|
+
## Error Response Format
|
|
120
|
+
All errors follow:
|
|
121
|
+
```json
|
|
122
|
+
{ "error": { "code": "ERROR_CODE", "message": "human readable", "field": "optional" } }
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Technology Decisions
|
|
126
|
+
| Decision | Choice | Rationale | Alternatives Rejected | Reversibility |
|
|
127
|
+
|----------|--------|-----------|----------------------|--------------|
|
|
128
|
+
| [area] | [choice] | [why — cite constraint or principle] | [what else, why not] | easy / hard |
|
|
129
|
+
|
|
130
|
+
## Non-Functional Requirements
|
|
131
|
+
| Type | Requirement | Measurement Method |
|
|
132
|
+
|------|------------|-------------------|
|
|
133
|
+
| Performance | [endpoint] responds in < [Nms] at [N] rps | Load test / APM |
|
|
134
|
+
| Security | [specific requirement — not "secure"] | Audit / pen test |
|
|
135
|
+
| Accessibility | WCAG [2.1 AA / 2.1 AAA] | Automated + manual |
|
|
136
|
+
| Availability | [N]% uptime | Monitoring |
|
|
137
|
+
| Data retention | [N] days | Automated policy |
|
|
138
|
+
|
|
139
|
+
## Known Risks
|
|
140
|
+
| Risk | Likelihood | Impact | Mitigation | Owner |
|
|
141
|
+
|------|-----------|--------|-----------|-------|
|
|
142
|
+
| [risk] | low/med/high | low/med/high | [concrete action] | dev / PM / ops |
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Step 5: Generate Acceptance Criteria
|
|
148
|
+
Write `.buildflow/specs/acceptance.md`:
|
|
149
|
+
|
|
150
|
+
**Rules for every AC:**
|
|
151
|
+
- Binary — pass or fail only, no partial credit
|
|
152
|
+
- Testable — an automated test or explicit manual step can verify it
|
|
153
|
+
- Specific — no vague words (see Critic pass below)
|
|
154
|
+
- Covers both happy path AND at least one failure/edge case per feature
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
# Acceptance Criteria
|
|
158
|
+
**App:** [name] **Phase:** [N] **Date:** [today]
|
|
159
|
+
|
|
160
|
+
## [Feature F-01: name] → US-01, US-02
|
|
161
|
+
**Happy path:**
|
|
162
|
+
- AC-001: Given [setup state], when [user/system action], then [exact observable outcome]
|
|
163
|
+
- AC-002: Given [...], when [...], then [...]
|
|
164
|
+
|
|
165
|
+
**Failure / edge cases (required — minimum 1 per feature):**
|
|
166
|
+
- AC-003: Given [invalid/boundary/error input], when [...], then [specific error behavior]
|
|
167
|
+
- AC-004: Given [concurrent/race/timeout scenario], when [...], then [...]
|
|
168
|
+
|
|
169
|
+
## [Feature F-02: name] → US-03
|
|
170
|
+
- AC-005: Given [...], when [...], then [...]
|
|
171
|
+
- AC-006 (edge): Given [...], when [...], then [...]
|
|
172
|
+
|
|
173
|
+
## Non-Functional
|
|
174
|
+
- AC-NF-001: [endpoint] under [N] concurrent users responds within [Nms] (p95)
|
|
175
|
+
- AC-NF-002: [page/flow] achieves WCAG 2.1 AA with zero automated violations
|
|
176
|
+
- AC-NF-003: No secrets present in committed code (automated scan passes)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Step 6: Spec Critic Pass (automatic — runs before showing user)
|
|
182
|
+
|
|
183
|
+
Before presenting specs to the user, self-review all three docs as a Spec Critic:
|
|
184
|
+
|
|
185
|
+
### Vague Language Scan
|
|
186
|
+
Search every AC for these banned words. Flag any found:
|
|
187
|
+
`correctly` `properly` `works` `fast` `quickly` `slow` `good` `bad` `easy` `easily`
|
|
188
|
+
`should` `appropriate` `reasonable` `nice` `clean` `simple` `obvious` `intuitive`
|
|
189
|
+
|
|
190
|
+
For each flagged word: replace with a specific, measurable alternative or mark `[NEEDS SPECIFICITY]`.
|
|
191
|
+
|
|
192
|
+
### Coverage Check
|
|
193
|
+
- Every feature in PRD has at least 2 ACs (1 happy + 1 error/edge) — flag if not
|
|
194
|
+
- Every user story US-XX is referenced in at least one AC's feature section — flag orphans
|
|
195
|
+
- Every component in TDD maps to at least one PRD feature — flag orphans
|
|
196
|
+
- Every NFR in TDD has a corresponding AC-NF — flag gaps
|
|
197
|
+
|
|
198
|
+
### Testability Check
|
|
199
|
+
For each AC, verify it can be answered as a pass/fail automated test or explicit manual step.
|
|
200
|
+
Flag any AC that requires human judgment to evaluate.
|
|
201
|
+
|
|
202
|
+
### Consistency Check
|
|
203
|
+
- API contracts in TDD match any referenced endpoints in ACs
|
|
204
|
+
- Data model changes in TDD are sufficient to support all AC outcomes
|
|
205
|
+
- Technology decisions don't contradict any constraints in PRD
|
|
206
|
+
|
|
207
|
+
### Critic Report
|
|
208
|
+
Show the user:
|
|
209
|
+
```
|
|
210
|
+
Spec Critic Report
|
|
211
|
+
──────────────────
|
|
212
|
+
Vague language: [N found — fixed N, flagged N]
|
|
213
|
+
Coverage gaps: [list any orphaned features/stories/components]
|
|
214
|
+
Testability: [list any ACs needing rework]
|
|
215
|
+
Consistency: [any TDD/PRD conflicts]
|
|
216
|
+
Overall quality: STRONG / NEEDS REVISION
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Step 7: User Review Gate
|
|
222
|
+
Show summary of all three specs + Critic Report. Ask:
|
|
223
|
+
|
|
224
|
+
> "Specs ready for review. Critic score: [STRONG / NEEDS REVISION]
|
|
225
|
+
> Approve to lock, or tell me what to revise."
|
|
226
|
+
|
|
227
|
+
- **Approve:** lock specs. Update `light.md`:
|
|
228
|
+
```yaml
|
|
229
|
+
spec_status: locked
|
|
230
|
+
spec_phase: [N]
|
|
231
|
+
ac_count: [N]
|
|
232
|
+
us_count: [N]
|
|
233
|
+
spec_critic: strong/revised
|
|
234
|
+
```
|
|
235
|
+
- **Revise:** apply changes to the named section, re-run Critic pass, repeat Step 7.
|
|
236
|
+
|
|
237
|
+
Do not proceed until user approves.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## --fast Mode
|
|
242
|
+
For single-feature additions:
|
|
243
|
+
- Skip User Stories table (inline in feature row)
|
|
244
|
+
- Skip Technology Decisions (use existing stack)
|
|
245
|
+
- Generate 3 ACs minimum: 1 happy + 1 error + 1 NFR
|
|
246
|
+
- Skip Critic coverage check (only vague language scan)
|
|
247
|
+
- Token budget: ~8K
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Token Budget: ~20K (full) / ~8K (--fast)
|
|
@@ -9,31 +9,61 @@ agent: strategist
|
|
|
9
9
|
|
|
10
10
|
Begin your project. Works for both greenfield and existing codebases.
|
|
11
11
|
|
|
12
|
+
## Context Packet (load only these)
|
|
13
|
+
- `.buildflow/memory/light.md`
|
|
14
|
+
- `.buildflow/you/preferences.md`
|
|
15
|
+
|
|
16
|
+
Do NOT load: specs, phases, codebase files — this is vision only.
|
|
17
|
+
|
|
12
18
|
## Step 1: Load Memory
|
|
13
19
|
Read `.buildflow/memory/light.md` and `.buildflow/you/preferences.md`.
|
|
20
|
+
If `light.md` is over 3K tokens: prune it now (see pruning rules below).
|
|
14
21
|
|
|
15
22
|
## Step 2: Detect Mode
|
|
16
23
|
|
|
17
|
-
**Greenfield (no src/ code):**
|
|
24
|
+
**Greenfield (no src/ code yet):**
|
|
18
25
|
Ask vision questions one at a time:
|
|
19
26
|
1. What are you building?
|
|
20
27
|
2. Who is it for?
|
|
21
28
|
3. What problem does it solve?
|
|
22
29
|
4. What's the simplest useful version?
|
|
23
|
-
5. Timeline, team size,
|
|
30
|
+
5. Timeline, team size, constraints?
|
|
24
31
|
6. Confidence in the idea (1-5)?
|
|
25
32
|
|
|
26
33
|
**Existing codebase (src/ exists):**
|
|
27
34
|
Check if `.buildflow/codebase/MAP.md` exists.
|
|
28
|
-
- If NO: "Run
|
|
29
|
-
- If YES: Load MAP.md. Ask about goals for this
|
|
35
|
+
- If NO: "Run `/buildflow-onboard` first to analyze your codebase."
|
|
36
|
+
- If YES: Load MAP.md summary only (not full file). Ask about goals for this session.
|
|
30
37
|
|
|
31
38
|
## Step 3: Save Vision
|
|
32
|
-
Write to `.buildflow/core/vision.md
|
|
39
|
+
Write to `.buildflow/core/vision.md`.
|
|
40
|
+
Initialize `light.md` with:
|
|
41
|
+
```yaml
|
|
42
|
+
app_name: [name]
|
|
43
|
+
framework: [detected or stated]
|
|
44
|
+
language: [detected or stated]
|
|
45
|
+
phase: 0
|
|
46
|
+
spec_status: none
|
|
47
|
+
plan_status: none
|
|
48
|
+
onboard_status: [yes/no]
|
|
49
|
+
last_session: [today]
|
|
50
|
+
```
|
|
33
51
|
|
|
34
52
|
## Step 4: Recommend Next Step
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
53
|
+
|
|
54
|
+
| Situation | Next command |
|
|
55
|
+
|-----------|-------------|
|
|
56
|
+
| Greenfield, confidence 4–5 | `/buildflow-spec` — define what to build formally |
|
|
57
|
+
| Greenfield, confidence 1–3 | `/buildflow-think [topic]` — research first |
|
|
58
|
+
| Existing project, not onboarded | `/buildflow-onboard` — map codebase first |
|
|
59
|
+
| Existing project, onboarded | `/buildflow-spec` or `/buildflow-modify` |
|
|
60
|
+
| Emergency fix needed | `/buildflow-hotfix "description"` |
|
|
61
|
+
|
|
62
|
+
## light.md Pruning Rules
|
|
63
|
+
If `light.md` exceeds 3K tokens on session start:
|
|
64
|
+
- Remove: completed phase task lists, wave details, build timestamps older than last phase
|
|
65
|
+
- Archive these to the most recent `phases/[N]/retro.md`
|
|
66
|
+
- Keep: app_name, framework, language, current_phase, spec_status, style_fingerprint, last 2 decisions
|
|
67
|
+
- After pruning: report "Context pruned: light.md reduced from [X] → [Y] tokens"
|
|
38
68
|
|
|
39
69
|
## Token Budget: ~8K
|
|
@@ -1,49 +1,197 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: buildflow-think
|
|
3
|
-
description:
|
|
3
|
+
description: Deep research, architecture review, build-vs-buy reasoning, and engineering cognition
|
|
4
4
|
allowed-tools: Read, Write, WebSearch
|
|
5
5
|
agents: strategist, researcher, synthesizer
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# /buildflow-think
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Research, reasoning, and architecture review. Spawns parallel Researchers when web evidence is needed. Synthesizes conflicting information into a concrete recommendation with confidence score.
|
|
11
|
+
|
|
12
|
+
Goes beyond research — includes engineering cognition modes for architecture review, build-vs-buy analysis, technical debt assessment, and complexity budgeting.
|
|
11
13
|
|
|
12
14
|
## Usage
|
|
13
|
-
- `/buildflow-think
|
|
14
|
-
- `/buildflow-think <topic>` — research a specific topic
|
|
15
|
+
- `/buildflow-think <topic>` — research a specific topic or technology
|
|
15
16
|
- `/buildflow-think tech-stack` — compare technology options
|
|
16
|
-
- `/buildflow-think risks` —
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
17
|
+
- `/buildflow-think risks` — surface technical and product risks
|
|
18
|
+
- `/buildflow-think --arch` — architecture review of current codebase or proposed design
|
|
19
|
+
- `/buildflow-think --build-vs-buy <capability>` — should we build it or use a library/service?
|
|
20
|
+
- `/buildflow-think --debt` — assess current technical debt and prioritize
|
|
21
|
+
- `/buildflow-think --complexity` — is the proposed plan too complex for the team/timeline?
|
|
22
|
+
|
|
23
|
+
## Context Packet
|
|
24
|
+
- `.buildflow/core/vision.md`
|
|
25
|
+
- `.buildflow/memory/light.md` (app_name, framework, key decisions only)
|
|
26
|
+
- `.buildflow/codebase/MAP.md` (for --arch, --debt, --complexity modes)
|
|
27
|
+
- `.buildflow/specs/TDD.md` (for --arch mode, if exists)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Standard Research Mode (default)
|
|
32
|
+
|
|
33
|
+
### Step 1: Clarify Research Goal
|
|
34
|
+
If topic is specified, confirm understanding in one sentence.
|
|
35
|
+
If open-ended: "What are you trying to decide or understand?"
|
|
36
|
+
|
|
37
|
+
### Step 2: Decompose into Research Questions
|
|
38
|
+
Break the topic into 2–3 specific, answerable sub-questions.
|
|
39
|
+
Assign one to each Researcher agent.
|
|
40
|
+
|
|
41
|
+
### Step 3: Parallel Research
|
|
42
|
+
Spawn up to 3 Researcher agents simultaneously, each:
|
|
43
|
+
- Answering their specific sub-question
|
|
44
|
+
- Finding 2–3 sources
|
|
45
|
+
- Rating each source trust: 1 (blog opinion) → 5 (official docs / peer-reviewed)
|
|
46
|
+
- Summarizing key findings in bullet points
|
|
47
|
+
|
|
48
|
+
### Step 4: Synthesize
|
|
49
|
+
Synthesizer combines all findings:
|
|
50
|
+
- **Consensus:** what all sources agree on
|
|
51
|
+
- **Conflicts:** where sources disagree — flag explicitly with each position
|
|
52
|
+
- **Gaps:** what the research didn't answer
|
|
53
|
+
- **Recommendation:** concrete, actionable, with confidence (1–5)
|
|
54
|
+
- **Risks:** what could go wrong with the recommendation
|
|
55
|
+
|
|
56
|
+
### Step 5: Confidence Gate
|
|
57
|
+
If confidence < 3: "Low confidence. Here's what would increase it: [specific gaps to fill]"
|
|
58
|
+
If confidence ≥ 4: suggest next step (spec / plan / build)
|
|
59
|
+
|
|
60
|
+
### Step 6: Save
|
|
61
|
+
Write `.buildflow/research/[topic]-[date].md`
|
|
62
|
+
Update `light.md` key decisions if a choice was made.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Architecture Review Mode (`--arch`)
|
|
67
|
+
|
|
68
|
+
Triggered when: designing a new system, evaluating a proposed approach, or onboarding to a codebase.
|
|
69
|
+
|
|
70
|
+
### Step 1: Load Architecture Context
|
|
71
|
+
Read `MAP.md`, `TDD.md` (if exists), `PATTERNS.md`.
|
|
72
|
+
If greenfield: work from vision + proposed TDD.
|
|
73
|
+
|
|
74
|
+
### Step 2: Structural Analysis
|
|
75
|
+
Evaluate:
|
|
76
|
+
- **Separation of concerns** — do modules have single, clear responsibilities?
|
|
77
|
+
- **Coupling** — are modules tightly bound in ways that make changes expensive?
|
|
78
|
+
- **Cohesion** — does each module contain related things?
|
|
79
|
+
- **Boundaries** — are module boundaries enforced or leaky?
|
|
80
|
+
- **Scalability** — will this design hold under 10× the current load/data?
|
|
81
|
+
|
|
82
|
+
### Step 3: Pattern Consistency
|
|
83
|
+
Does the proposed design follow existing patterns in the codebase?
|
|
84
|
+
If introducing new patterns: is there a good reason, or is it accidental inconsistency?
|
|
85
|
+
|
|
86
|
+
### Step 4: Failure Mode Analysis
|
|
87
|
+
For each major component, ask: "What happens when this fails?"
|
|
88
|
+
- Does the failure cascade?
|
|
89
|
+
- Is there a recovery path?
|
|
90
|
+
- Will the user see a clear error or silent corruption?
|
|
91
|
+
|
|
92
|
+
### Step 5: Engineering Smell Detection
|
|
93
|
+
Flag any of these if present:
|
|
94
|
+
- **God object** — one class/module doing too many things
|
|
95
|
+
- **Shotgun surgery** — a single logical change requires edits across many files
|
|
96
|
+
- **Primitive obsession** — using raw strings/numbers where domain types would be clearer
|
|
97
|
+
- **Anemic model** — data objects with no behavior, all logic in services
|
|
98
|
+
- **Circular dependency** — A imports B imports A
|
|
99
|
+
- **Distributed monolith** — microservices that can't deploy independently
|
|
100
|
+
|
|
101
|
+
### Step 6: Architecture Report
|
|
102
|
+
```
|
|
103
|
+
Architecture Review
|
|
104
|
+
───────────────────
|
|
105
|
+
Strengths: [what's well-designed]
|
|
106
|
+
Concerns: [issues with severity: HIGH / MEDIUM / LOW]
|
|
107
|
+
Smells detected: [list or NONE]
|
|
108
|
+
Failure modes: [unhandled scenarios]
|
|
109
|
+
Recommendation: [concrete changes or "proceed as-is"]
|
|
110
|
+
Confidence: [1–5]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Build vs Buy Mode (`--build-vs-buy <capability>`)
|
|
116
|
+
|
|
117
|
+
Triggered when evaluating whether to implement a capability in-house or use an external library/service.
|
|
118
|
+
|
|
119
|
+
### Step 1: Define the Capability
|
|
120
|
+
Exact scope: what does this need to do? What are the boundaries?
|
|
121
|
+
|
|
122
|
+
### Step 2: Research Options
|
|
123
|
+
Parallel Researchers investigate:
|
|
124
|
+
- **Build** — what would implementation cost? What's the maintenance burden?
|
|
125
|
+
- **Buy (OSS)** — what libraries exist? License, maintenance status, community health?
|
|
126
|
+
- **Buy (SaaS)** — what services exist? Cost, reliability, vendor lock-in risk?
|
|
127
|
+
|
|
128
|
+
### Step 3: Evaluation Matrix
|
|
129
|
+
| Factor | Build | OSS Library | SaaS |
|
|
130
|
+
|--------|-------|-------------|------|
|
|
131
|
+
| Time to working | [est] | [est] | [est] |
|
|
132
|
+
| Ongoing maintenance | high | low–med | none |
|
|
133
|
+
| Customization | full | partial | limited |
|
|
134
|
+
| Cost | dev time | free (usually) | $/mo |
|
|
135
|
+
| Vendor lock-in | none | low | HIGH |
|
|
136
|
+
| Compliance fit | full control | depends | verify |
|
|
137
|
+
| Team expertise needed | yes | some | low |
|
|
138
|
+
|
|
139
|
+
### Step 4: Recommendation
|
|
140
|
+
Given project constraints (team size, timeline, compliance from PRD):
|
|
141
|
+
- **Recommend:** [build / OSS / SaaS]
|
|
142
|
+
- **Reason:** [top 2 factors that drove the decision]
|
|
143
|
+
- **Risk:** [biggest downside of this choice]
|
|
144
|
+
- **Confidence:** [1–5]
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Technical Debt Mode (`--debt`)
|
|
149
|
+
|
|
150
|
+
### Step 1: Load Hotspots
|
|
151
|
+
Read `HOTSPOTS.md`. These are the known high-risk files.
|
|
152
|
+
|
|
153
|
+
### Step 2: Debt Classification
|
|
154
|
+
For each hotspot and any other known issues:
|
|
155
|
+
|
|
156
|
+
| Item | Type | Impact | Cost to Fix | ROI |
|
|
157
|
+
|------|------|--------|------------|-----|
|
|
158
|
+
| [issue] | CODE / ARCH / TEST / INFRA | HIGH/MED/LOW | S/M/L/XL | high/med/low |
|
|
159
|
+
|
|
160
|
+
Debt types:
|
|
161
|
+
- **CODE** — complexity, duplication, poor naming
|
|
162
|
+
- **ARCH** — wrong abstraction, bad module boundary, circular dep
|
|
163
|
+
- **TEST** — missing or shallow test coverage on critical paths
|
|
164
|
+
- **INFRA** — outdated deps, missing CI, manual steps that should be automated
|
|
165
|
+
|
|
166
|
+
### Step 3: Priority Recommendation
|
|
167
|
+
Sort by ROI (impact of fixing ÷ cost to fix). Top 3 items to address next.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Complexity Budget Mode (`--complexity`)
|
|
172
|
+
|
|
173
|
+
Used before a plan is executed to ask: "Is this too much for the team/timeline?"
|
|
174
|
+
|
|
175
|
+
### Step 1: Load Plan
|
|
176
|
+
Read `phases/[N]/PLAN.md`. Sum effort estimates.
|
|
177
|
+
|
|
178
|
+
### Step 2: Complexity Assessment
|
|
179
|
+
```
|
|
180
|
+
Complexity Budget Check
|
|
181
|
+
───────────────────────
|
|
182
|
+
Total estimated effort: [sum]
|
|
183
|
+
XL tasks: [N] — [list them] ← each XL is a risk
|
|
184
|
+
External dependencies: [N] ← each is a coordination cost
|
|
185
|
+
New patterns introduced: [N] ← each needs learning time
|
|
186
|
+
Files touching hotspots: [N] ← each is higher risk
|
|
187
|
+
|
|
188
|
+
Verdict: FEASIBLE / RISKY / OVER-SCOPED
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- **FEASIBLE** — proceed
|
|
192
|
+
- **RISKY** — flag XL tasks for `/buildflow-think` before building, consider splitting
|
|
193
|
+
- **OVER-SCOPED** — recommend cutting scope, suggest which features to defer
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Token Budget: ~30K (standard) / ~35K (--arch or --build-vs-buy) / ~20K (--debt or --complexity)
|