From brewcode
Generates PLAN.md execution plan from SPEC.md, task directory, or existing plan file; creates phases/*.md, KNOWLEDGE.jsonl, artifacts/, and backups.
npx claudepluginhub kochetkov-ma/claude-brewcode --plugin brewcodeThis skill is limited to using the following tools:
Create Plan — [task-dir or SPEC path or plan file]
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
Create Plan — [task-dir or SPEC path or plan file]
ROLE: Plan Creator | OUTPUT: PLAN.md + phases/*.md + KNOWLEDGE.jsonl + artifacts/ + backup/
| Input | Action |
|---|---|
Path to {TS}_{NAME}_task/ dir | Read SPEC.md from it |
Path to SPEC.md file | Derive task dir from parent |
.claude/plans/LATEST.md or plan file | Plan Mode: parse plan, create task dir, skip SPEC |
| Empty | Check .claude/TASK.md quick ref for latest task dir |
Parse $ARGUMENTS for flags BEFORE input detection:
| Flag | Effect |
|---|---|
-n, --noask | Skip all user questions, auto-approve defaults |
Strip flag from $ARGUMENTS. Remaining text = path.
Check Adapted Templates (REQUIRED FIRST)
EXECUTE using Bash tool:
TMPL_DIR=".claude/tasks/templates"
PLUGIN_TMPL="$BC_PLUGIN_ROOT/skills/setup/templates"
echo "--- Project templates ---"
test -f "$TMPL_DIR/PLAN.md.template" && echo "PLAN.md.template OK" || echo "PLAN.md.template MISSING"
test -f "$TMPL_DIR/phase.md.template" && echo "phase.md.template OK" || echo "phase.md.template MISSING"
test -f "$TMPL_DIR/phase-verify.md.template" && echo "phase-verify.md.template OK" || echo "phase-verify.md.template MISSING"
test -f "$TMPL_DIR/phase-final-review.md.template" && echo "phase-final-review.md.template OK" || echo "phase-final-review.md.template MISSING"
test -f "$TMPL_DIR/phase-fix.md.template" && echo "phase-fix.md.template OK" || echo "phase-fix.md.template MISSING"
echo "--- Plugin fallback templates ---"
test -f "$PLUGIN_TMPL/PLAN.md.template" && echo "PLAN.md.template FALLBACK OK" || echo "PLAN.md.template FALLBACK MISSING"
test -f "$PLUGIN_TMPL/phase.md.template" && echo "phase.md.template FALLBACK OK" || echo "phase.md.template FALLBACK MISSING"
test -f "$PLUGIN_TMPL/phase-verify.md.template" && echo "phase-verify.md.template FALLBACK OK" || echo "phase-verify.md.template FALLBACK MISSING"
test -f "$PLUGIN_TMPL/phase-final-review.md.template" && echo "phase-final-review.md.template FALLBACK OK" || echo "phase-final-review.md.template FALLBACK MISSING"
test -f "$PLUGIN_TMPL/phase-fix.md.template" && echo "phase-fix.md.template FALLBACK OK" || echo "phase-fix.md.template FALLBACK MISSING"
Template resolution order:
.claude/tasks/templates/{name}.template (adapted by /brewcode:setup)$BC_PLUGIN_ROOT/skills/setup/templates/{name}.templateSTOP if BOTH locations MISSING for any template -- Run
/brewcode:setupfirst to get v3 templates. If project templates missing but plugin fallback exists: WARN "Re-run /brewcode:setup for v3 project-adapted templates. Using plugin defaults."
Read SPEC
Scan Project for Reference Examples
Before assigning agents to phases, check for project team agents:
.claude/teams/ exists — read team.md for agent roster with domains.claude/agents/ has project agents — list availableAlways fall back to plugin agents when no project agents match the task domain.
Generate Phase Breakdown (5-12 phases)
Based on SPEC analysis and project structure:
Present Phases to User (AskUserQuestion)
If --noask: Skip. Auto-approve all phases.
Otherwise: Use AskUserQuestion to present the proposed phase split:
Generate Artifacts
Read templates per resolution order from Step 0 (project first, plugin fallback second).
5.1 Create directory structure
.claude/tasks/{TS}_{NAME}_task/
├── phases/ <-- NEW: individual phase files
├── artifacts/
├── backup/
├── KNOWLEDGE.jsonl (0-byte empty file)
└── PLAN.md (slim, with Phase Registry)
EXECUTE using Bash tool:
TASK_DIR=".claude/tasks/{TS}_{NAME}_task"
mkdir -p "$TASK_DIR/phases" "$TASK_DIR/artifacts" "$TASK_DIR/backup"
touch "$TASK_DIR/KNOWLEDGE.jsonl"
5.2 Generate phase files (from templates)
For EACH execution phase (1, 2, 3, ...):
phase.md.template{PHASE_NUM} -- phase number{PHASE_NAME} -- descriptive name (kebab-case for filename, Title Case for heading){AGENT} -- assigned agent{AGENT_ROLE} -- one-line agent role description{OBJECTIVE} -- concrete objective from SPEC analysis{CONTEXT_FILES} -- table rows: files the agent needs to read/modify{REFERENCES} -- table rows: reference examples, docs, existing patterns{TASK_LIST} -- numbered task list with specific, actionable items{CONSTRAINTS} -- project-specific constraints (from SPEC + project rules){EXIT_CRITERIA} -- measurable exit criteria (builds, tests pass, lint clean, etc.){ARTIFACT_DIR} -- e.g., 1-1e (Phase 1 Execution, iter 1){ADDITIONAL_ARTIFACTS} -- files created/modified by this phasephases/{N}-{name}.md (e.g., phases/1-create-entity.md)For EACH verification phase:
phase-verify.md.template{PHASE_NUM} -- matches the execution phase being verified{PHASE_NAME} -- same name as the execution phase{VERIFY_AGENT} -- tester or reviewer{FILES_TO_REVIEW} -- files created/modified by the execution phase{VERIFICATION_CHECKLIST} -- checklist items derived from exit criteria of execution phase{AGAINST_REFERENCES} -- reference examples to compare against{ARTIFACT_DIR} -- e.g., 1-1v (Phase 1 Verification, iter 1){AGENT} -- same as {VERIFY_AGENT}phases/{N}V-verify-{name}.mdFor Final Review:
phase-final-review.md.template{FR_AGENTS} -- list of review agents (typically reviewer + tester + architect){COMPLETION_CRITERIA} -- from SPEC.md goals/decisions, copied to PLAN.md Completion Criteria{REVIEW_CHECKLIST} -- comprehensive checklist covering all phases{FILES_CHANGED} -- aggregate of all files created/modified across all phases{ARTIFACT_DIR} -- FR-1e (Final Review, iter 1)phases/FR-final-review.md5.3 Generate PLAN.md (slim v3 format)
Using PLAN.md.template (project-adapted or plugin fallback):
phases/{file}.md.claude/teams/ exists: populate ### Project Agents table from team.md roster5.4 Technology Choices
For each non-trivial choice (library, pattern, approach):
Quorum Plan Review (3 agents, mixed expertise)
ONE message with 3 Task calls in PARALLEL:
Task(subagent_type="Plan", prompt="Review PLAN.md and ALL files in phases/ against SPEC requirements. Check Phase Registry completeness and phase file content quality.")
Task(subagent_type="brewcode:architect", prompt="Review PLAN.md and phases/ files: architecture decisions, technology choices, dependencies between phases, context files accuracy")
Task(subagent_type="brewcode:reviewer", prompt="Review PLAN.md and phases/ files: exit criteria measurability, task granularity, risks, verification checklist completeness")
Agent prompt template:
> **Context:** BC_PLUGIN_ROOT is available in your context (injected by pre-task.mjs hook).
Review PLAN at {PLAN_PATH} and phase files at {TASK_DIR}/phases/ against SPEC at {SPEC_PATH}
Check: Phase Registry matches actual phase files, each phase file has filled content (no unfilled placeholders),
agent assignments match expertise, dependencies correct, exit criteria measurable, risks mitigated
Output: list of remarks with rationale
Quorum rule (2/3): Only remarks confirmed by 2+ agents are accepted.
Verification Agent (Traceability Check)
Task(subagent_type="brewcode:reviewer", prompt="
> **Context:** BC_PLUGIN_ROOT is available in your context (injected by pre-task.mjs hook).
Verify PLAN and phase files cover ALL SPEC requirements:
- Each item from SPEC > Scope > In has at least one phase FILE in phases/
- Each requirement from Original Requirements is addressed in a specific phase file's Tasks section
- Phase Registry in PLAN.md matches actual files in phases/ directory
Output: traceability matrix (requirement -> phase file) + gaps found")
If gaps found: Add missing phase files AND update Phase Registry in PLAN.md before presenting to user in Step 8.
Present Review Results (AskUserQuestion)
If --noask: Auto-accept all quorum-confirmed remarks. Fix all in PLAN.md and phase files.
Otherwise: Present confirmed remarks + verification results to user. User approves/rejects each. Fix approved remarks in PLAN.md and phase files.
Check Templates -- same as SPEC workflow Step 0
Read Plan File
.claude/plans/LATEST.md or provided plan fileCreate Task Dir + Scan Project
.claude/tasks/{TS}_{NAME}_task/Split into Granular Phases (finer than plan)
Present Phases to User (AskUserQuestion)
--noask)Generate Artifacts
Lightweight Plan Review (2 agents)
ONE message with 2 Task calls in PARALLEL:
Task(subagent_type="brewcode:architect", prompt="Review PLAN.md at {PLAN_PATH} and phases/ files: architecture decisions, phase dependencies, agent assignments")
Task(subagent_type="brewcode:reviewer", prompt="Review PLAN.md at {PLAN_PATH} and phases/ files: phase quality, verification criteria, completeness vs source plan")
Rule: Both agents must confirm a remark for it to be accepted (2/2 consensus). Fix confirmed remarks in PLAN.md and phase files before proceeding.
Add task link to TOP of .claude/TASK.md (preserve history):
IF .claude/TASK.md exists:
1. Read existing content
2. Prepend: ".claude/tasks/{TS}_{NAME}_task/PLAN.md\n---\n"
3. Append: existing content
ELSE:
Create with: ".claude/tasks/{TS}_{NAME}_task/PLAN.md"
EXECUTE using Bash tool:
TS_NAME="{TS}_{NAME}"
TASK_DIR=".claude/tasks/${TS_NAME}_task"
echo "=== Structure ==="
test -d "$TASK_DIR" && echo "TASK_DIR" || echo "TASK_DIR MISSING"
test -f "$TASK_DIR/PLAN.md" && echo "PLAN" || echo "PLAN MISSING"
test -f "$TASK_DIR/KNOWLEDGE.jsonl" && echo "KNOWLEDGE" || echo "KNOWLEDGE MISSING"
test -d "$TASK_DIR/artifacts" && echo "ARTIFACTS" || echo "ARTIFACTS MISSING"
test -d "$TASK_DIR/backup" && echo "BACKUP" || echo "BACKUP MISSING"
test -d "$TASK_DIR/phases" && echo "PHASES_DIR" || echo "PHASES_DIR MISSING"
head -1 .claude/TASK.md 2>/dev/null | grep -q "${TS_NAME}" && echo "QUICK_REF" || echo "QUICK_REF MISSING"
echo "=== Phase Registry vs Files ==="
grep -oP 'phases/[^\s|]+\.md' "$TASK_DIR/PLAN.md" | sort -u | while read -r pf; do
test -f "$TASK_DIR/$pf" && echo "OK $pf" || echo "MISSING $pf"
done
echo "=== Phase files on disk ==="
for f in "$TASK_DIR"/phases/*.md; do
test -f "$f" && echo "EXISTS $(basename $f)" || echo "NO PHASE FILES"
done
STOP if any MISSING -- Create missing artifacts before proceeding.
# Plan Created
## Detection
| Field | Value |
|-------|-------|
| Arguments | `{received args}` |
| Input Type | `{SPEC path or Plan Mode file}` |
| Noask | `{yes or no}` |
## Files Created
- PLAN: .claude/tasks/{TS}_{NAME}_task/PLAN.md
- PHASES: .claude/tasks/{TS}_{NAME}_task/phases/ ({count} files)
- KNOWLEDGE: .claude/tasks/{TS}_{NAME}_task/KNOWLEDGE.jsonl
- ARTIFACTS: .claude/tasks/{TS}_{NAME}_task/artifacts/
- BACKUP: .claude/tasks/{TS}_{NAME}_task/backup/
- QUICK REF: .claude/TASK.md (task added to top, history preserved)
## Phase Files
| File | Type | Agent |
|------|------|-------|
| phases/1-{name}.md | Execution | {agent} |
| phases/1V-verify-{name}.md | Verification | {agent} |
| ... | ... | ... |
| phases/FR-final-review.md | Final Review | reviewer+tester+architect |
## Next Step
> Copy the command below first, then clear context and paste it.
1. Clear context: type `/clear` and press Enter
2. Run (paste copied command):
\`\`\`
/brewcode:start .claude/tasks/{TS}_{NAME}_task/PLAN.md
\`\`\`