craft
Craft something. Claude orchestrates, agents execute.
Instalar con Codex o Claude Copia este prompt, pรฉgalo en Codex, Claude u otro asistente, y deja que revise la pรกgina de la skill y la instale por ti.
Menรบ
Craft something. Claude orchestrates, agents execute.
Instalar con Codex o Claude Copia este prompt, pรฉgalo en Codex, Claude u otro asistente, y deja que revise la pรกgina de la skill y la instale por ti.
Basado en la clasificaciรณn ocupacional SOC
Start a Clean Claude agent with optional reactive links. Examples: /agent frontend-engineer, /agent frontend-engineer --link qa-engineer, /agent architect --link frontend-engineer,qa-engineer
Auto-repair with smart routing: test failures โ Dev, type errors โ Architect, spec gaps โ PO. Routes each problem to the right expert.
Re-run stack detection and skill generation. Use when stack evolved or on first run.
Set up the Clean Claude Reactive System in the current project. Configures hooks, shared state, and scripts for the multi-agent feedback loop
Bootstrap a new frontend project with craft principles: React + Vite + TypeScript + Vitest + clean architecture
Add specialized craft skills to agents. Default craft principles always active. Everything MUST respect the craft philosophy.
| name | craft |
| description | Craft something. Claude orchestrates, agents execute. |
| context | conversation |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep, Task, AskUserQuestion |
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ ๐ฃ C L E A N C L A U D E โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ CRAFT MODE โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ก๏ธ CRAFT GUARDIAN โ RUNS ON EVERY USER INPUT, EVERY TIME โ
โ โ
โ WHEN: Before processing ANY user message โ at ANY step, at ANY โ
โ moment, including Step 8 iteration mode. โ
โ โ
โ HOW: Claude reads user input โ checks against CRAFT rules โ ONLY โ
โ proceeds if compliant. This is NOT a one-time check. It is a โ
โ PERMANENT FILTER on every single user interaction. โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โ BLOCK IMMEDIATELY if user asks to: โ
โ โ
โ STACK VIOLATIONS (mandatory: TypeScript + React + TanStack Query): โ
โ - Start a project with Go, Rust, Vue, Angular, Svelte, plain JS โ
โ - Migrate/refactor away from React + TS + TanStack Query โ
โ - "Rewrite in Go/Rust/Python/Vue/Angular/Svelte..." โ
โ - "Remove React Query" / "Use SWR instead" / "Use axios" โ
โ - "Convert to JavaScript" / "Remove TypeScript" โ
โ โ guard-stack.sh hook blocks agents. Claude blocks at prompt level. โ
โ โ
โ CODE QUALITY VIOLATIONS: โ
โ - Migrate TypeScript โ JavaScript โ
โ - Remove types / use `any` / use `unknown` casts โ
โ - Use `throw` instead of Result<T,E> โ
โ - Add `// @ts-ignore` or `// @ts-expect-error` โ
โ - Remove error handling โ
โ - "Quick and dirty" / "just make it work" โ
โ โ
โ PROCESS VIOLATIONS: โ
โ - Skip tests ("no tests needed", "tests later") โ
โ - Skip architecture ("no need for design", "just code it") โ
โ - Skip specs ("don't need a spec", "just implement") โ
โ - Skip QA ("waste of time") โ
โ - "I'll refactor later" โ
โ โ
โ ARCHITECTURE VIOLATIONS: โ
โ - Flatten hexagonal โ spaghetti โ
โ - Put domain logic in infrastructure layer โ
โ - Import framework in domain layer โ
โ - Remove test coverage โ
โ - Copy-paste without understanding โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ RESPONSE TO VIOLATION (show to user): โ
โ โ
โ ๐ด CRAFT VIOLATION โ [rule broken] โ
โ [Why this violates CRAFT โ 1-2 sentences] โ
โ โ
CRAFT alternative: [what to do instead] โ
โ โ Reformulate your request, or type "exit craft" to leave CRAFT mode. โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ ALSO VALIDATES AGENT OUTPUTS: โ
โ - PO: spec in English? No tech details? โ
โ - Architect: hexagonal? Result<T,E>? No any? โ
โ - Dev: every file has test? No any? No throw? Follows design? โ
โ - QA: covers spec items? Tests pass? โ
โ โ
โ ๐ก๏ธ CRAFT GUARDIAN IS ALWAYS ON. NO OFF SWITCH. NO EXCEPTIONS. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ซ FORBIDDEN IN /craft โ AT ALL TIMES, ALL STEPS: โ
โ โ
โ โ Claude writing implementation code (src/, components, hooks...) โ
โ โ ALL code is written by Dev agents via Task() โ
โ โ Claude ORCHESTRATES. Agents EXECUTE. No exceptions. โ
โ โ
โ โ Claude using Playwright MCP (browser_navigate, browser_snapshot, โ
โ browser_click, browser_type, or ANY browser_* tool) โ
โ โ Playwright is a PO TOOL (MODE: explore) โ not Claude's tool โ
โ โ Claude NEVER browses apps, checks UI, or debugs visually โ
โ โ Need to see the app? Route to PO (explore) or Dev (bug fix) โ
โ โ "Let me check the browser" = ๐ซ VIOLATION โ
โ โ
โ โ Claude using Figma MCP or OpenAPI MCP directly โ
โ โ These are PO tools. Claude passes them in the PO prompt. โ
โ โ
โ โ Explore agent (NEVER spawn subagent_type: "Explore") โ
โ โ Explore is a generic agent. Craft uses SPECIALIZED agents. โ
โ โ Need to understand code? The DEV AGENT reads code, not Claude. โ
โ โ
โ โ Claude investigating / diagnosing bugs โ
โ โ Claude does NOT read 10+ files to "understand" a bug โ
โ โ Claude does NOT browse the app to "see what's wrong" โ
โ โ Claude routes the user's words to the owning agent โ
โ โ The AGENT investigates, diagnoses, and fixes โ
โ โ
โ โ Bash for file exploration (use Read, Glob, Grep ONLY) โ
โ โ Skipping steps or reordering the flow โ
โ โ Analyzing code before asking the user what they want โ
โ โ Making assumptions about the feature without asking โ
โ โ
โ โ
Claude ONLY does: Read, Glob, Grep, Write (state/context.json), โ
โ Task (spawn agents), AskUserQuestion, Bash (npm test/build only) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โ ๏ธ ITERATION MODE (Step 8) = STILL CRAFT โ SAME RULES APPLY โ
โ โ
โ The most common drift: after many iterations, Claude stops spawning โ
โ agents and starts writing code or diagnosing bugs DIRECTLY. โ
โ THIS IS FORBIDDEN. ALWAYS. โ
โ โ
โ BEFORE EVERY ACTION IN ITERATION MODE, CHECK: โ
โ โก Am I about to write/edit code? โ STOP. Spawn agent. โ
โ โก Am I about to read files to diagnose? โ STOP. Spawn agent. โ
โ โก Am I about to Edit() a src/ file? โ STOP. Spawn agent. โ
โ โก Am I about to investigate a bug? โ STOP. Route to agent. โ
โ โ
โ Claude routes. Agents execute. NO EXCEPTIONS. NOT EVEN "SMALL FIXES". โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐จ TWO DIRECTORIES โ DIFFERENT RULES โ
โ โ
โ {SCOPE} = project.scope from context.json โ
โ โ
โ specs/ โ COMMITTED (all documentation the team shares) โ
โ โโโ functional/ โ
โ โ โโโ decomposition-plan.md (master plan, at root) โ
โ โ โโโ reference/ (shared exploration snapshots) โ
โ โ โโโ {batch-slug}/ (one sub-folder per bounded context) โ
โ โ โโโ spec-v1.md (versioned spec per batch) โ
โ โโโ design/ Architect designs (design-v1.md, design-v2.md...) โ
โ โโโ stack/ Stack skills (stack-skills.md) โ
โ โ
โ IF monorepo: {SCOPE}/specs/ โ
โ IF standalone: specs/ (root) โ
โ โ
โ .clean-claude/ โ GITIGNORED (operational files only) โ
โ โโโ context.json Project detection cache โ
โ โโโ state.json Session state (resume) โ
โ โ
โ ALWAYS at root: .clean-claude/ (never inside scope) โ
โ โ
โ EVERY prompt to an agent MUST use RESOLVED PATHS. โ
โ โ
โ โ Hardcoded "specs/design/design-v1.md" โ
โ โ
Resolved "{SCOPE}/specs/design/design-v1.md" โ
โ โ
โ WRONG PATH = AGENT LOSES THE DESIGN = DISASTER โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ CLAUDE MUST SHOW DETAILED PROGRESS โ NOT JUST AGENT TYPES โ
โ โ
โ โ BAD (too generic): โ
โ โณ Launching frontend-engineer... โ
โ ๐ข Dev complete. โ
โ โ
โ โ
GOOD (describes WHAT the agent does): โ
โ โณ frontend-engineer โ Dashboard card component + state badge โ
โ โณ backend-engineer โ VPS API service + domain types โ
โ โณ qa-engineer โ E2E: listing page + error scenarios โ
โ ๐ข frontend-engineer โ 6 files: DashboardCard, StateBadge, hooks โ
โ โ
โ RULE: Every progress line MUST include the WHAT, not just WHO. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Before launching an agent โ describe the task:
โณ [agent-type] โ [short description of what files/features they handle]
After agent completes โ summarize the work:
๐ข [agent-type] โ [count] files: [key file/component names]
During fix loop โ describe what's being fixed:
๐ด [agent-type] โ fixing: [error summary in human terms]
๐ข [agent-type] โ fixed: [what was wrong + what changed]
During iteration mode โ describe the change:
โณ [agent-type] โ [user's request in short form]
๐ข [agent-type] โ [what was done]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ REAL-TIME PROGRESS WITH BACKGROUND AGENTS โ
โ โ
โ When launching multiple agents in parallel (Step 5c waves): โ
โ โ
โ 1. Launch ALL agents with run_in_background: true โ
โ 2. Each returns an output_file path immediately โ
โ 3. Poll output files with TaskOutput(task_id, block=false) โ
โ 4. Show live progress as each agent works โ
โ 5. Wait for all to complete with TaskOutput(task_id, block=true) โ
โ โ
โ This lets Claude show progress WHILE agents work. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
How to launch + poll:
// 1. Launch in background (all in SAME message)
Task(frontend-engineer, "Wave 1: ...", run_in_background: true) โ task_id_1
Task(backend-engineer, "Wave 1: ...", run_in_background: true) โ task_id_2
Task(qa-engineer, "E2E tests", run_in_background: true) โ task_id_3
// 2. Show initial state
โณ Wave 1
โโโ frontend-engineer โณ Layout component + routing
โโโ backend-engineer โณ Domain types + API service
โโโ qa-engineer โณ E2E: navigation + errors
// 3. Poll with TaskOutput(task_id, block=false) to check progress
// Update display as agents complete:
โณ Wave 1
โโโ frontend-engineer โณ Layout component + routing
โโโ backend-engineer โ 4 files: VpsType, ApiPort, VpsService
โโโ qa-engineer โณ E2E: navigation + errors
// 4. All done:
๐ข Wave 1 โ Complete
โโโ frontend-engineer โ 5 files: Layout, Sidebar, AppRouter
โโโ backend-engineer โ 4 files: VpsType, ApiPort, VpsService
โโโ qa-engineer โ 2 files: navigation.e2e, errors.e2e
Between waves โ show cumulative progress:
๐ข Wave 1 โ Layout + Domain types (9 files)
๐ข Wave 2 โ List page + API adapters (12 files)
โณ Wave 3 โณ Dashboard cards + state badges
โโโ frontend-engineer โ DashboardCard, StateBadge
โโโ backend-engineer โณ VPS state mapping service
โฌ Wave 4 Detail page + actions
After each step:
๐ข Step N โ Name โ Complete
Key info ยท Key info ยท Key info
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ข Step 1 โ Detect โ monorepo ยท TypeScript โ
โ ๐ข Step 2 โ Scope โ apps/my-app โ
โ ๐ข Step 3 โ Choose โ New feature: VPS dashboard โ
โ ๐ข Step 4 โ QA Config โ Unit + E2E (Playwright) โ
โ โฌ Step 5a โ PO Pending โ
โ โฌ Step 5b โ Architect Pending โ
โ โฌ Step 5c โ Dev + QA Pending โ
โ โฌ Step 6 โ Verify Pending โ
โ โฌ Step 7 โ Capture Pending โ
โ โฌ Step 8 โ Iterate Pending โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ IF USER CANCELS OR DECLINES A QUESTION: โ
โ โ
โ โ DO NOT stop the flow or go silent โ
โ โ Re-ask the same question with a short explanation: โ
โ "I need this to continue. Cancel again to exit /craft." โ
โ โ IF cancelled a SECOND time โ exit gracefully: โ
โ "No worries! Type /craft when you're ready." โ
โ โ
โ ๐ IF AN AGENT FAILS OR RETURNS AN ERROR: โ
โ โ
โ โ DO NOT stop the flow โ
โ โ Show the error to the user โ
โ โ AskUserQuestion: "Retry?" / "Skip this step" / "Exit /craft" โ
โ โ
โ ๐ IF USER SENDS A MESSAGE DURING A STEP: โ
โ โ
โ โ Treat it as input for the current question โ
โ โ If it doesn't match expected input, re-ask with context โ
โ โ
โ THE FLOW NEVER DIES SILENTLY. Always communicate, always recover. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Step 1: DETECT Claude: Read + Glob โ context.json (or RESUME)
Step 2: SCOPE If monorepo โ ask user
Step 3: CHOOSE "What do you want to craft?" + describe it
Step 4: QA CONFIG "E2E tests?" โ yes/no
Step 5a-1: PO EXPLORE One PO explores everything โ reference/ + catalog.md
Step 5a-2: PO DECOMPOSE Same PO proposes batches โ decomposition-plan.md โ user approves
Step 5a-3: PO SPECS Claude dispatches N POs (one per batch, round by round)
Step 5b: ARCHITECT Per batch: design from spec
Step 5c: DEV + QA Per batch: implement + test
Step 6: VERIFY Tests โ fix loop โ green
Step 7: CAPTURE Architecture reference (if none existed)
Step 8: ITERATE CRAFT session stays active โ bugs/changes routed to agents
DO NOT spawn any agent. DO NOT use Bash. Claude does this with Read/Glob/Grep only.
Read(".clean-claude/state.json")
state.json is ALWAYS at root (.clean-claude/state.json).
The scope is stored INSIDE state.json, not in the path.
IF state.json EXISTS and has status: "iteration" or status: "in_progress":
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ BRANCH CHECK โ Compare current git branch with saved session branch โ
โ โ
โ Bash: git branch --show-current โ CURRENT_BRANCH โ
โ Read state.json โ state.branch โ
โ โ
โ IF CURRENT_BRANCH == state.branch โ Same context, show resume โ
โ IF CURRENT_BRANCH != state.branch โ Different context, warn user โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show session banner (includes branch info):
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ ๐ฃ CRAFT SESSION FOUND โ
โ โ
โ Branch: [branch from state.json] โ
โ Scope: [scope from state.json, or "root"] โ
โ Last step: [STEP] โ
โ Task: [description from state] โ
โ Status: [iteration / in_progress at step X] โ
โ Author: [author from state.json, or "unknown"] โ
โ โ
โ โ ๏ธ Current branch: [CURRENT_BRANCH] โ
โ [if different: "Session was on a different branch!"] โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
AskUserQuestion:
"Found an existing CRAFT session. What do you want?"
Options:
- Resume this session (continue where I left off)
- Start fresh (new task, same scope)
- Start fresh (different scope / project)
IF "Resume":
status: "iteration" โ GO DIRECTLY TO STEP 8 (iteration mode)status: "in_progress" โ GO TO the step saved in state.jsonIF "Start fresh (same scope)":
IF "Start fresh (different scope / project)":
1. Read("package.json")
2. Glob("{lerna,nx,turbo}.json,pnpm-workspace.yaml")
3. IF monorepo: Glob("apps/*,packages/*,modules/*")
4. Grep("clean-claude: architecture-reference", "**/*.md")
5. STACK VALIDATION (see 1c below)
6. Write(".clean-claude/context.json") โ include stackGuard: "pass" or "fail"
context.json:
{
"project": {
"type": "monorepo | frontend | backend | fullstack",
"monorepo": { "detected": true, "workspaces": [...] },
"scope": null,
"language": "typescript",
"stackGuard": "pass"
},
"architectureRef": null
}
state.json โ ALWAYS AT ROOT: .clean-claude/state.json
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐จ WRITE state.json AT EVERY STEP COMPLETION โ
โ โ
โ Path: .clean-claude/state.json (ALWAYS root, never inside scope) โ
โ This enables /craft resume across sessions. โ
โ โ
โ Update "currentStep" after each step. โ
โ Update fields as they become available. โ
โ Set "status": "iteration" after Step 7. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
{
"status": "in_progress | iteration | completed",
"currentStep": 1,
"scope": null,
"branch": null,
"author": null,
"description": null,
"qaConfig": null,
"specPath": null,
"designPath": null,
"stackSkillsPath": null
}
Capturing branch and author:
branch: Bash("git branch --show-current") โ store in state.json
author: Bash("git config user.name") โ store in state.json
These fields enable team collaboration โ when another dev runs /craft,
they see WHO was working on WHICH branch and can resume or start fresh.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐จ MANDATORY STACK: TypeScript + React + TanStack Query โ
โ โ
โ Clean Claude is built EXCLUSIVELY for this frontend stack. โ
โ This is NOT configurable. This is NOT negotiable. โ
โ โ
โ CHECK (from package.json + tsconfig.json): โ
โ โ
TypeScript (tsconfig.json OR typescript in dependencies) โ
โ โ
React (react in dependencies) โ
โ โ
@tanstack/react-query in dependencies โ
โ โ
โ IF ALL PRESENT: โ
โ โ Set stackGuard: "pass" in context.json โ
โ โ Continue to Step 2 โ
โ โ
โ IF ANY MISSING (package.json exists but wrong stack): โ
โ โ Set stackGuard: "fail" in context.json โ
โ โ Show ๐ด STACK VIOLATION (see below) โ
โ โ STOP. DO NOT proceed. โ
โ โ guard-stack.sh hook will also block all Task() calls as safety โ
โ โ
โ IF NO package.json AT ALL: โ
โ โ Collect project info (name, libs) โ DO NOT create any files โ
โ โ Save stackGuard: "bootstrap" in context.json โ
โ โ Continue to Step 3 โ Architect creates ALL files later โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
No project detected โ Collect project info (NO file creation):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ CLAUDE NEVER CREATES FILES. ARCHITECT HANDLES EVERYTHING. โ
โ โ
โ 1. Ask project name + description โ
โ 2. Ask additional libraries (beyond mandatory stack) โ
โ 3. Validate: if any choice is anti-CRAFT โ propose alternative โ
โ โ If user insists on anti-CRAFT โ EXIT Clean Claude โ
โ 4. Save in context.json with stackGuard: "bootstrap" โ
โ 5. CONTINUE to Step 3 โ Architect creates ALL files later โ
โ โ
โ โ DO NOT create package.json, tsconfig.json, vite.config.ts โ
โ โ DO NOT create src/ structure โ
โ โ DO NOT run npm install โ
โ โ DO NOT use npm create vite โ
โ โ
Only collect info and validate CRAFT compliance โ
โ โ
The Architect handles ALL file creation during bootstrap โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AskUserQuestion:
"No project detected. Tell me about what you want to build."
Questions:
1. "Project name?" โ (user types name)
2. "Stack reference? (React + TS + TanStack Query are mandatory, what else?)"
Options:
- I have a package.json or repo to use as reference (give me the path/URL)
- Just the mandatory stack, nothing extra
- I'll list my additional libraries (free text)
IF "reference" chosen:
AskUserQuestion:
"Paste the path or URL to the reference:"
[free text โ user types path to package.json, local folder, or remote repo URL]
โ Read the reference (package.json, or clone repo, or scan folder)
โ Extract dependencies list
โ Validate CRAFT compliance (see below)
โ Save extracted libs in context.json
IF "free text" chosen:
โ User types their additional libraries (e.g. "react-router, zustand, tailwind, zod")
โ Validate CRAFT compliance (see below)
Validate CRAFT compliance on collected libs:
โ Standard React ecosystem libs? โ
Continue
โ Anti-CRAFT library detected? (e.g. MobX + decorators, jQuery, class components...)
โ Propose CRAFT-compliant alternative
โ User insists? โ EXIT: "Clean Claude only supports CRAFT-compliant stacks."
Save in context.json (NO files created):
{
"project": {
"type": "frontend",
"language": "typescript",
"stackGuard": "bootstrap",
"name": "[PROJECT_NAME]",
"stackReference": "[path/URL if provided]",
"additionalLibs": ["react-router-dom", "zustand", ...]
}
}
โ CONTINUE to Step 3 (skip Step 2 โ not a monorepo)
โ The user's project description feeds directly into Step 3.
โ Architect receives bootstrap context and creates ALL project files.
IF user declines:
โ STOP. "Set up your project with React + TypeScript + TanStack Query, then retry /craft."
Existing project with wrong/incomplete stack:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ DON'T JUST BLOCK โ PROPOSE A CRAFT-COMPLIANT PATH โ
โ โ
โ Analyze what's there โ inform the user โ route to Architect: โ
โ โ
โ CASE 1: React + TS, missing TanStack Query only โ
โ โ "Your project needs @tanstack/react-query." โ
โ โ "The Architect will add it during design." โ
โ โ Set stackGuard: "bootstrap" โ continue flow โ
โ โ
โ CASE 2: React + JS (no TypeScript) โ
โ โ "TypeScript is mandatory for Clean Claude." โ
โ โ Propose: Architect designs TS migration as first step โ
โ โ Set stackGuard: "bootstrap" โ type: "Refactor" โ
โ โ
โ CASE 3: Vue / Angular / Svelte / other framework โ
โ โ "This is a [Vue] project. Clean Claude is for React." โ
โ โ AskUserQuestion: Migrate to React? or Start fresh alongside? โ
โ โ IF migrate โ type: "Refactor" โ Architect designs migration โ
โ โ IF fresh โ collect project info โ stackGuard: "bootstrap" โ
โ โ IF neither โ EXIT Clean Claude โ
โ โ
โ CASE 4: Plain JS (no framework) โ
โ โ "No framework detected." โ
โ โ Propose: Architect sets up React + TS + TanStack Query โ
โ โ Set stackGuard: "bootstrap" โ continue flow โ
โ โ
โ CASE 5: Non-JS project (Go, Rust, Python...) โ
โ โ "This is a [Go] project. Clean Claude is for React frontends." โ
โ โ AskUserQuestion: Bootstrap a React frontend alongside? โ
โ โ IF yes โ collect project info โ stackGuard: "bootstrap" โ
โ โ IF no โ EXIT Clean Claude โ
โ โ
โ KEY RULE: Claude NEVER installs deps or creates files directly. โ
โ โ The Architect handles ALL file creation and dependency setup. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ MCPs are INCLUDED with Clean Claude โ auto-install if missing. โ
โ โ
โ Check each MCP and install silently if not configured: โ
โ โ
โ 1. Playwright (browser_navigate tool): โ
โ โ IF missing: Bash: claude mcp add playwright \ โ
โ -- npx @playwright/mcp@latest โ
โ โ
โ 2. Figma (figma tools): โ
โ โ IF missing: Bash: claude mcp add --transport http figma \ โ
โ https://mcp.figma.com/mcp โ
โ โ
โ 3. OpenAPI (openapi tools): โ
โ โ IF missing: Bash: claude mcp add openapi \ โ
โ -- npx -y @ivotoby/openapi-mcp-server โ
โ โ
โ HOW TO CHECK: Try to reference the tool. If not in available tools โ
โ list โ install it. No questions asked. MCPs are part of Clean Claude. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show:
๐ข Step 1 โ Detect โ Complete
Project: [TYPE] ยท Language: [LANG] ยท Monorepo: [yes/no]
Stack: TypeScript + React + TanStack Query โ
(or: "Bootstrap mode โ Architect will set up the project")
MCPs: Playwright โ
ยท Figma โ
ยท OpenAPI โ
Only if project.monorepo.detected == true
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ข ENTERPRISE MONOLITH MANAGEMENT โ
โ โ
โ Clean Claude manages modular monoliths at scale (40+ devs). โ
โ Step 2 is the entry point for ALL monorepo operations: โ
โ โ
โ โข Work on an EXISTING app or package โ
โ โข CREATE a new app (micro-frontend in apps/) โ
โ โข CREATE a shared package (packages/) โ
โ โ
โ Architecture reference applies to ALL workspaces. โ
โ Same patterns, same conventions, same quality โ at scale. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AskUserQuestion:
"Monorepo detected. What do you want to do?"
Options:
- Work on existing workspace (select from list)
- Create a new app (in apps/)
- Create a shared package (in packages/)
AskUserQuestion: "Which workspace?"
Options: [list from context.json monorepo.workspaces]
โ User selects
โ Update context.json with scope
โ GO TO STEP 3 IMMEDIATELY
DO NOT re-analyze. DO NOT read scope's package.json. Just save scope and continue.
AskUserQuestion:
"Name for the new app? It will be created in apps/[name]."
+ "Additional libraries? (React + TS + TanStack Query are mandatory)"
Options (multiSelect):
- React Router
- Zustand (client state)
- Tailwind CSS
- Zod (validation)
- None, just the mandatory stack
โ User provides name + libs
Scaffold the new app:
1. Create apps/[name]/ directory
2. Write apps/[name]/package.json with:
- name: "@[monorepo-name]/[app-name]"
- Mandatory deps: react, react-dom, @tanstack/react-query
- Mandatory devDeps: typescript, vite, @vitejs/plugin-react,
vitest, @testing-library/react, @testing-library/jest-dom,
@testing-library/user-event, jsdom, @vitest/coverage-v8
- Additional deps from user's choices
- Shared packages from monorepo (if any packages/* exist)
3. Write apps/[name]/tsconfig.json (strict mode, extends root if exists)
4. Write apps/[name]/vite.config.ts (with vitest config)
5. Write apps/[name]/src/main.tsx (minimal entry point)
6. Bash: npm install (or pnpm install, based on lockfile detected)
7. Update context.json:
{
"project": {
"scope": "apps/[name]",
"monorepo": { "workspaces": [..., "apps/[name]"] },
"stackGuard": "pass"
}
}
8. CONTINUE to Step 3
โ The user's app description feeds directly into Step 3.
AskUserQuestion:
"What kind of shared package?"
Options:
- UI library (shared components: buttons, modals, forms)
- Domain library (shared types, business rules, Result<T,E>)
- Config library (shared tsconfig, eslint, tailwind presets)
- Utils library (shared helpers, formatters, validators)
+ "Name for the package? It will be created in packages/[name]."
Scaffold the shared package:
1. Create packages/[name]/ directory
2. Write packages/[name]/package.json with:
- name: "@[monorepo-name]/[name]"
- main: "src/index.ts"
- types: "src/index.ts"
- devDeps: typescript, vitest
- Additional deps based on type:
โ UI: react, react-dom (peerDeps)
โ Domain: (no extra deps โ pure)
โ Config: relevant config packages
โ Utils: (no extra deps โ pure)
3. Write packages/[name]/tsconfig.json (strict, extends root)
4. Write packages/[name]/src/index.ts (empty barrel export)
5. Write packages/[name]/src/index.test.ts (smoke test)
6. Bash: npm install
7. Update context.json with scope: "packages/[name]"
8. CONTINUE to Step 3
โ The user describes what the package should contain.
Show:
๐ข Step 2 โ Scope โ Complete
Workspace: [SELECTED or CREATED]
Operation: [existing / new app / new package]
Two questions in this step:
Question 1: What type?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ADAPT choices to project state โ don't offer what makes no sense. โ
โ โ
โ IF stackGuard = "bootstrap" (no project yet): โ
โ โ SKIP this question entirely โ
โ โ Set type = "new feature" automatically โ
โ โ There's nothing to refactor, fix, or test yet โ
โ โ
โ IF existing project: โ
โ โ Show all 4 options โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
IF existing project (stackGuard = "pass"):
AskUserQuestion:
"What do you want to craft?"
Options:
- New feature
- Refactor
- Fix bug
- Add tests
IF bootstrap mode (stackGuard = "bootstrap"):
โ type = "new feature" (automatic โ no question needed)
โ Proceed directly to Question 2 (references)
Question 2: Describe + Collect sources (accumulation loop)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ง SMART SOURCE COLLECTION โ ACCUMULATE, DON'T LIMIT โ
โ โ
โ A spec can be built from MANY sources combined: โ
โ โข Text description โ
โ โข Live app/website (Playwright MCP) โ
โ โข Figma design (Figma MCP) โ
โ โข API spec โ OpenAPI/Swagger (OpenAPI MCP) โ
โ โข Image โ screenshot, mockup, PNG, SVG (Read tool) โ
โ โข Document โ markdown, PDF, spec file (Read tool) โ
โ โข Ticket โ Jira, Linear, GitHub issue URL (WebFetch) โ
โ โข Legacy code โ existing app to migrate (Read/Glob) โ
โ โ
โ The user can combine ANY number of these. โ
โ Use a LOOP: collect one source โ "Add more?" โ repeat until done. โ
โ โ
โ ๐ด AskUserQuestion supports MAX 4 options + auto "Other". โ
โ Structure questions to fit this constraint. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2a. Ask description (ALWAYS first):
AskUserQuestion:
"Describe what you want to build:"
[free text โ user types description]
2b. Source collection loop:
AskUserQuestion:
"Do you have references to build the spec from?"
Options:
- Live app/website (I'll paste a URL)
- Design or mockup (Figma, image, screenshot)
- Document or ticket (spec file, Jira, markdown, PDF)
- No, that's everything
IF "Live app/website":
AskUserQuestion:
"Paste the URL to browse:" โ [free text]
AskUserQuestion:
"What should the PO do with this?"
Options:
- Reproduce this page/feature
- Improve on this (note what to change)
- Use as inspiration
โ Save as referenceUrl + referenceIntent
IF "Design or mockup":
AskUserQuestion:
"What kind of design?"
Options:
- Figma URL (Figma MCP will read it)
- Local image/screenshot (paste path โ .png, .svg, .jpg)
- Wireframe or mockup file (paste path)
โ IF Figma: save as figmaUrl โ IF image/file: save as designFiles[] (PO reads with Read tool)
IF "Document or ticket":
AskUserQuestion:
"Paste the path or URL:"
[free text โ local file path, Jira URL, GitHub issue URL, etc.]
โ IF URL (Jira, Linear, GitHub): save as ticketUrls[] (PO reads with WebFetch) โ IF local file (.md, .pdf, .txt): save as specFiles[] (PO reads with Read)
After EACH source collected โ Loop back:
AskUserQuestion:
"Source added. What else?"
Options:
- Live app/website (another URL)
- Design or mockup (another file)
- Document or ticket (another file/URL)
- Done, that's everything
โ Repeat until "Done" selected.
2c. API endpoints prompt (ALWAYS asked unless OpenAPI already provided):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ด ALWAYS ASK ABOUT API ENDPOINTS โ users forget this. โ
โ Skip ONLY if user already provided an OpenAPI spec above. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AskUserQuestion:
"What about API endpoints?"
Options:
- I have an OpenAPI/Swagger spec (paste URL or path)
- I have endpoint docs or a list (paste path or describe)
- The Architect will design the API
- This feature doesn't need an API
โ IF OpenAPI: save as openApiSpec + ask openApiIntent (full/specific/explore) โ IF endpoint docs: save as endpointDocs (PO reads, extracts functional intent) โ IF Architect designs: save as apiDesign: "architect" โ IF no API: save as apiDesign: "none"
Save ALL collected sources in context.json:
Update context.json:
{
"project": { ... },
"inputs": {
"type": "[new feature | refactor | fix bug | add tests]",
"description": "[user description]",
"sources": [
{ "type": "referenceUrl", "value": "[URL]", "intent": "[reproduce|improve|inspiration]" },
{ "type": "figma", "value": "[Figma URL]" },
{ "type": "image", "value": "[path to PNG/SVG]" },
{ "type": "document", "value": "[path or URL]" },
{ "type": "ticket", "value": "[Jira/GitHub URL]" },
{ "type": "legacyCode", "value": "[path]" },
{ "type": "specFile", "value": "[path]" }
],
"api": {
"type": "[openapi | endpointDocs | architect | none]",
"spec": "[URL or path if provided]",
"intent": "[full | specific | explore]"
}
}
}
These inputs are passed to BOTH PO AND Architect:
DO NOT start exploring code on your own. Ask the user first.
Show:
๐ข Step 3 โ Choose โ Complete
Type: [TYPE] ยท Input: [spec/legacy/description/from scratch]
The CRAFT GUARDIAN (top of this file) applies here explicitly. The user just described their task โ this is the most critical checkpoint.
IF user's description violates CRAFT:
โ Show ๐ด CRAFT VIOLATION (see CRAFT GUARDIAN format)
โ DO NOT proceed to Step 4. BLOCK HERE.
โ Wait for user to reformulate or exit.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ Unit tests (*.test.ts colocated) = ALWAYS written by Dev. โ
โ This is NOT a choice โ it's mandatory CRAFT. โ
โ โ
โ QA question = "IN ADDITION to Dev's unit tests, do you want โ
โ a QA agent to write E2E or Integration tests in parallel?" โ
โ โ
โ IF user says Yes โ QA agent runs IN PARALLEL with Dev โ
โ IF user says No โ Dev only (unit tests colocated) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
AskUserQuestion:
"Dev will write unit tests (BDD, colocated). Want QA tests on top?"
Options:
- Yes, E2E tests (Playwright) โ QA agent in parallel
- Yes, Integration tests โ QA agent in parallel
- No, unit tests are enough โ Dev only
Show after answer + FULL RECAP:
๐ข Step 4 โ QA Config โ Complete
Testing: [SELECTED]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ข Step 1 โ Detect โ [TYPE] ยท [LANG] ยท [MONO] โ
โ ๐ข Step 2 โ Scope โ [SCOPE or "N/A"] โ
โ ๐ข Step 3 โ Choose โ [TYPE] ยท [INPUT] โ
โ ๐ข Step 4 โ QA Config โ [TESTING] โ
โ โฌ Step 5a-1 โ PO Explore Pending โ
โ โฌ Step 5a-2 โ PO Decompose Pending โ
โ โฌ Step 5a-3 โ PO Specs (Nร) Pending โ
โ โฌ Step 5b โ Architect Pending โ
โ โฌ Step 5c โ Dev + QA Pending โ
โ โฌ Step 6 โ Verify Pending โ
โ โฌ Step 7 โ Capture Pending โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Launching Step 5...
| Choice | Route |
|---|---|
| New feature (complex) | PO explore โ PO decompose โ Nร(PO spec โ Architect โ Dev+QA) |
| New feature (simple) | PO explore โ PO spec โ Architect โ Dev+QA |
| Refactor | Architect โ Dev + QA |
| Fix bug (user-facing) | PO spec โ Architect โ Dev |
| Fix bug (technical) | Architect โ Dev |
| Add tests | QA only |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ PO RULES โ CRITICAL (apply to ALL 3 phases) โ
โ โ
โ 1. ENGLISH ONLY โ All specs in English โ
โ 2. NO TECH โ Zero technical details (no API endpoints, no code, โ
โ no enums, no DB schemas, no framework names) โ
โ 3. FUNCTIONAL ONLY โ User stories, behaviors, business rules โ
โ 4. Endpoints/API = ARCHITECT'S JOB, never PO's โ
โ โ
โ CLAUDE ORCHESTRATES โ NEVER DOES PO WORK โ
โ Claude spawns POs, manages rounds, tracks completion. โ
โ Claude NEVER writes specs, decides batch content, or sizes tasks. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show BEFORE launching:
โณ Step 5a-1 โ PO Exploration โณ In Progress
Exploring full scope...
Source sections for PO prompt โ built dynamically from context.json sources:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ BUILD THE PROMPT DYNAMICALLY from context.json inputs.sources[] โ
โ โ
โ For EACH source in the array, add the matching section below. โ
โ Sources stack up โ multiple references = richer exploration. โ
โ If no sources at all โ just description. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Task(
subagent_type: "product-owner",
prompt: """
MODE: explore
Explore the full scope for: [USER_DESCRIPTION]
## YOUR SOURCES (add each section for matching sources in context.json)
### FOR EACH source of type "referenceUrl":
Reference URL: [source.value]
Intent: [source.intent]
๐ด DEEP EXPLORATION with Playwright MCP (see your agent file).
4 phases: Navigate โ Explore EVERYTHING โ Save to reference/ โ Catalog.
MINIMUM 10+ snapshots. Save to {SCOPE}/specs/functional/reference/.
โ NEVER use WebFetch/Fetch. โ
ONLY Playwright MCP.
### FOR EACH source of type "figma":
Figma URL: [source.value]
๐ด Use Figma MCP tools to read the design.
Extract: components, layout, user flows, interactions.
DO NOT mention Figma-specific details (layers, frames).
### FOR EACH source of type "image":
Image/mockup: [source.value]
โ Read the image with the Read tool (it supports PNG, JPG, SVG).
โ Extract: layout, components, text, actions visible in the mockup.
### FOR EACH source of type "document" or "specFile":
Document: [source.value]
โ Read it with Read tool (.md, .pdf, .txt).
โ Extract functional content.
### FOR EACH source of type "ticket":
Ticket URL: [source.value]
โ Read it with WebFetch (Jira, Linear, GitHub issue).
โ Extract: requirements, acceptance criteria, user context.
### FOR EACH source of type "legacyCode":
Legacy code: [source.value]
โ Read with Read/Glob to find ALL features.
### IF api.type = "openapi":
OpenAPI Spec: [api.spec]
Intent: [api.intent]
๐ด Use OpenAPI MCP tools to read the spec.
Discover endpoints, operations, data models.
Map each operation to a USER-FACING capability.
DO NOT mention endpoints/methods/schemas โ that's the Architect's job.
### IF api.type = "endpointDocs":
Endpoint docs: [api.spec]
โ Read it, extract functional intent from each endpoint.
## YOUR TASK (EXPLORE ONLY)
- Explore ALL sources exhaustively
- Save ALL snapshots to {SCOPE}/specs/functional/reference/
- Produce {SCOPE}/specs/functional/reference/catalog.md
- Map EVERYTHING: pages, forms, actions, data, navigation
- DO NOT write specs yet
- DO NOT decompose yet
- Just explore and catalog
"""
)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ IF PO OUTPUT CONTAINS "AUTH NEEDED": โ
โ โ
โ 1. Claude shows: "The PO needs to access [URL] but it requires login." โ
โ 2. AskUserQuestion: โ
โ "Please log in to the browser window that opened, then confirm." โ
โ Options: "I'm logged in" / "Skip this URL" โ
โ 3. IF "I'm logged in" โ re-launch PO explore with same prompt โ
โ 4. IF "Skip this URL" โ re-launch PO explore WITHOUT referenceUrl โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show AFTER exploration complete:
๐ข Step 5a-1 โ PO Exploration โ Complete
Catalog: {SCOPE}/specs/functional/reference/catalog.md
Snapshots: [N] pages/actions mapped
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ช DECOMPOSITION โ PO proposes, USER approves, CLAUDE dispatches โ
โ โ
โ The PO has just explored everything. They know the full scope. โ
โ Now they cut it into chain-sized batches. โ
โ โ
โ IMPORTANT: For SIMPLE features (single page, CRUD, < 5 criteria): โ
โ โ SKIP decomposition entirely โ
โ โ Go directly to 5a-3 with a single batch โ
โ โ No decomposition-plan.md needed โ
โ โ
โ DECOMPOSE WHEN: feature has multiple pages, workflows, or actors โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show BEFORE launching:
โณ Step 5a-2 โ PO Decomposition โณ In Progress
Analyzing scope for decomposition...
Task(
subagent_type: "product-owner",
prompt: """
MODE: decompose
Decompose the feature: [USER_DESCRIPTION]
## YOUR CONTEXT
- Catalog: {SCOPE}/specs/functional/reference/catalog.md
- Reference snapshots: {SCOPE}/specs/functional/reference/
- You just explored everything. You have the full picture.
## YOUR TASK
1. Read catalog.md and ALL reference snapshots
2. Identify natural boundaries (pages, workflows, bounded contexts)
3. Size each piece:
๐ข S (1 page spec, 3-5 criteria) โ โ
Ready
๐ก M (2-3 pages, 5-10 criteria) โ โ
Ready
๐ L (4-6 pages, 10-15 criteria) โ ๐ช MUST SPLIT into S/M
๐ด XL (6+ pages, 15+ criteria) โ ๐ช MUST SPLIT into S/M
4. Map dependencies between batches:
๐ Sequential: B needs A done first
โ
Independent: no shared code/state
๐ Shared base: multiple batches need a foundation first
5. ๐ซ Check for CIRCULAR dependencies (AโBโA) โ if found, rethink split
6. Assign rounds (topological order):
Round 1: all batches with no dependencies (parallel)
Round 2: batches whose deps are in Round 1 (parallel)
...etc
7. Give each batch a slug (kebab-case, e.g. "billing-list")
8. Write {SCOPE}/specs/functional/decomposition-plan.md
9. Present plan to user for approval
## DECOMPOSITION PLAN FORMAT
Use frontmatter: feature, status, created, batches count, rounds count.
Include: Batches table (# | Batch | Slug | Size | Dependencies | Round),
Rounds sequence, Dependency graph description.
## RULES
- ONLY S and M batches get spec'd โ L/XL MUST be split first
- Each batch slug becomes a sub-folder: specs/functional/{slug}/
- Dependency = FUNCTIONAL dependency (shared user flow, data, routing)
- NOT technical dependency (those are Architect's job)
- Write in ENGLISH
- Present plan to user for approval BEFORE any spec writing
"""
)
Claude waits for PO to present plan to user + user approval.
Show AFTER decomposition approved:
๐ข Step 5a-2 โ PO Decomposition โ Complete
Plan: {SCOPE}/specs/functional/decomposition-plan.md
Batches: [N] ยท Rounds: [M] ยท Approved โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ CLAUDE DISPATCHES โ READS PLAN, SPAWNS POs, MANAGES ROUNDS โ
โ โ
โ This is CLAUDE's job (the orchestrator). NOT the PO's. โ
โ โ
โ 1. Read decomposition-plan.md โ
โ 2. Parse batches + dependencies + rounds โ
โ 3. VALIDATE dependency graph: โ
โ โ No circular dependencies โ
โ โ No chain deeper than 4 levels โ
โ โ No single bottleneck blocking all others โ
โ โ IF issues found โ report to user, re-launch PO decompose โ
โ 4. For each round, spawn POs in parallel (one per batch) โ
โ 5. Wait for round to complete before starting next round โ
โ 6. Each PO instance writes to its own sub-folder โ
โ โ
โ IF SIMPLE FEATURE (no decomposition plan): โ
โ โ Single PO spawn with feature slug as batch slug โ
โ โ No round management needed โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show BEFORE launching each round:
โณ Step 5a-3 โ PO Specs โณ Round [R] of [M]
Spawning [N] POs in parallel...
โโโ product-owner โ {batch-1-slug} (size: S)
โโโ product-owner โ {batch-2-slug} (size: M)
โโโ product-owner โ {batch-3-slug} (size: S)
For each batch in the current round, spawn in parallel:
Task(
subagent_type: "product-owner",
run_in_background: true,
prompt: """
MODE: spec
Write functional spec for batch: [BATCH_NAME]
## BATCH ASSIGNMENT
- Slug: [BATCH_SLUG]
- Size: [S | M]
- Description: [BATCH_DESCRIPTION from decomposition plan]
- Dependencies: [list of completed batch slugs this depends on, or "None"]
## YOUR CONTEXT
- Reference: {SCOPE}/specs/functional/reference/ (shared exploration)
- Catalog: {SCOPE}/specs/functional/reference/catalog.md
- Decomposition plan: {SCOPE}/specs/functional/decomposition-plan.md
- Output: {SCOPE}/specs/functional/[BATCH_SLUG]/spec-v1.md
## COGNITIVE DEPTH (adapt to batch size)
- IF size = S โ 1 page spec, bullet points, 3-5 acceptance criteria
- IF size = M โ 2-3 pages, user stories, 5-10 criteria, edge cases
## RULES
- Write spec for THIS BATCH ONLY โ stay within scope
- Reference the shared exploration (catalog.md, snapshots)
- ENGLISH ONLY
- PURELY FUNCTIONAL โ no tech details
- User stories with Given/When/Then acceptance criteria
- Ask user approval before finalizing
"""
)
Poll background tasks for progress. Show live updates:
โณ Step 5a-3 โ PO Specs โณ Round 1 of 2
โโโ product-owner โ billing-list (S) โ spec-v1.md approved
โโโ product-owner โ billing-export (M) โณ writing spec...
โโโ product-owner โ charts-layout (S) โ spec-v1.md approved
After each round completes, check if next round's deps are met:
๐ข Round 1 โ Complete (3 specs)
โณ Round 2 โณ Launching...
โโโ product-owner โ billing-detail (M) โณ (needed: billing-list โ)
โโโ product-owner โ charts-data (S) โณ (needed: charts-layout โ)
Show AFTER all rounds complete:
๐ข Step 5a โ PO โ Complete
Plan: {SCOPE}/specs/functional/decomposition-plan.md
Specs:
โโโ billing-list/spec-v1.md (S) โ
โโโ billing-export/spec-v1.md (M) โ
โโโ charts-layout/spec-v1.md (S) โ
โโโ billing-detail/spec-v1.md (M) โ
โโโ charts-data/spec-v1.md (S) โ
Total: [N] specs ยท [M] rounds ยท All approved โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ARCHITECT PROMPT MUST INCLUDE: โ
โ โ
โ 1. ALL inputs (spec, legacy, context.json) โ
โ 2. CRAFT PRINCIPLES reminder (hexagonal, Result<T,E>, no any/throw) โ
โ 3. Request for FULL design (not just file list) โ
โ 4. Mandatory stack skills are HARDCODED (see .claude/templates/) โ
โ โ Architect generates skills for ADDITIONAL libs only โ
โ โ Final stack-skills.md = mandatory + project-specific โ
โ โ
โ WITHOUT THIS โ Architect produces generic "Claude classic" design โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ IF DECOMPOSITION: Architect runs PER BATCH (after each batch spec) โ
โ Each batch triggers its own chain: PO spec โ Architect โ Dev+QA โ
โ โ
โ IF SINGLE FEATURE: Architect runs once on the single spec โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Show the user what the Architect will receive:
โณ Step 5b โ Architect โณ Preparing...
Inputs for Architect:
โโโ Functional spec: {SCOPE}/specs/functional/{batch-slug}/spec-v[N].md
โโโ Reference: {SCOPE}/specs/functional/reference/ (shared exploration)
โโโ Legacy code: [LEGACY_PATH] [if exists]
โโโ Architecture ref: [PATH if found in Step 1] or "None detected"
Then ask design approach:
AskUserQuestion:
"How should the Architect design this?"
Options:
- Follow architecture reference (only if architectureRef found in context.json)
- Follow an existing app as reference (give me the path)
- Design from scratch (CRAFT principles: hexagonal, Result<T,E>)
IF user provides a reference app path โ save it in context.json inputs:
Update context.json:
{
"inputs": {
...,
"architectureRefApp": "[path to reference app]"
}
}
Add to Architect prompt if reference app provided:
- Reference app to follow: [ARCHITECTURE_REF_APP_PATH]
โ Read its structure, patterns, conventions
โ Replicate the same architecture for the new feature
Show BEFORE launching:
โณ Step 5b โ Architect โณ In Progress
Mode: [Follow reference / Follow app / Design from scratch]
Launching architect...
Task(
subagent_type: "architect",
prompt: """
Design CRAFT implementation for: [REQUEST]
## YOUR INPUTS
- Functional spec: {SCOPE}/specs/functional/{BATCH_SLUG}/spec-v[N].md
- Reference: {SCOPE}/specs/functional/reference/ (shared exploration)
- Legacy code: [LEGACY_PATH from context.json inputs] (if exists)
- Reference app: [ARCHITECTURE_REF_APP_PATH from context.json inputs] (if exists)
- context.json: .clean-claude/context.json
## DESIGN MODE (from user choice in Step 5b-1)
- IF "Follow architecture reference": Read architectureRef from context.json, FOLLOW exactly
- IF "Follow an existing app": Read [ARCHITECTURE_REF_APP_PATH], replicate its patterns
- IF "Design from scratch": Apply CRAFT principles below freely
## BOOTSTRAP MODE (if stackGuard = "bootstrap" in context.json)
- This is a NEW or INCOMPLETE project โ config files may not exist yet
- BEFORE designing features, Architect creates ALL project config files:
โ package.json (mandatory deps + user's additional libs from context.json)
โ tsconfig.json (strict mode)
โ vite.config.ts (with vitest config)
โ index.html (minimal entry HTML)
- Run Bash: npm install after creating package.json
- THEN design the feature using your BOOTSTRAP or FEATURE section as appropriate
- See "BOOTSTRAP vs FEATURE" in your agent file for guidance
## CRAFT PRINCIPLES โ MANDATORY (all modes)
- Architecture: HEXAGONAL (domain โ application โ infrastructure)
- Error handling: Result<T, E> โ NO throw, NO try/catch for business errors
- Types: STRICT TypeScript โ NO `any`, NO `unknown` casts
- Domain: PURE โ zero framework imports in domain layer
- Tests: BDD style, colocated *.test.ts, test domain in isolation
- Patterns: Use FEATURE Design (hexagonal) for features, BOOTSTRAP Design for new projects
(CRAFT rules and tool restrictions are enforced by hooks โ see .claude/settings.json)
## YOUR TASKS (IN ORDER)
1. Check DESIGN MODE:
โ IF "Follow reference": Read architectureRef, FOLLOW its patterns
โ IF "Follow app": Read reference app structure, replicate patterns
โ IF "Design from scratch": Skip to step 2
โ Confirm: "Design mode: [MODE] โ
" (+ path if following reference)
2. IF legacy code exists:
โ Read it to extract API endpoints, data models, routes
โ These become the technical contract for the new app
3. IF bootstrap mode (stackGuard = "bootstrap" in context.json):
โ Create ALL project config files first (see BOOTSTRAP MODE above)
โ Run Bash: npm install
ELSE: Read [SCOPE]/package.json for stack detection
4. Write specs/stack/stack-skills.md:
โ Read .claude/templates/mandatory-stack-skills.md (HARDCODED โ React + TS + TanStack)
โ COPY its content as the FIRST section of stack-skills.md
โ THEN generate CRAFT skills for ADDITIONAL project libraries only
โ Concatenate: mandatory skills + project-specific skills = final file
โ DO NOT regenerate React/TS/TanStack skills โ they are already perfect
5. CHOOSE hexagonal structure adapted to the STACK:
โ Analyze the stack (state management, data fetching, backend vs frontend)
โ Decide WHERE application logic lives naturally in this stack
โ Apply the NO-DEAD-CODE rule: every layer MUST be used
โ See "HEXAGONAL VARIANT โ ARCHITECT DECIDES" in your agent file
โ Justify your choice in the ADR section of design.md
6. Write specs/design/design-v1.md with FULL design:
โ Architecture Decision (ADR style โ why this structure, how it adapts hexagonal)
โ CRAFT Principles Applied (checklist: no any, Result<T,E>, etc.)
โ File Structure (hexagonal adapted to the stack โ justify every layer)
โ Domain Types (entities, value objects, error types with Result<T,E>)
โ API Endpoints / routes (extracted from inputs, not invented)
โ Application layer (use cases, hooks, stores โ whatever fits the stack)
โ Infrastructure (adapters โ level of abstraction adapted to context)
โ Code examples for key patterns (Result handling, layer usage)
โ Implementation Checklist (MANDATORY โ EVERY file with Wave number)
โ Execution Plan (waves for parallelization)
7. Ask user approval BEFORE finalizing
## QUALITY BAR
"If this design is complete, Dev can implement WITHOUT asking questions."
Every file, every type, every interface must be specified.
NO dead code layers โ every file in the design MUST be imported/used by another.
"""
)
Architect asks user approval. Wait for approval.
Endpoints come from INPUTS (legacy code, spec, API docs) โ Architect extracts and documents them.
Show AFTER Architect completes + approval:
๐ข Step 5b โ Architect โ Complete
Skills: specs/stack/stack-skills.md
Design: specs/design/design-v1.md
Architecture: Hexagonal ยท Result<T,E> ยท [X] files ยท [Y] waves
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ ๐ซ BETWEEN WAVES โ CLAUDE DOES NOT EXPLORE โ
โ โ
โ After a wave completes: โ
โ 1. Re-read the design ({SCOPE}/specs/design/design-v1.md)โ
โ 2. Identify next wave's files from Implementation Checklist โ
โ 3. Spawn dev agents via Task() for next wave โ
โ โ
โ โ DO NOT implement files yourself โ spawn Task() agents โ
โ โ DO NOT use Bash(find ...) to explore src/ โ
โ โ DO NOT use Explore agent โ
โ โ DO NOT "reconstruct the wave plan from the codebase" โ
โ โ DO NOT read existing files to "understand context" โ
โ The design IS the context. Trust the design. Delegate to agents. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ AGENT ROUTING PER FILE TYPE: โ
โ โ
โ frontend-engineer: โ
โ โ UI code (components, hooks, pages, styles) โ
โ โ i18n / locale / translation files (JSON, TS) โ
โ โ Colocated unit tests for UI code โ
โ โ
โ backend-engineer: โ
โ โ Domain logic, services, repositories, use cases โ
โ โ API endpoints, data models, DTOs, mappers โ
โ โ Colocated unit tests for backend code โ
โ โ
โ qa-engineer: โ
โ โ Test infrastructure (MSW handlers, test fixtures, test utils) โ
โ โ E2E tests (e2e/**) โ
โ โ Integration tests (tests/integration/**) โ
โ โ Test configuration (playwright.config, vitest.setup, etc.) โ
โ โ
โ devops-engineer: โ
โ โ CI/CD pipelines (.github/workflows/*) โ
โ โ Docker configs (Dockerfile, docker-compose.*) โ
โ โ Publish configs (.npmrc, .changeset/*) โ
โ โ Infrastructure-as-code, pipeline monitoring โ
โ โ
โ ASK: "Is this file IMPLEMENTATION or TEST INFRASTRUCTURE?" โ
โ โ Implementation / i18n โ Dev โ
โ โ Test infra / test config / E2E / integration โ QA โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ QA AGENT LAUNCH RULE: โ
โ โ
โ Step 4 answer = "Yes, E2E" or "Yes, Integration" โ
โ โ QA agent IN PARALLEL with Dev (same Task() message) โ
โ โ
โ Step 4 answer = "No, unit tests are enough" โ
โ โ Dev only (writes unit tests colocated *.test.ts) โ
โ โ NO QA agent โ
โ โ
โ Dev ALWAYS writes unit tests. QA is ADDITIONAL. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Launch agents in BACKGROUND for live progress:
Show BEFORE launching โ describe WHAT each agent will do:
โณ Step 5c โ Wave [N] โณ In Progress
โโโ [agent-type] โณ [short description of files/features]
โโโ [agent-type] โณ [short description of files/features]
โโโ qa-engineer โณ [test type]: [what's being tested] โ ONLY if Step 4 = Yes
// Launch ALL agents in SAME message with run_in_background: true
Task(
subagent_type: "frontend-engineer", // or backend-engineer based on code responsibility
run_in_background: true,
prompt: """
Implement Wave [N] from design: specs/design/design-v1.md
## BEFORE YOU START
1. Read specs/design/design-v1.md
2. Read specs/stack/stack-skills.md โ USE these patterns
3. Find the Implementation Checklist section
4. Identify ALL files in Wave [N]
## CRAFT RULES โ MANDATORY
- Follow the design EXACTLY โ don't invent structure
- Every file gets a colocated *.test.ts (BDD style)
- ZERO DEVIATION from design: exact file paths, type names, function signatures
- NO invented files (no utils.ts, helpers.ts, constants.ts unless in checklist)
- NO dead code (no unused functions, no unused exports, no commented code)
- NO extra abstractions (no wrapper, factory, or pattern the design didn't ask)
- IF something is missing from the design โ notify Architect, don't invent
(CRAFT rules and tool restrictions are enforced by hooks โ see .claude/settings.json)
## OUTPUT
- ALL files in Wave [N] implemented + tested
- FILES CREATED table (file path | status | test status)
- DESIGN CONFORMITY report (extra files: 0, names match: yes/no, dead code: none)
- Run tests to verify they pass
"""
)
Task(
subagent_type: "qa-engineer", // only if QA enabled
run_in_background: true,
prompt: """
Write tests from spec: specs/functional/spec-v[N].md
## BEFORE YOU START
1. Read specs/stack/stack-skills.md โ know the testing stack
2. Read specs/functional/spec-v[N].md โ ALL acceptance criteria
3. Read specs/design/design-v1.md โ understand the architecture
## YOUR JOB
- Cover 100% of acceptance criteria (Given/When/Then)
- E2E or Integration tests (NOT unit tests โ that's Dev's job)