Vibe: PRD-Driven Development with Memory Bank
Router: Detect Current Phase
Before doing anything, run pwd to confirm the working directory. This is where the project lives.
Check what already exists in the project to determine the current phase:
- Run
ls to see project structure
- Look for
memory-bank/ directory and its contents
- Check for
CLAUDE.md (Claude Code), AGENTS.md (Codex) in the project root
- Treat files that are empty, clearly incomplete, or still contain template placeholders as missing
Dispatch based on what you find. Apply the first matching row from top to bottom; "has" means the artifact exists and is usable under the missing-file rule above.
| What exists |
Phase |
Load reference |
No memory-bank/prd.md, and user hasn't described an idea yet |
Phase 0: Discover |
Load references/phase-prd.md |
No memory-bank/prd.md, but user has already described their idea |
Phase 1: PRD |
Load references/phase-prd.md |
Has PRD but no memory-bank/tech-stack.md |
Phase 2: Tech Stack |
Load references/phase-techstack.md |
Has PRD + tech stack but no AI rules file (CLAUDE.md / AGENTS.md) |
Phase 3: Rules Init |
Load references/phase-rulesinit.md |
Has PRD + tech stack + rules file but no interface design file (memory-bank/interface-design.md) |
Phase 4: Interface Design |
Load references/phase-interface.md |
Has PRD + tech stack + rules + interface design but no memory-bank/implementation-plan.md |
Phase 5: Plan |
Load references/phase-plan.md |
| Has PRD + tech stack + rules + interface design + plan |
Phase 6: Execute |
Load references/phase-execute.md |
Required memory bank files (created during planning phases; progress.md and architecture.md are auto-created on first execution if missing):
prd.md
tech-stack.md
interface-design.md
implementation-plan.md
progress.md
architecture.md
Rollback warning: If the router detects a gap (e.g., tech-stack.md is missing but implementation-plan.md exists), warn the user that downstream files may be inconsistent and offer to regenerate them. Similarly, if a phase re-creates an upstream file (e.g., regenerating prd.md), warn that all downstream files — tech-stack.md, interface-design.md, implementation-plan.md — are now stale and offer to regenerate them in order.
After loading the relevant reference, follow its instructions completely, subject to higher-priority system, developer, and user instructions. Do not skip phases.
After a phase completes and the user approves, re-evaluate the Router to determine the next phase. The Router checks what exists in the project — since each phase creates new files, it will match a later row and load the next reference. When the user says "yes" to a "Ready to move to X?" prompt, read the Router table again to determine which reference to load next.
Hard Rules
- No product code until Phase 6 (Execute). Phases 0-5 produce only
.md files and the AI rules file.
- One phase at a time. Do not auto-advance between phases. Present the output, get user approval, then ask to continue.
- Small steps in the plan. Each implementation step must be small enough to validate with a test. If a step would touch more than 3 files, split it, except for a dedicated scaffold step that only initializes framework boilerplate.
- AI writes tests, user confirms. The AI generates the test for each step. Run the test automatically and show results. In step-by-step mode, wait for user confirmation before advancing. In auto mode, advance immediately on green tests.
- Commit after each step. After a step passes tests (and user confirms in step-by-step mode), create a git commit that stages only files changed for that step. If the user explicitly disallows commits, update the memory bank instead.
- Clear context before Plan and before Execute. Suggest the user run
/clear when entering Phase 5 (Plan) and Phase 6 (Execute). Memory bank files carry all needed state across phase boundaries.
- Confirm plan clarity. Before writing any code in Phase 6, read the implementation plan aloud and ask: "Is this implementation plan clear and complete? Any steps you want to change or clarify before I start coding?"
Gotchas
| What happened |
Rule |
| User's idea is too vague ("a cool app") |
Ask 5-8 clarifying questions before generating any PRD. Do not invent features. |
| PRD balloons to 50+ features |
Push back: focus on MVP only. Details come later via feature files. |
| Tech stack proposal is over-engineered |
Challenge: "What's the simplest stack that handles X?" |
| Interface design becomes pixel-perfect wireframes |
Push back: describe surfaces, flows, structure, state/data, and error behavior. Visual polish comes during implementation. |
| Implementation plan step is too large |
Reject and ask for it to be split into sub-steps with individual tests. |
| Implementation plan step lacks a test |
Reject. Every step must have a concrete test before approval. |
| User says "just build it" or "帮我做" |
Treat as approval to start the Vibe workflow, not as approval to skip phase review. Run the Router, complete missing phases in order, and confirm before entering Phase 6. |
| Tests fail after implementation |
Do not advance. Diagnose the failure, fix, re-run. If stuck after 3 attempts, preserve user work: do not run a blanket stash; follow the recovery rules in references/phase-execute.md. |
| No test framework exists |
Scaffold the test framework named in tech-stack.md before implementation. Ask the user only if the tech stack is missing, ambiguous, or has multiple reasonable test choices. |
| No AI rules file detected |
Generate one for the CLI the user is running. If unclear, ask the user whether to create CLAUDE.md or AGENTS.md. |
| Router detects a gap in artifacts |
Warn: "{later file} exists but {earlier file} is missing. Downstream files may be inconsistent." Offer to regenerate from this phase forward. |
| User wants to revise a completed step |
See "Revising Completed Steps" in references/phase-execute.md. |
1---2name: vibe3description: Invoke when the user wants to build a project or new feature (app, game, CLI, API, tool) using the Vibe Coding methodology. PRD-first, phased planning, step-by-step execution with memory bank. Not for debugging or refactoring existing code.4---56# Vibe: PRD-Driven Development with Memory Bank78## Router: Detect Current Phase910**Before doing anything, run `pwd` to confirm the working directory.** This is where the project lives.1112Check what already exists in the project to determine the current phase:13141. Run `ls` to see project structure152. Look for `memory-bank/` directory and its contents163. Check for `CLAUDE.md` (Claude Code), `AGENTS.md` (Codex) in the project root174. Treat files that are empty, clearly incomplete, or still contain template placeholders as missing1819Dispatch based on what you find. Apply the first matching row from top to bottom; "has" means the artifact exists and is usable under the missing-file rule above.2021| What exists | Phase | Load reference |22|-------------|-------|----------------|23| No `memory-bank/prd.md`, and user hasn't described an idea yet | Phase 0: Discover | Load `references/phase-prd.md` |24| No `memory-bank/prd.md`, but user has already described their idea | Phase 1: PRD | Load `references/phase-prd.md` |25| Has PRD but no `memory-bank/tech-stack.md` | Phase 2: Tech Stack | Load `references/phase-techstack.md` |26| Has PRD + tech stack but no AI rules file (`CLAUDE.md` / `AGENTS.md`) | Phase 3: Rules Init | Load `references/phase-rulesinit.md` |27| Has PRD + tech stack + rules file but no interface design file (`memory-bank/interface-design.md`) | Phase 4: Interface Design | Load `references/phase-interface.md` |28| Has PRD + tech stack + rules + interface design but no `memory-bank/implementation-plan.md` | Phase 5: Plan | Load `references/phase-plan.md` |29| Has PRD + tech stack + rules + interface design + plan | Phase 6: Execute | Load `references/phase-execute.md` |3031Required memory bank files (created during planning phases; `progress.md` and `architecture.md` are auto-created on first execution if missing):32- `prd.md`33- `tech-stack.md`34- `interface-design.md`35- `implementation-plan.md`36- `progress.md`37- `architecture.md`3839**Rollback warning:** If the router detects a gap (e.g., `tech-stack.md` is missing but `implementation-plan.md` exists), warn the user that downstream files may be inconsistent and offer to regenerate them. Similarly, if a phase re-creates an upstream file (e.g., regenerating `prd.md`), warn that all downstream files — `tech-stack.md`, `interface-design.md`, `implementation-plan.md` — are now stale and offer to regenerate them in order.4041**After loading the relevant reference, follow its instructions completely, subject to higher-priority system, developer, and user instructions. Do not skip phases.**4243**After a phase completes and the user approves, re-evaluate the Router to determine the next phase.** The Router checks what exists in the project — since each phase creates new files, it will match a later row and load the next reference. When the user says "yes" to a "Ready to move to X?" prompt, read the Router table again to determine which reference to load next.4445## Hard Rules4647- **No product code until Phase 6 (Execute).** Phases 0-5 produce only `.md` files and the AI rules file.48- **One phase at a time.** Do not auto-advance between phases. Present the output, get user approval, then ask to continue.49- **Small steps in the plan.** Each implementation step must be small enough to validate with a test. If a step would touch more than 3 files, split it, except for a dedicated scaffold step that only initializes framework boilerplate.50- **AI writes tests, user confirms.** The AI generates the test for each step. Run the test automatically and show results. In step-by-step mode, wait for user confirmation before advancing. In auto mode, advance immediately on green tests.51- **Commit after each step.** After a step passes tests (and user confirms in step-by-step mode), create a git commit that stages only files changed for that step. If the user explicitly disallows commits, update the memory bank instead.52- **Clear context before Plan and before Execute.** Suggest the user run `/clear` when entering Phase 5 (Plan) and Phase 6 (Execute). Memory bank files carry all needed state across phase boundaries.53- **Confirm plan clarity.** Before writing any code in Phase 6, read the implementation plan aloud and ask: "Is this implementation plan clear and complete? Any steps you want to change or clarify before I start coding?"5455## Gotchas5657| What happened | Rule |58|---------------|------|59| User's idea is too vague ("a cool app") | Ask 5-8 clarifying questions before generating any PRD. Do not invent features. |60| PRD balloons to 50+ features | Push back: focus on MVP only. Details come later via feature files. |61| Tech stack proposal is over-engineered | Challenge: "What's the simplest stack that handles X?" |62| Interface design becomes pixel-perfect wireframes | Push back: describe surfaces, flows, structure, state/data, and error behavior. Visual polish comes during implementation. |63| Implementation plan step is too large | Reject and ask for it to be split into sub-steps with individual tests. |64| Implementation plan step lacks a test | Reject. Every step must have a concrete test before approval. |65| User says "just build it" or "帮我做" | Treat as approval to start the Vibe workflow, not as approval to skip phase review. Run the Router, complete missing phases in order, and confirm before entering Phase 6. |66| Tests fail after implementation | Do not advance. Diagnose the failure, fix, re-run. If stuck after 3 attempts, preserve user work: do not run a blanket stash; follow the recovery rules in `references/phase-execute.md`. |67| No test framework exists | Scaffold the test framework named in `tech-stack.md` before implementation. Ask the user only if the tech stack is missing, ambiguous, or has multiple reasonable test choices. |68| No AI rules file detected | Generate one for the CLI the user is running. If unclear, ask the user whether to create `CLAUDE.md` or `AGENTS.md`. |69| Router detects a gap in artifacts | Warn: "{later file} exists but {earlier file} is missing. Downstream files may be inconsistent." Offer to regenerate from this phase forward. |70| User wants to revise a completed step | See "Revising Completed Steps" in `references/phase-execute.md`. |