archgen-skill 0.0.4 → 0.0.6

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 (37) hide show
  1. package/README.md +39 -45
  2. package/bin/archgen.mjs +30 -6
  3. package/lib/block.js +55 -9
  4. package/lib/bootstrap.js +103 -0
  5. package/lib/doctor.js +67 -5
  6. package/lib/init.js +43 -4
  7. package/lib/install.js +40 -4
  8. package/lib/mcp-server.js +159 -0
  9. package/lib/migrations/001-stamp-provenance.mjs +3 -3
  10. package/lib/spawn-npm.js +54 -0
  11. package/lib/store.js +174 -9
  12. package/lib/uninstall-project.js +16 -3
  13. package/lib/version-stamp.js +3 -1
  14. package/lib/version.js +11 -3
  15. package/package.json +5 -4
  16. package/vendor/skills/archgen/SKILL.md +370 -315
  17. package/vendor/skills/archgen/archgen.config.json +1 -1
  18. package/vendor/skills/archgen/references/code-standards.md +2 -2
  19. package/vendor/skills/archgen/assets/mcp-template.json +0 -42
  20. package/vendor/skills/archgen/assets/skill-registry.json +0 -24
  21. package/vendor/skills/archgen/references/artifact-templates.md +0 -349
  22. package/vendor/skills/archgen/references/interview.md +0 -230
  23. package/vendor/skills/archgen/references/mcp-and-skills.md +0 -117
  24. package/vendor/skills/archgen/references/orchestration.md +0 -169
  25. package/vendor/skills/archgen/references/platforms.md +0 -83
  26. package/vendor/skills/archgen/scripts/doc-index.mjs +0 -457
  27. package/vendor/skills/archgen/scripts/impact.mjs +0 -77
  28. package/vendor/skills/archgen/scripts/lib/graph.mjs +0 -207
  29. package/vendor/skills/archgen/scripts/lib/plan-coverage.mjs +0 -32
  30. package/vendor/skills/archgen/scripts/lib/scope.mjs +0 -65
  31. package/vendor/skills/archgen/scripts/lib/yaml.mjs +0 -492
  32. package/vendor/skills/archgen/scripts/next-tasks.mjs +0 -55
  33. package/vendor/skills/archgen/scripts/plan-graph.mjs +0 -329
  34. package/vendor/skills/archgen/scripts/set-status.mjs +0 -60
  35. package/vendor/skills/archgen/scripts/update-agents.mjs +0 -204
  36. package/vendor/skills/archgen/scripts/validate.mjs +0 -87
  37. package/vendor/skills/archgen/scripts/verify-plan.mjs +0 -70
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.4",
2
+ "version": "0.0.6",
3
3
  "skillName": "archgen",
