What Are We Building?
Human-heavy planning phase. No implementation here — only understanding.
Variables
FEATURE_CONTEXT: $ARGUMENTS — feature idea or existing feature
PLAN_COMMAND: /dev:plan
ITERATE_COMMAND: /dev:iterate
DONE_COMMAND: /dev:done
WORKTREE_MANAGER_AGENT: worktree-manager
DECOMPOSE_SKILL: dev/how
Prerequisites
- If this was invoked directly, the conversation determines whether it is a fresh plan or a revision.
- If checkout safety is unclear, ask
$WORKTREE_MANAGER_AGENT to assess the current checkout for planning before writing artifacts.
FEATURE_CONTEXT may be empty or vague; use conversation to elicit the actual feature.
Knowledge
Feature Resolution
Resolve features in this order:
- exact
.dev/<feature>/prd.md
- exact feature slug
- unique case-insensitive substring match
- otherwise stop and require explicit selection
If the feature directory does not exist yet, create it as needed.
Context Isolation
Each phase runs in a fresh context window. The next phase only receives .dev/<feature>/ artifacts, not the conversation. If it is not written to a file, it is lost.
Hard Gate
Do not proceed to $DECOMPOSE_SKILL until .dev/<feature>/prd.md exists and has been approved.
Dependency Inspectability
Classify each external dependency before planning:
| Category |
Example |
Verification path |
| In-repo code |
Project modules, workspace packages |
Read the source directly |
| Inspectable package |
npm module, open-source library |
Read exported types, source, or vendored code |
| Black-box / binary |
CLI tools, closed-source APIs, SaaS endpoints |
Verify through execution |
For black-box dependencies, docs are never enough — write learning tests. Use references/research.md for inspectable-dependency research techniques and references/learning-tests.md for the learning-test protocol.
Artifact Layout
All artifacts live under .dev/<feature>/:
.dev/<feature>/prd.md — required, self-contained spec
.dev/<feature>/research.md — optional research notes
.dev/<feature>/lt-*.ts / .dev/<feature>/lt-*.sh — optional learning tests
- other reference files as needed
prd.md must stay self-contained. Use references/prd-schema.md for the full section template and field rules.
Planning Safety
What and How may happen on trunk or another branch. Do not require a worktree just to plan; orchestration normally belongs to $PLAN_COMMAND or $ITERATE_COMMAND.
Procedures
- Resolve or reuse a short kebab-case feature slug and use
.dev/<feature>/ for all artifacts.
- Read
specs/README.md if it exists, then read the relevant persistent specs for the feature area.
- Understand the feature with the user: problem, audience, success, constraints, and non-goals.
- Surface unknowns, especially external APIs, sparse docs, black-box behaviour, and taste decisions.
- Research inspectable dependencies using
references/research.md; for black-box dependencies, immediately write and run learning tests using references/learning-tests.md.
- Prototype only when needed to resolve taste, UX, or architectural questions.
- Refine everything into files under
.dev/<feature>/, following references/prd-schema.md for the PRD structure.
- Commit only this feature's planning artifacts.
Constraints
- Never skip refinement, even for trivial features.
- Open questions must be resolved before saving
prd.md.
- Prototype code must be deleted before saving.
- Do not rely on conversation history as handoff material.
- No unverified black-box claims in the PRD.
- Leave the git tree clean by committing the planning artifacts before finishing.
Validation
.dev/<feature>/prd.md exists and has no open questions
- All black-box claims are backed by passing learning tests
- No prototype code remains
- All artifacts are under
.dev/<feature>/
git status --porcelain is clean after the commit
- The PRD is understandable without this conversation
1---2name: what3description: Define what to build through structured research and experimentation. Produces or revises `.dev/<feature>/prd.md`. Triggers on: "what should we build", "let's plan", "new feature", "I want to build", "dev/what"4---56# What Are We Building?78Human-heavy planning phase. No implementation here — only understanding.910## Variables1112- `FEATURE_CONTEXT`: `$ARGUMENTS` — feature idea or existing feature13- `PLAN_COMMAND`: `/dev:plan`14- `ITERATE_COMMAND`: `/dev:iterate`15- `DONE_COMMAND`: `/dev:done`16- `WORKTREE_MANAGER_AGENT`: `worktree-manager`17- `DECOMPOSE_SKILL`: `dev/how`1819## Prerequisites2021- If this was invoked directly, the conversation determines whether it is a fresh plan or a revision.22- If checkout safety is unclear, ask `$WORKTREE_MANAGER_AGENT` to assess the current checkout for planning before writing artifacts.23- `FEATURE_CONTEXT` may be empty or vague; use conversation to elicit the actual feature.2425## Knowledge2627### Feature Resolution2829Resolve features in this order:30311. exact `.dev/<feature>/prd.md`322. exact feature slug333. unique case-insensitive substring match344. otherwise stop and require explicit selection3536If the feature directory does not exist yet, create it as needed.3738### Context Isolation3940Each phase runs in a fresh context window. The next phase only receives `.dev/<feature>/` artifacts, not the conversation. If it is not written to a file, it is lost.4142### Hard Gate4344Do not proceed to `$DECOMPOSE_SKILL` until `.dev/<feature>/prd.md` exists and has been approved.4546### Dependency Inspectability4748Classify each external dependency before planning:4950| Category | Example | Verification path |51|---|---|---|52| In-repo code | Project modules, workspace packages | Read the source directly |53| Inspectable package | npm module, open-source library | Read exported types, source, or vendored code |54| Black-box / binary | CLI tools, closed-source APIs, SaaS endpoints | Verify through execution |5556For black-box dependencies, docs are never enough — write learning tests. Use `references/research.md` for inspectable-dependency research techniques and `references/learning-tests.md` for the learning-test protocol.5758### Artifact Layout5960All artifacts live under `.dev/<feature>/`:6162- `.dev/<feature>/prd.md` — required, self-contained spec63- `.dev/<feature>/research.md` — optional research notes64- `.dev/<feature>/lt-*.ts` / `.dev/<feature>/lt-*.sh` — optional learning tests65- other reference files as needed6667`prd.md` must stay self-contained. Use `references/prd-schema.md` for the full section template and field rules.6869### Planning Safety7071What and How may happen on trunk or another branch. Do not require a worktree just to plan; orchestration normally belongs to `$PLAN_COMMAND` or `$ITERATE_COMMAND`.7273## Procedures74751. Resolve or reuse a short kebab-case feature slug and use `.dev/<feature>/` for all artifacts.762. Read `specs/README.md` if it exists, then read the relevant persistent specs for the feature area.773. Understand the feature with the user: problem, audience, success, constraints, and non-goals.784. Surface unknowns, especially external APIs, sparse docs, black-box behaviour, and taste decisions.795. Research inspectable dependencies using `references/research.md`; for black-box dependencies, immediately write and run learning tests using `references/learning-tests.md`.806. Prototype only when needed to resolve taste, UX, or architectural questions.817. Refine everything into files under `.dev/<feature>/`, following `references/prd-schema.md` for the PRD structure.828. Commit only this feature's planning artifacts.8384## Constraints8586- Never skip refinement, even for trivial features.87- Open questions must be resolved before saving `prd.md`.88- Prototype code must be deleted before saving.89- Do not rely on conversation history as handoff material.90- No unverified black-box claims in the PRD.91- Leave the git tree clean by committing the planning artifacts before finishing.9293## Validation9495- `.dev/<feature>/prd.md` exists and has no open questions96- All black-box claims are backed by passing learning tests97- No prototype code remains98- All artifacts are under `.dev/<feature>/`99- `git status --porcelain` is clean after the commit100- The PRD is understandable without this conversation