4
4
  "markers": {
5
5
  "start": "<!-- archgen:start (managed block - do not edit between markers) -->",
@@ -64,7 +64,7 @@ Per-language conventions (professional, descriptive, consistent):
64
64
 
65
65
  - tasks.yaml acceptance criteria MUST include at least one objectively
66
66
  checkable statement (command exit, observable output).
67
- - The verifier runs verify-plan.mjs AND reads plans against this file;
68
- violations = ISSUES, not warnings.
67
+ - The verifier runs `archgen_plan{action:'verify'}` AND reads plans against this
68
+ file; violations = ISSUES, not warnings.
69
69
  - Workers receive this reference in their prompt contract; "I didn't know" is
70
70
  not available to them.
@@ -1,42 +0,0 @@
1
- {
2
- "_readme": "Canonical MCP server declarations. COPY the variant matching your platform (see references/platforms.md for file paths). Keys DIFFER per platform: mcpServers | servers | mcp | context_servers. Remote URL field varies: url | serverUrl | httpUrl.",
3
- "_claude_code_cursor_windsurf_kiro_gemini": {
4
- "mcpServers": {
5
- "codegraph": {
6
- "type": "stdio",
7
- "command": "npx",
8
- "args": ["-y", "@colbymchenry/codegraph", "mcp"],
9
- "env": {}
10
- },
11
- "context7-remote": {
12
- "type": "http",
13
- "url": "https://mcp.context7.com/mcp",
14
- "headers": { "Authorization": "Bearer ${env:CONTEXT7_TOKEN}" }
15
- }
16
- }
17
- },
18
- "_vscode_copilot": {
19
- "servers": {
20
- "codegraph": { "type": "stdio", "command": "npx", "args": ["-y", "@colbymchenry/codegraph", "mcp"] },
21
- "context7": { "type": "http", "url": "https://mcp.context7.com/mcp" }
22
- },
23
- "inputs": []
24
- },
25
- "_opencode": {
26
- "mcp": {
27
- "codegraph": { "type": "local", "command": ["npx", "-y", "@colbymchenry/codegraph", "mcp"], "environment": {}, "enabled": true },
28
- "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "enabled": true }
29
- }
30
- },
31
- "_zed": {
32
- "context_servers": {
33
- "context7": { "url": "https://mcp.context7.com/mcp" }
34
- }
35
- },
36
- "_codex_toml": {
37
- "_note": "TOML in ~/.codex/config.toml",
38
- "mcp_servers.codegraph": { "command": "npx", "args": ["-y", "@colbymchenry/codegraph", "mcp"] },
39
- "mcp_servers.context7": { "url": "https://mcp.context7.com/mcp" }
40
- },
41
- "_antigravity_warning": "Remote servers MUST use serverUrl (url/httpUrl are rejected): { mcpServers: { name: { serverUrl: '...' } } }"
42
- }
@@ -1,24 +0,0 @@
1
- {
2
- "version": 1,
3
- "skills": [
4
- {
5
- "name": "ui-skills",
6
- "purpose": "Design-engineering skill collection for frontend/UI/UX work: motion, baseline UI, component patterns",
7
- "repo": "ibelick/ui-skills",
8
- "install": "npx skills add ibelick/ui-skills",
9
- "direct_fetch": "npx ui-skills get <skill-name>",
10
- "browse": "npx ui-skills list --category <category>",
11
- "mcp_endpoint": "https://www.ui-skills.com/mcp",
12
- "matches": ["frontend", "ui", "ux", "design", "component", "animation", "motion", "landing page"],
13
- "policy": "required"
14
- },
15
- {
16
- "name": "vercel-skills-installer",
17
- "purpose": "Canonical cross-harness skill installer (75+ agents) - use when a registry entry lacks a direct command",
18
- "repo": "vercel-labs/skills",
19
- "install": "npx skills add <owner>/<repo> [-a <agent>] [-g] [--copy]",
20
- "matches": ["*installer*"],
21
- "policy": "on-demand"
22
- }
23
- ]
24
- }
@@ -1,349 +0,0 @@
1
- # Artifact templates — copy, fill, never invent structure
2
-
3
- ## Provenance header (SHOULD on every NEW tasks.yaml / architecture.yaml)
4
-
5
- Begin both files with three YAML comment lines. Comments are ignored by every
6
- consumer (skill scripts, VS Code extension, any YAML toolchain), so this is
7
- purely additive metadata — it can never break a parser:
8
-
9
- ```yaml
10
- # schema_version: 1
11
- # generator: archgen v0.0.4
12
- # generated_at: 2026-08-26T09:00:00.000Z
13
- ```
14
-
15
- Version token rules — code-defensive, NEVER guess:
16
-
17
- 1. If a `.archgen-version` stamp sits next to `SKILL.md` (the installed skill
18
- root) and reads as exact `MAJOR.MINOR.PATCH`, write `generator: archgen vX.Y.Z`.
19
- 2. Else if an adjacent `archgen.config.json` carries a semver-shaped
20
- `"version"` field, use that value the same way.
21
- 3. Else omit the version token entirely: plain `# generator: archgen`.
22
-
23
- `generated_at` is one ISO-8601 timestamp per generation run (all files written
24
- by the same run share it). Keep the header at the very top of the file; never
25
- place content above it and never encode meaning anywhere except these three
26
- lines.
27
-
28
- Older artifacts without the header are backfilled by
29
- `npx archgen-skill migrate --apply` (dry-run `--check` is the default), which
30
- snapshots each file into `.archgen/.backup/<ts>/migrate/` before touching it
31
- and skips already-stamped files, so re-running is always safe.
32
-
33
- ## Self-containment rules (anti-hallucination)
34
-
35
- Artifacts are executed by sessions and sub-agents that were NEVER part of the
36
- conversation that produced them. Hard rules, no exceptions:
37
-
38
- 1. **Full paths, always.** Every task step, `file_ownership` glob, artifact,
39
- and verification command uses complete repo-root-relative paths
40
- (`src/features/catalog/api/routes.ts`), never bare filenames (`routes.ts`)
41
- and never invented directories. Paths come from `structure:` /
42
- `owns[]` in architecture.yaml or from surveyed code — nowhere else.
43
- 2. **Names derive from naming_conventions.** Every file, symbol, table, and
44
- env-var name you introduce cites WHICH convention key produced it, e.g.
45
- `camelCase symbols per naming_conventions.symbol_casing`. If no key covers
46
- it, add the key first, then use it.
47
- 3. **Plans survive context summarization alone.** Any session reading ONLY
48
- `.archgen/<slug>/` must execute correctly with zero chat history. If a fact
49
- matters, it is written in an artifact; if it is not written, it does not
50
- exist.
51
- 4. **Forbidden phrases** (in any artifact): "as discussed", "the usual
52
- pattern", "same as before", "see chat". Replace each with the concrete
53
- artifact reference it was standing in for.
54
- 5. **Cross-references are artifact-relative**, e.g.
55
- `see ../architecture.yaml data_contracts.orders` or
56
- `payload per ../architecture.yaml api_contracts.payments.request_payload`.
57
- Never restate a contract from memory — point at it.
58
- 6. **Verifier-compatible ids in plans.** `verify-plan.mjs` rejects any
59
- UPPERCASE-numbered token in `plans/*.md` that is not a real tasks.yaml id
60
- (`TASK-999` fails; your actual ids pass). So: requirement ids
61
- (`FR-<MODULE>-nn`) are cited from `tasks.yaml` acceptance lines and
62
- `docs/prd.md` itself; inside plan prose link the anchor instead —
63
- `../docs/prd.md#fr-catalog-01`. Every tasks.yaml id MUST appear in some
64
- plan file (coverage check runs both directions).
65
-
66
- ## Plan depth by scope class
67
-
68
- Pick ONE class before writing any artifact; depth scales with risk, not
69
- enthusiasm. Misclassifying is a defect: inflating SMALL wastes tokens,
70
- shrinking LARGE hallucinates.
71
-
72
- - **SMALL** (add/touch few things): lean plan-note shape stays —
73
-
74
- ```markdown
75
- # <feature> — plan note (SMALL)
76
- Intent: <one paragraph>
77
- Tasks: see tasks.yaml entries <ids>
78
- Risks: <bullets or none>
79
- ```
80
-
81
- Every task entry STILL carries absolute-from-repo-root paths verbatim —
82
- in `file_ownership`, in each step, in verification commands. No Context
83
- section, no diagrams, no PRD.
84
-
85
- - **MEDIUM**: `plans/<feature>.md` gains, in order:
86
- - **Context** — 2–4 paragraphs max: why now, what exists, what changes.
87
- - **Per-task sections** (one `<id> — <title>` heading per task):
88
- Approach (short bullets) + **Edge cases** (min 3 bullets each, feeding
89
- the edge-case matrix below) + **Out-of-scope** (explicit non-goals).
90
- - **Verification steps** — ordered, runnable, repo-root-relative.
91
- No PRD, no diagrams unless structure changed.
92
-
93
- - **LARGE / greenfield-from-scratch**: FULL professional stack — PRD
94
- (`docs/prd.md`, ~1 page per major module) + expanded `architecture.yaml`
95
- (naming_conventions, data_contracts, api_contracts, environment_matrix) +
96
- per-task edge-case matrices + per-module diagrams + MEDIUM-grade plan
97
- sections. Every diagram ≤15 nodes.
98
-
99
- ## architecture.yaml (LARGE scope)
100
-
101
- The four contract blocks below (`naming_conventions`, `data_contracts`,
102
- `api_contracts`, `environment_matrix`) are THE anti-hallucination source of
103
- truth: tasks cite them by key instead of re-describing shapes from memory.
104
- Module entries extend `schemas/architecture-conventions.md` (its
105
- `name`/`responsibility`/`owns[]` trio is unchanged and still normative).
106
-
107
- ```yaml
108
- name: Acme Shop
109
- slug: acme-shop # becomes .archgen/acme-shop/
110
- stack:
111
- language: typescript
112
- runtime: node20
113
- framework: nextjs
114
- database: postgres
115
- structure: # planned folder tree — planned BEFORE code exists
116
- - path: src/features/<feature>/
117
- purpose: feature modules (api, internal, tests colocated)
118
- - path: src/shared/
119
- purpose: cross-feature utilities, no feature imports
120
- - path: src/config/
121
- purpose: env parsing + constants
122
- naming_conventions: # filled during generation; referenced by EVERY task
123
- file_naming: kebab-case files, feature folder mirrors module name
124
- dir_layout: "<module>/{api,internal,tests}; shared code only in src/shared/"
125
- symbol_casing: PascalCase types, camelCase functions, SCREAMING_SNAKE env
126
- test_placement: colocated <name>.test.ts next to unit under test
127
- modules:
128
- - name: catalog
129
- responsibility: product browsing + search
130
- owns: ["src/features/catalog/**"]
131
- depends_on_modules: [] # acyclic; drives task depends_on edges
132
- key_interfaces: # what OTHER modules may import — nothing else
133
- - CatalogApi (src/features/catalog/api/index.ts)
134
- - name: checkout
135
- responsibility: cart → payment orchestration
136
- owns: ["src/features/checkout/**"]
137
- depends_on_modules: [catalog]
138
- key_interfaces:
139
- - CheckoutApi (src/features/checkout/api/index.ts)
140
- data_contracts: # schemas/entities; field tables, not prose
141
- orders:
142
- storage: postgres table orders (migration migrations/NNNN_orders.sql)
143
- fields:
144
- - {field: id, type: uuid, required: true, notes: pk}
145
- - {field: session_id, type: uuid, required: true, notes: fk sessions}
146
- - {field: total_cents, type: integer, required: true, notes: >= 0}
147
- - {field: status, type: enum(pending,paid,failed), required: true}
148
- - {field: created_at, type: timestamptz, required: true, notes: db default now()}
149
- api_contracts: # endpoint/method/auth/payload/error-shape tables
150
- payments:
151
- - endpoint: /api/checkout/pay
152
- method: POST
153
- auth: session cookie; 401 when absent
154
- request_payload: {order_id: uuid}
155
- success: 200 {payment_id: uuid, status: paid}
156
- error_shape: {code: string, message: string, retryable: boolean}
157
- environment_matrix: # vars per env; unparsed vars fail fast in src/config/
158
- - {var: DATABASE_URL, dev: local docker postgres, ci: ephemeral service, prod: secret ref, required: true}
159
- - {var: PAYMENT_API_KEY, dev: stub key, ci: stub key, prod: secret ref, required: true}
160
- decisions: # ADR-lite; full ADRs live in decisions/
161
- - id: D1
162
- title: Postgres over MongoDB
163
- context: transactional orders + reporting queries
164
- decision: Postgres 16 with Prisma
165
- consequences: schema migrations required per release
166
- ```
167
-
168
- Token balance: one contract block per module/domain (~10–20 lines each);
169
- split further rather than letting any single block exceed ~40 lines.
170
-
171
- ## Product requirements document (PRD) — LARGE/greenfield
172
-
173
- Written to `docs/prd.md` BEFORE tasks.yaml. Bullet-dense prose, zero filler
174
- paragraphs; target ~1 page per major module. Requirement ids here are the
175
- stable handles every task acceptance cites.
176
-
177
- ```markdown
178
- # PRD — <project name>
179
-
180
- ## Problem statement & goals
181
- - <pain, quantified where possible>
182
- - Goals: <3–5 outcome bullets, each measurable>
183
-
184
- ## Non-goals
185
- - <explicitly out; prevents scope creep mid-execution>
186
-
187
- ## Personas / stakeholders
188
- - <persona>: <need>, <success looks like>
189
-
190
- ## Functional requirements — <module-name> (repeat per module)
191
- - FR-<MODULE>-01: <single verifiable behavior statement>
192
- - FR-<MODULE>-02: ...
193
- <!-- ids are immutable once tasks reference them -->
194
-
195
- ## Non-functional requirements (measurable targets, no adjectives)
196
- - Perf: p95 API latency < 300 ms at 50 rps; LCP < 2.5 s
197
- - Security: authz check on every endpoint; no secrets in repo; OWASP top-10 reviewed
198
- - i18n: all user-facing strings externalized; ICU plurals; RTL-safe layouts
199
- - A11y: WCAG 2.1 AA; full keyboard nav; contrast ≥ 4.5:1
200
-
201
- ## Success metrics
202
- - <metric>: <baseline> → <target> within <window>
203
-
204
- ## Risks & mitigations
205
- - <risk> → <mitigation>, <owner task id or ADR ref>
206
-
207
- ## Open questions
208
- - <question> — owner <name/role>, blocks <task id | none>
209
- ```
210
-
211
- ## tasks.yaml (canonical shape)
212
-
213
- ```yaml
214
- # comment lines are preserved by set-status.mjs — annotate freely
215
- tasks:
216
- # Core pipeline — do first
217
- - id: C
218
- title: Scaffold project skeleton + config loading
219
- depends_on: []
220
- file_ownership: ["src/config/**", "package.json"] # FULL repo-root-relative paths, never bare filenames
221
- acceptance:
222
- - "npm run build exits 0"
223
- - "config loads from env with typed schema"
224
- - id: B
225
- title: Catalog API endpoints
226
- depends_on: [C]
227
- file_ownership: ["src/features/catalog/**"]
228
- acceptance:
229
- - "GET /products returns seeded list"
230
- - id: A
231
- title: Checkout flow wired to catalog
232
- depends_on: [B]
233
- parallel_group: wave-final
234
- file_ownership: ["src/features/checkout/**"]
235
- artifacts: ["docs/checkout-flow.md"]
236
- acceptance:
237
- - "e2e test completes purchase with stub payment"
238
- ```
239
-
240
- Rules encoded above: depends_on = prerequisites; ownership globs disjoint
241
- within a wave; acceptance = objectively checkable statements. Acceptance
242
- bullets SHOULD reference edge-matrix rows (`E1`–`En` of that task's matrix)
243
- and, on LARGE, the FR ids they implement. Schema stays stable
244
- (`schemas/tasks.schema.json`, schema_version 1) — no new required fields;
245
- guidance lives in comments and plan files.
246
-
247
- LARGE-grade example task (same schema, richer acceptance — sits beside the
248
- minimal ones above, never replaces them):
249
-
250
- ```yaml
251
- - id: PAY-2
252
- title: Order payment capture with retry
253
- depends_on: [A]
254
- parallel_group: wave-payments
255
- file_ownership:
256
- - src/features/checkout/internal/capture.ts # full path per naming_conventions.dir_layout
257
- - src/features/checkout/internal/capture.test.ts # colocated per naming_conventions.test_placement
258
- artifacts: ["docs/payment-retry.md"]
259
- acceptance:
260
- - "capture() sends idempotency key; double submit charges once (E3)"
261
- - "gateway 5xx retries 3x exponential backoff, then raises PaymentFailed (E5)"
262
- - "denied card → 402 with error_shape from ../architecture.yaml api_contracts.payments (FR-PAYMENTS-02)"
263
- - "amounts render via session locale, cents-safe integer math (E6)"
264
- ```
265
-
266
- ## Edge-case matrix (per task, MEDIUM+)
267
-
268
- Each MEDIUM/LARGE task carries a matrix in its plan section. Every row MUST
269
- map to an acceptance bullet — no orphan rows; every acceptance bullet SHOULD
270
- trace to ≥1 row. Minimum coverage classes per task: empty/null, boundary
271
- values, authz denied, concurrent/conflicting write, failure/retry path,
272
- i18n/formatting edge. Tasks touching infra (migrations, deploys, queues)
273
- ADD: partial-failure recovery, rollback story.
274
-
275
- ```markdown
276
- | Case | Input/state | Expected behavior | Covered by |
277
- | ---- | ------------------------------- | ------------------------------------ | ---------- |
278
- | E1 | empty/null: cart with 0 items | 200, total 0, no gateway call | PAY-2#1 |
279
- | E2 | boundary: qty = max allowed 999 | accepted; 1000 rejected with 422 | PAY-2#1 |
280
- | E3 | concurrent: same order paid 2x | idempotency key → single charge | PAY-2#1 |
281
- | E4 | authz denied: expired session | 401 error_shape, no state change | PAY-2#2 |
282
- | E5 | failure/retry: gateway 5xx x3 | backoff retry then PaymentFailed | PAY-2#2 |
283
- | E6 | i18n: locale de-DE, ¥-less cur | EUR formatting, correct decimal comma| PAY-2#3 |
284
- ```
285
-
286
- `Covered by` = `<task-id>#<acceptance index>` (1-based, matching the
287
- tasks.yaml `acceptance` array). Rows are additive across waves; keep each
288
- matrix ≤10 rows — split into per-concern tables beyond that.
289
-
290
- ## ADR template (decisions/NNNN-title.md)
291
-
292
- ```markdown
293
- # NNNN. <decision title>
294
- Date: YYYY-MM-DD · Status: accepted
295
- ## Context
296
- <forces at play>
297
- ## Decision
298
- <what we chose>
299
- ## Consequences
300
- <positive / negative / neutral>
301
- ```
302
-
303
- ## Mermaid snippets
304
-
305
- C4 context:
306
- ```mermaid
307
- graph TB
308
- user([Customer]) --> sys[Acme Shop]
309
- sys --> pay[Stripe]
310
- sys --> mail[Email Service]
311
- ```
312
-
313
- Container:
314
- ```mermaid
315
- graph LR
316
- web[Next.js App] --> api[API Routes]
317
- api --> db[(Postgres)]
318
- api --> cache[(Redis)]
319
- ```
320
-
321
- ## Per-module diagram (LARGE)
322
-
323
- For EACH `modules:` entry in architecture.yaml, one small flowchart of its
324
- internal components plus its `depends_on_modules` edges (arrow points from
325
- consumer to provider). Plus ONE integration diagram wiring all modules —
326
- edges between modules only, no internals. HARD LIMIT: ≤15 nodes per diagram;
327
- split into two diagrams rather than cramming. Internals stay ≤6 nodes per
328
- module.
329
-
330
- Catalog module (internal + inbound depends_on edge):
331
-
332
- ```mermaid
333
- graph LR
334
- subgraph catalog
335
- routes[api routes] --> svc[search service]
336
- svc --> repo[(product repository)]
337
- end
338
- checkout -.->|depends_on CatalogApi| routes
339
- ```
340
-
341
- Integration (modules as atoms, mirrors depends_on_modules):
342
-
343
- ```mermaid
344
- graph LR
345
- accounts --> catalog
346
- cart --> catalog
347
- checkout --> cart
348
- checkout --> accounts
349
- ```
@@ -1,230 +0,0 @@
1
- # Interview playbook — requirement elicitation
2
-
3
- Goal: complete, conflict-free requirements in the FEWEST round-trips.
4
- Batch 3–5 questions per message. Never ask what you can infer.
5
-
6
- ## Round 0 — calibration exchange (skippable)
7
-
8
- Two or three rapid questions, asked once at the very start:
9
-
10
- 1. Rough scale: prototype, MVP, or production-bound?
11
- 2. Team size + convention constraints? (solo? existing lint/CI/style guides?)
12
- 3. Deadline pressure: none, moderate, crunch?
13
-
14
- Purpose is ONLY to pick question-set depth and right-size later verification
15
- rigor — never to collect requirements. SKIP the whole exchange when the user's
16
- opening message already answers these items (e.g. "quick prototype by Friday").
17
- Record whatever was captured under `calibration:` in answers.yaml.
18
-
19
- ## Step 1 — classify intent (decide during round 1)
20
-
21
- From the opening message + calibration, decide ONE intent class, state it to
22
- the user in one sentence, and record it as `intent_class` in answers.yaml:
23
-
24
- | intent_class | Signal | Question depth | Round cap |
25
- |---|---|---|---|
26
- | GREENFIELD-SYSTEM | net-new product/system from scratch; no host repo | full PRD-grade discovery | ≤6 |
27
- | GREENFIELD-MODULE | net-new capability inside an existing system/repo | targeted; infer from host repo first | ≤3 |
28
- | BROWNFIELD-FEATURE | existing repo, additive behavior | survey-first; ask only survey gaps (max ~5 questions) | ≤3 |
29
- | BROWNFIELD-CHANGE | modify existing behavior in place | survey-first; diff current vs desired | ≤3 |
30
-
31
- Never interrogate a BROWNFIELD-FEATURE with PRD-grade questions — token waste,
32
- user annoyance. Round caps INCLUDE round 0 when it runs.
33
-
34
- ## GREENFIELD-SYSTEM — professional discovery (≤6 rounds)
35
-
36
- Creating a system from scratch demands PRD-grade inputs. Each round below
37
- lists its questions and where the answers land (`feeds:` tags — see
38
- Traceability).
39
-
40
- ### R1 — problem, users, success → PRD
41
-
42
- 1. What problem does this solve, for whom — and what is explicitly NOT a goal?
43
- 2. Who uses it? Sketch 1–3 personas: role, key job-to-be-done, environment.
44
- 3. What does success look like — measurable (activation, conversion,
45
- time-saved, error rate)? Adjectives are not metrics.
46
-
47
- ### R2 — shape & module decomposition → architecture.yaml `modules`
48
-
49
- Infer stack/hosting from stated preferences, then confirm:
50
-
51
- 4. Stack + hosting target correct? (state your inference)
52
- 5. Integration surfaces: auth, payments, email, existing APIs?
53
-
54
- Then PROPOSE a strawman module map from the domain talk — one line per
55
- candidate module as `name — responsibility` (mirroring `modules[]`:
56
- name/responsibility/owns) — and ask the user to react:
57
-
58
- 6. React to this strawman module map: [list]. What is missing, misnamed, or
59
- should be merged/split? Iterate until agreement — this seeds
60
- architecture.yaml `modules`.
61
-
62
- ### R3 — data & API sketches → `data_contracts`, `api_contracts`
63
-
64
- 7. Core data entities and relationships — one line each: Entity — key fields —
65
- belongs-to / has-many? (seeds `data_contracts`)
66
- 8. Primary API surface: the 5–10 operations users/systems perform, verb +
67
- resource? (seeds `api_contracts`)
68
-
69
- ### R4 — NFRs with numbers → PRD
70
-
71
- Numbers or it didn't happen — reject "fast"/"scalable" without figures.
72
-
73
- 9. Performance budgets: p95 latency, throughput at peak?
74
- 10. Scale targets: users, reqs/day, data growth per year?
75
- 11. Security/compliance checklist level (GDPR/HIPAA/PCI)? i18n locales?
76
- Accessibility level (e.g. WCAG 2.2 AA)?
77
-
78
- ### R5 — environment & naming → `environment_matrix`, `naming_conventions`
79
-
80
- 12. Environment/deploy reality: which environments exist (dev/staging/prod),
81
- hosting, config/secrets handling, deploy cadence? (seeds
82
- `environment_matrix`)
83
- 13. Naming/brand conventions that already exist: product-name casing, domain
84
- terms to preserve, UI copy language(s)? (seeds `naming_conventions`;
85
- "none" is a valid answer)
86
-
87
- ### R6 — close-out → PRD
88
-
89
- 14. Explicit out-of-scope list — adjacent things on record as NOT in this build?
90
- 15. Top 2 risks you already know about?
91
-
92
- Close by presenting the agreed module map + captured NFR numbers for final
93
- confirmation ([wait for user]).
94
-
95
- ### Traceability — `feeds:` tags
96
-
97
- Every recorded answer MAY carry a `feeds:` tag naming the artifact section it
98
- lands in. Keep the vocabulary literal — downstream templates consume these
99
- exact names:
100
-
101
- - PRD sections: `prd.problem`, `prd.goals`, `prd.non_goals`, `prd.personas`,
102
- `prd.metrics`, `prd.nfrs`, `prd.constraints`, `prd.integrations`,
103
- `prd.risks`, `prd.out_of_scope`
104
- - architecture.yaml keys: `arch.modules`, `arch.data_contracts`,
105
- `arch.api_contracts`, `arch.environment_matrix`, `arch.naming_conventions`
106
-
107
- Multiple targets join with `|`, e.g. `feeds: prd.goals|arch.modules`.
108
-
109
- ## GREENFIELD-MODULE — net-new inside an existing system (≤3 rounds)
110
-
111
- Infer first from the host repo (structure, conventions, neighboring modules),
112
- confirm second:
113
-
114
- 1. Where does it plug in — which host modules does it read from / expose to?
115
- 2. Contract with the host: data it consumes/produces, APIs or events it
116
- exposes? (seeds `data_contracts` / `api_contracts` deltas)
117
- 3. Inherited vs new NFRs: follow host perf/a11y/i18n baselines or set new ones?
118
- 4. Naming follows host conventions — confirm? (seeds `naming_conventions`)
119
-
120
- ## BROWNFIELD classes — survey BEFORE questioning (mandatory)
121
-
122
- Run the survey first (SKILL.md BROWNFIELD steps 1–2): prefer the codegraph MCP
123
- (`codegraph_explore`) when configured, else structured glob/grep; produce or
124
- update `.archgen/<slug>/codebase-map.md`. Then ask ONLY what the survey could
125
- not answer. NEVER ask what a file already answers — quote the file and ask for
126
- confirmation instead.
127
-
128
- ### BROWNFIELD-FEATURE (additive; max ~5 questions, one batched message)
129
-
130
- Ask only unresolved gaps, typically:
131
-
132
- 1. Acceptance criteria the code cannot reveal — exact expected behavior, edge
133
- cases that matter.
134
- 2. Back-compat expectations for existing records or clients.
135
- 3. Rollout preference: feature flag, staged, immediate?
136
- 4. Must-NOT-touch paths beyond what the map shows?
137
- 5. Anything the codebase-map got wrong?
138
-
139
- ### BROWNFIELD-CHANGE (behavior modification; ≤3 rounds)
140
-
141
- Survey focus: current behavior + blast radius (callers, tests, consumers).
142
-
143
- 1. Current vs desired behavior — precise diff, including what must stay.
144
- 2. Compatibility: migrate in place, version alongside, or breaking change?
145
- 3. Acceptance for "changed": how do we prove old behavior is gone and the new
146
- behavior holds?
147
-
148
- ## Conflict detection
149
-
150
- While collecting, watch for and surface immediately:
151
- - Scale vs budget contradictions ("1M users" + "cheapest VPS")
152
- - Feature vs constraint collisions ("real-time" + "no websockets allowed")
153
- - Requirement vs existing-architecture conflicts (brownfield: check codebase-map)
154
-
155
- Format: "I see a tension between X and Y. Which wins?" — one per message,
156
- resolve before proceeding. [wait for user]
157
-
158
- ## Token discipline
159
-
160
- - Batch 3–5 questions per message; never ping-pong one-per-message.
161
- - Hard round caps: GREENFIELD-SYSTEM ≤6 rounds, every other class ≤3
162
- (round 0 counts when it runs).
163
- - Skip any question already answered by the opening message, calibration, or
164
- survey artifacts.
165
-
166
- ## Answers-file format (machine-readable, enables non-interactive runs)
167
-
168
- For scripted E2E or re-runs, requirements may come from a file instead of
169
- conversation — `.archgen/<slug>/answers.yaml`:
170
-
171
- ```yaml
172
- scope_class: MEDIUM # SMALL | MEDIUM | LARGE — UNCHANGED; SKILL.md reads
173
- # this for right-sizing. Never remove or rename.
174
- intent_class: GREENFIELD-SYSTEM # optional: GREENFIELD-SYSTEM |
175
- # GREENFIELD-MODULE | BROWNFIELD-FEATURE |
176
- # BROWNFIELD-CHANGE
177
- calibration: # optional — from round 0
178
- scale: production # prototype | mvp | production
179
- teamConstraints: solo dev, repo lint rules apply
180
- pressure: medium # low | medium | high
181
- problem: one-line problem statement
182
- success_criteria:
183
- - text: measurable outcome # structured entries MAY carry feeds:
184
- feeds: prd.metrics
185
- constraints:
186
- - must-not-change item # plain scalars stay valid; tag via
187
- # trailing comment: # feeds: prd.constraints
188
- non_goals: # optional (GREENFIELD-SYSTEM)
189
- - multi-tenant accounts
190
- personas: # optional (GREENFIELD-SYSTEM)
191
- - role: shopper
192
- goal: find and buy in under two minutes
193
- nfrs: # optional; NUMBERS required for GREENFIELD-SYSTEM
194
- - "p95 API latency < 300ms at 50 rps"
195
- - "locales: en, de"
196
- - "accessibility: WCAG 2.2 AA"
197
- out_of_scope: [] # optional
198
- stack:
199
- language: typescript
200
- runtime: node
201
- hosting: vercel
202
- integrations: [auth0, stripe]
203
- compliance: [] # checklist placeholders only
204
- risks:
205
- - known risk text
206
- ```
207
-
208
- Backward compatibility: ALL additions (`intent_class`, `calibration`,
209
- `non_goals`, `personas`, `nfrs`, `out_of_scope`, per-answer `feeds:` tags) are
210
- OPTIONAL. Existing fields keep their names and semantics; `scope_class` is
211
- retained verbatim because SKILL.md consumes it. Consumers that do not trace
212
- provenance ignore `feeds:` tags in both forms (sibling key on structured
213
- entries, trailing comment on plain scalars).
214
-
215
- The orchestrator treats answers.yaml as authoritative user input and skips
216
- the conversational rounds when it exists and parses cleanly.
217
-
218
- ## Completion test
219
-
220
- Requirements are done when ALL hold:
221
- - Every applicable question in the chosen intent class's question set answered
222
- (or explicitly waived by the user)
223
- - All drafted inferences confirmed or corrected
224
- - Zero unresolved conflicts
225
- - Scope class agreed (SMALL/MEDIUM/LARGE) — this gates artifact generation
226
- (unchanged; SKILL.md consumes it)
227
- - Chosen `intent_class` recorded in answers.yaml
228
- - GREENFIELD-SYSTEM only: module-map agreement reached (user reacted to the
229
- strawman and the revision is confirmed) AND NFR numbers captured — an NFR
230
- without a number fails this gate