Help us improve
Share bugs, ideas, or general feedback.
From agent-flow
Creates a new project from scratch; use 'add <component>' to extend an existing project
npx claudepluginhub asysta-act/agent-flow --plugin agent-flowHow this skill is triggered — by the user, by Claude, or both
Slash command
/agent-flow:scaffold {add <component> | <description>} [--template <path>] [--spec <path>] [--issue <ID>] [--no-implement] [--yolo] [--step-mode] [--infra tracker:<v>,sc:<v>] [--lang <v>] [--framework <v>] [--db <v>] [--ci <v>] [--brainstorm]{add <component> | <description>} [--template <path>] [--spec <path>] [--issue <ID>] [--no-implement] [--yolo] [--step-mode] [--infra tracker:<v>,sc:<v>] [--lang <v>] [--framework <v>] [--db <v>] [--ci <v>] [--brainstorm]This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use the Read tool to load `skills/scaffold/data/guard-block.md` BEFORE any other instruction
Autonomously generates complete production-ready projects from descriptions: structure, code, tests, docs, config, git. Orchestrates pipeline with verification to ensure builds and tests pass.
Greenfield project scaffolding: architecture decisions, harness setup, and requirements generation via interview-driven derivation chain. Use for new projects or major restructures.
Scaffolds greenfield project architecture and AI agent harness via interview-driven decisions. Outputs markdown spec with code structure exemplar, tests, guardrails, CLAUDE.md setup, and unified plan. Invoke via /scaffold for new projects.
Share bugs, ideas, or general feedback.
Use the Read tool to load skills/scaffold/data/guard-block.md BEFORE any other instruction
in this file. The guard is load-bearing; it establishes the orchestrator role, blocks
pre-dispatch deferrals, and contains the rationalization-red-flags STOP protocol.
Input: $ARGUMENTS = either add <component> (subcommand mode) OR project description (natural language) + optional flags
Read the first non-empty token of $ARGUMENTS. If it equals add, branch into the add <component> subcommand body (see ## Subcommand: add <component> at the end of this file). Otherwise, fall through to the new-project flow (Flag Parsing section below).
read -ra ARG_TOKENS <<< "$ARGUMENTS"
FIRST_TOKEN="${ARG_TOKENS[0]:-}"
if [ "$FIRST_TOKEN" = "add" ]; then
# Subcommand mode — extend an existing project with a single component.
COMPONENT="${ARG_TOKENS[1]:-}"
if [ -z "$COMPONENT" ]; then
echo "[ERROR] Usage: /agent-flow:scaffold add <component>" >&2
echo "Supported components: claude-md | ci | docker | tests" >&2
exit 1
fi
case "$COMPONENT" in
claude-md|ci|docker|tests) ;;
*)
echo "[ERROR] Unknown component: ${COMPONENT}" >&2
echo "Supported components: claude-md | ci | docker | tests" >&2
exit 1
;;
esac
# Branch into the Subcommand body at the END of this file (## Subcommand: add <component>).
# The subcommand branch MUST exit after step 6 (Report) and MUST NOT fall through to the new-project flow.
fi
# Otherwise: existing new-project flow continues with Flag Parsing below.
The add subcommand is a single-shot operation and does NOT use resume detection. The new-project flow does — see the resume detection invocation immediately after Flag Parsing / Mode Resolution below.
Parse $ARGUMENTS for these flags:
| Flag | Variable | Notes |
|---|---|---|
--template <path> | template_path | |
--spec <path> | spec_path | |
--issue <ID> | issue_id | |
--no-implement | no_implement = true | |
--yolo | GOT_YOLO = true | B6 mode flag |
--step-mode | GOT_STEP_MODE = true | B6 mode flag |
--lang <v> | preset_lang | |
--framework <v> | preset_framework | |
--db <v> | preset_db | |
--ci <v> | preset_ci | |
--brainstorm | brainstorm = true | |
--infra <v> | infra_preset | See validation below |
Remainder after removing flags = project description.
If both --yolo and --step-mode are set:
→ Error: "Flags --yolo and --step-mode are mutually exclusive. Use one or neither."
If more than one of (--spec, --template, --issue) provided:
→ Error: "Only one input source allowed. Use --spec, --template, or --issue."
If --no-implement AND any of (--spec, --template, --issue):
→ Error: "--no-implement skips specification phase. Remove --spec/--template/--issue or remove --no-implement."
If --brainstorm AND --spec:
→ Error: "--brainstorm is for exploring ideas. Use --spec when you already have a specification."
If --infra provided:
{ready|later} → expand to tracker:{value},sc:{value}tracker:{ready|later},sc:{ready|later} (or reversed) → parse as-is{ready|later},{ready|later} → Error: "--infra format changed. Use: --infra tracker:ready,sc:later"If --infra provided AND tracker value is later AND --issue provided:
→ Error: "--issue requires tracker access. Use --infra tracker:ready,sc:{v} or remove --issue."
If no project description AND no --spec AND no --template AND no --issue AND not --no-implement:
→ Ask user for project description.
if GOT_YOLO: MODE = "yolo"
elif GOT_STEP: MODE = "step-mode"
else: MODE = "default"
MODE is passed as context to all step dispatches. Steps use it to gate checkpoints and prompts.
In default mode, brainstorm triggers only for vague descriptions (heuristic: word count < 20 OR no
technical term detected; see steps/01-mode-resolve.md for full heuristic). Long technical
descriptions (>=20 words AND technical terms) skip brainstorm automatically. The heuristic requires
BOTH conditions: word count AND technical term presence. Two checkpoints are always visible:
--yolo enables yolo autonomous execution: no brainstorm (skip regardless of description vagueness),
no Spec checkpoint, no Feature Plan checkpoint, no user prompts; all conditional gates skipped.
Pipeline runs autonomously from description to final report with zero gates.
Read steps/ sub-files. Execute in order:
If no_implement = true: execute legacy flow (scaffolder (with stack flags) → validate → git init → push if SC ready → report). See steps/03-scaffold.md L1–L6 section. EXIT after L6.
| Step | File | Description |
|---|---|---|
| 01 | steps/01-mode-resolve.md | State detection, infra declaration (0-INFRA), MCP verification (0-MCP), brainstorm |
| 02 | steps/02-spec-write-review.md | spec-writer ↔ spec-reviewer loop + Spec Checkpoint |
| 03 | steps/03-scaffold.md | scaffolder agent, validate, git init, auto-fill CLAUDE.md, push (4d), tracker issues (4e) |
| 04 | steps/04-architect.md | architect agent, decomposition, AC coverage, Feature Plan Checkpoint |
| 05 | steps/05-fixer-reviewer-loop.md | fixer ↔ reviewer per subtask/batch, NEEDS_CLARIFICATION handling |
| 06 | steps/06-test.md | test-engineer per subtask + full-suite sweep |
| 07 | steps/07-spec-verify.md | spec-reviewer --verify, post-impl tracker comments, close issues |
| 08 | steps/08-final-report.md | pipeline accumulator, pipeline-completed webhook, final report |
Each step receives: MODE, GOT_YOLO, GOT_STEP_MODE, all parsed flags and in-memory variables from prior steps.
See also:
/agent-flow:scaffold validate(thevalidatesubcommand) for read-only validation of an existing project (tool contract:Bash, Read, Glob, Greponly).
Follow ../../core/resume-detection.md for resume detection logic. Inputs:
scaffold-{timestamp} derived from project description hash, or operator-supplied via state directory).single (scaffold is always single-pipeline; no batch).--clarification "<text>" flag if provided on resume.Outputs: RESUME_POINT, RESTORED_CONTEXT, PIPELINE_TYPE.
Post-resume MCP checkpoint check (scaffold-specific):
After resume-detection returns, check for a pending MCP setup checkpoint. Derive STATE_FILE
the same way as ../../core/resume-detection.md Step 2: STATE_FILE=".agent-flow/${ISSUE_ID}/state.json".
Guard against missing file before reading:
STATE_FILE=".agent-flow/${ISSUE_ID}/state.json"
MCP_PENDING=""
if [ -f "$STATE_FILE" ]; then
MCP_PENDING=$(grep -oE '"mcp_setup_pending"[[:space:]]*:[[:space:]]*(true|false)' "$STATE_FILE" \
| grep -oE '(true|false)$' | head -1)
fi
If MCP_PENDING = "true": override RESUME_POINT = "0-mcp". Skip Step 01a and 01b (already
completed; values restored from state.json). Re-enter Step 01c (MCP Verification) only.
Clearing mcp_setup_pending is handled exclusively inside Step 01c (see steps/01-mode-resolve.md
Step 01c) — do NOT clear it here.
If RESUME_POINT == "FRESH", proceed with the full new-project pipeline below. If RESUME_POINT is any other value, skip ahead to the corresponding scaffold step per the SCAFFOLD pipeline mapping (see ../../core/resume-detection.md Step 6 status branch and the legacy resume-ticket SCAFFOLD pipeline mapping).
The add <component> subcommand (Step 0 dispatch above) is single-shot and does NOT invoke resume detection.
../../core/agent-override-injector.md before each agent dispatchCollect infrastructure readiness before pipeline begins.
If --infra flag was provided, parse named-key pairs:
tracker:ready or tracker:later — extract tracker preset (tracker_preset)sc:ready or sc:later — extract sc preset (sc_preset)Old positional format detection: if --infra ready,later or similar positional {tracker},{sc} detected → emit: "--infra format changed. Use: --infra tracker:ready,sc:later".
If --infra not provided, prompt user:
Infrastructure Declaration
--------------------------
Issue tracker available now? [ready / later]
Source control remote set? [ready / later]
Determine tracker_effective_status and sc_effective_status based on user answers or --infra values.
Four valid combinations:
| Tracker | SC | Downstream behavior |
|---|---|---|
| ready | ready | Full integration — issues created, PRs pushed |
| ready | later | Issues created; no push |
| later | ready | Push only; no issue creation |
| later | later | Fully local — no tracker, no push |
State persistence — write to state.json via ../../core/state-manager.md:
{
"infrastructure": {
"tracker_status": "<tracker_effective_status>",
"sc_status": "<sc_effective_status>",
"tracker_type": "<tracker_type>",
"sc_remote": "<sc_remote>"
}
}
(infrastructure.tracker_status and infrastructure.sc_status stored for resume.)
On resume: If pipeline is resumed and --infra flag is provided with new values:
tracker: and sc: values from --infra against values in state.json.0-MCP to re-check MCP availability. Re-verification required: run Step 0-MCP again.tracker_type, sc_remote), set to null. Respect original choice; later → no action needed.--infra not provided on resume — read persisted values from state.json; no re-check needed.Path note:
trackers.mdlives in the plugin installation directory, not in the consuming project. Glob is used to handle CWD-context mismatch.
Resolve {trackers_md_path} once:
.claude/plugins/**/docs/reference/trackers.md — if results, use first (prefer path containing .claude/plugins/ or agent-flow/)**/docs/reference/trackers.md — use first result if step 1 found nothingdocs/reference/trackers.md as last resortIf not found → [WARN] "trackers.md not found — using built-in defaults for this tracker type."
Canary write check — Inform user (informational, no Y/n confirmation for the canary test itself):
Running a canary write test to verify MCP server connectivity before starting pipeline...
Check mcp_available (follow ../../core/mcp-detection.md).
If mcp_available: false:
MCP server unavailable. Options:
1. Configure now — run: /agent-flow:setup-mcp --tracker-type <type> --tracker-instance <url> --sc-remote <owner/repo>
(Equivalent: /agent-flow:init --tracker-type <type>)
Then restart this session and resume.
2. Skip — continue without MCP (tracker and SC steps will be skipped).
After "Configure now" is chosen (interactive mode only — unreachable in --yolo):
../../core/state-manager.md):
{ "mcp_setup_pending": true, "mcp_pause_step": "0-MCP", "status": "paused" }pipeline-paused webhook if Webhook_URL is configured and pipeline-paused is in On_events
(follow ../../core/post-publish-hook.md Section 4 pattern)."STOP scaffold — restart Claude Code session and resume with /agent-flow:scaffold resume".If user selects Skip: continue in local-only mode. Standard error message:
Cannot connect to your issue tracker or source control. Pipeline will run in local-only mode.
Follow ../../core/mcp-preflight.md for complete MCP pre-flight protocol.
Present user with three run modes:
| Mode | Description |
|---|---|
| Interactive | Default: Spec Checkpoint after Step 02, Feature Plan Checkpoint after Step 04. Brainstorm offered for vague descriptions. |
| YOLO with checkpoint | Skip brainstorm; show Spec Checkpoint and Feature Plan Checkpoint but no other pauses. |
| Full YOLO | Fully autonomous: no brainstorm, no Spec checkpoint, no Feature Plan checkpoint, no user prompts. Pipeline runs to final report with zero gates. |
Apply MODE selection to GOT_YOLO / GOT_STEP_MODE logic from Mode Resolution section.
If no_implement = true: execute Legacy Flow (v3.x behavior).
L1: Step 0-INFRA (infrastructure declaration)
L2: Step 0-MCP (MCP canary write check)
L3: stack-selector agent → tech stack selection (stack-selector is a backward-compat alias)
L4: scaffolder agent → generate skeleton with stack flags (--lang, --framework, --db, --ci)
L5: Validate (build + lint)
L5b: Push to Remote if sc_effective_status = ready
L6: Report — v3.x format
EXIT pipeline after L6 — do not enter spec phase (spec-writer/spec-reviewer loop).
Report includes v3.x next steps:
Next steps:
- Create issues in your issue tracker for each feature
- Use /agent-flow:implement-feature to implement each feature
Spec iterations — run spec-writer ↔ spec-reviewer loop up to 5 iterations (Spec iterations max):
spec-writer → spec-reviewer → [APPROVE | REVISE → back to spec-writer]
Loop exits on APPROVE or when max_iterations exhausted (5 iterations max). On exhaustion → Block with reason.
Dispatch spec-writer:
Task(subagent_type='agent-flow:spec-writer', description='Write project specification',
prompt='...project description, context, flags...')
Dispatch spec-reviewer:
Task(subagent_type='agent-flow:spec-reviewer', description='Review project specification',
prompt='...spec content, iteration number...')
Write iteration count to state.json via ../../core/state-manager.md:
{ "spec": { "iteration": <N>, "status": "approved" } }
NEEDS_CLARIFICATION — if spec-writer raises a question during spec phase:
asked_at: $asked_at to state.json clarification object (follow ../../core/state-manager.md)pipeline-paused webhook if configured (follow ../../core/agent-states.md):
# Fire pipeline-paused webhook
if [ -n "${Webhook_URL:-}" ] && printf '%s' "${On_events:-}" | grep -qF 'pipeline-paused'; then
curl --proto "=http,https" --max-time 5 --retry 0 -X POST -H "Content-Type: application/json" \
--arg event "pipeline-paused" \
"$Webhook_URL"
fi
Spec Checkpoint (Interactive and YOLO-with-checkpoint modes): show spec summary, ask "Continue to scaffolding? [Y/n]".
Dispatch scaffolder agent:
Task(subagent_type='agent-flow:scaffolder', description='Generate project skeleton',
prompt='...spec path, stack flags, {trackers_md_path}, mode...')
Validate output (build + lint). Write state:
{ "scaffold": { "status": "complete", "project_dir": "<path>" } }
Step 4d — Push to Remote: If sc_effective_status = ready, push to {sc_remote}. Read defaults from {trackers_md_path} Source Control table.
If tracker_effective_status = ready, create tracker issues from spec/epics/*.md.
Optionally dispatch backlog-creator agent to organize stories into sprint-ready issues.
Read tracker defaults from {trackers_md_path} Instance & Project Defaults table.
Idempotency guard: Before creating, check if issue already exists (search by title). Skip if found — use existing issue ID. (Idempotency guard prevents duplicate epic creation.)
For each epic file:
--- delimiter to identify story sections. Parse story headings: ### Story N.M: <title>.
### Story headings found → skip sub-issue creation for this epic.trackers.md Sub-Issue Capabilities table for native sub-issues support per tracker.)[{epic_title}] {story_title}.
Add cross-reference to epic issue in story description.spec/epics/*.md: <!-- {TrackerType}: {STORY-ISSUE-ID} -->Story back-reference format: STORY-ISSUE-ID placeholder used in back-reference writeback comment.
Optionally dispatch backlog-creator to organize stories into sprint-ready issues:
Task(subagent_type='agent-flow:backlog-creator', description='Create tracker backlog from spec epics',
prompt='...spec/epics path, tracker_type, trackers_md_path, {trackers_md_path}...')
Accumulator pattern / Partial failure handling: Collect epic failures. On any WARN: Could not create tracker issue, log and continue.
After all epics, commit:
chore: link spec epics to tracker issues
Do NOT apply the On start set state transition when creating scaffold issues (backward compat).
Display: Created N tracker issues (S story failures).
Write to state.json:
{ "tracker_issues": { "created": <N>, "failed": <M> } }
Dispatch architect agent:
Task(subagent_type='agent-flow:architect', description='Create feature decomposition plan',
prompt='...spec path, tracker_effective_status, trackers_md_path, {trackers_md_path}...')
Decompose spec into subtasks. Each subtask maps to maps_to: AC-{N}: {text}.
Feature Plan Checkpoint (Interactive and YOLO-with-checkpoint modes): show decomposition, ask "Begin feature implementation? [Y/n]".
For each subtask in decomposition, run fixer ↔ reviewer loop:
Task(subagent_type='agent-flow:fixer', description='Implement feature subtask N',
prompt='...subtask description, AC, spec path...',
model='opus')
Task(subagent_type='agent-flow:reviewer', description='Review implementation for subtask N',
prompt='...diff, AC, fixer output...',
model='opus')
Follow ../../core/fixer-reviewer-loop.md for iteration logic (max 5 iterations per subtask).
NEEDS_CLARIFICATION during implementation — if fixer raises a question:
asked_at: $asked_at to state.json clarification objectWrite state per subtask:
{ "fixer_reviewer": { "status": "approved", "iterations": <N>, "subtask": "<id>" } }
Dispatch test-engineer:
Task(subagent_type='agent-flow:test-engineer', description='Run tests for scaffold pipeline',
prompt='...project dir, test command, spec path...')
Write state:
{ "test": { "status": "passed", "subtask": "<id>" } }
Run spec-reviewer in --verify mode to check implementation against spec.
Task(subagent_type='agent-flow:spec-reviewer', description='Verify implementation against spec',
prompt='...spec path, implementation summary, --verify mode...')
Run test-engineer E2E suite:
Task(subagent_type='agent-flow:test-engineer', description='Run E2E test suite',
prompt='...e2e framework, command, project dir...',
model='sonnet')
If tracker_effective_status = ready, close all epic and story tracker issues.
Read On start set Done mapping from {trackers_md_path} State Transition Syntax table.
If state transitions config does not include a 'Done' mapping: → [WARN] "State transitions config does not include a 'Done' mapping — issues left open."
For each epic issue:
skipped (blocked subtasks).Per-issue failure WARN: Could not transition issue {ID} to Done: {reason}.
Read back-reference comments from spec/epics/*.md to find issue IDs. Parse <!-- {TrackerType}: {STORY-ISSUE-ID} --> back-reference comments in spec/epics/*.md.
Guard: check tracker_effective_status before attempting any tracker calls. If tracker_effective_status != ready — skip this step; no back-reference needed.
Display: Transitioned N issues to Done. M skipped (blocked subtasks).
Summarize scaffold pipeline run:
Scaffold complete.
- Spec: spec/ directory (README.md, architecture.md, verification.md, epics/*.md)
- Project: <project_dir>
- issues closed: <N>
- Subtasks implemented: <N>
- Branch: <branch>
Write final state to state.json:
{ "pipeline": { "status": "complete", "outcome": "success" } }
If any unrecoverable error occurs (repeated test failures, block from reviewer, scaffolder failure, spec loop exhaustion):
state.json:
{ "pipeline": { "status": "failed", "outcome:failed": true, "blocked_at": "<step>" } }
[agent-flow] 🔴 Pipeline Block
Agent: scaffold
Step: <step>
Reason: <max 2 sentences>
Detail: <error output>
Recommendation: <what user should do>
All agents dispatched via Task tool only. Model assignments per ../../core/agent-override-injector.md:
| Agent | Model | Dispatch Form |
|---|---|---|
| spec-writer | opus | Task(subagent_type='agent-flow:spec-writer', ...) |
| spec-reviewer | opus | Task(subagent_type='agent-flow:spec-reviewer', ...) |
| scaffolder | sonnet | Task(subagent_type='agent-flow:scaffolder', ...) |
| architect | opus | Task(subagent_type='agent-flow:architect', ...) |
| fixer | opus | Task(subagent_type='agent-flow:fixer', model='opus', ...) |
| reviewer | opus | Task(subagent_type='agent-flow:reviewer', model='opus', ...) |
| test-engineer | sonnet | Task(subagent_type='agent-flow:test-engineer', ...) |
| backlog-creator | sonnet | Task(subagent_type='agent-flow:backlog-creator', ...) |
Activated when the first token of $ARGUMENTS is add (see Step 0 — Subcommand dispatch at the top of this file). Adds a single component (claude-md | ci | docker | tests) to an existing project. Single-shot — no resume detection, no spec phase, no architect, no fixer/reviewer loop.
Input: $COMPONENT = component name validated by Step 0 dispatch (one of claude-md | ci | docker | tests).
| Component | What it generates | Agent |
|---|---|---|
claude-md | CLAUDE.md with Automation Config | scaffolder |
ci | CI/CD config (.gitea/workflows/ or .github/workflows/) | scaffolder |
docker | Dockerfile + .dockerignore + docker-compose.yml | scaffolder |
tests | Test setup (test config + 1 smoke test) | scaffolder |
Before any pipeline operation, verify MCP tool availability:
mcp__* tool matching the tracker type is accessible/agent-flow:check-setup for diagnostics."The Step 0 dispatch already validated $COMPONENT against the supported list (claude-md | ci | docker | tests). If reached here, $COMPONENT is one of the valid values.
Detect the existing tech stack from project files:
pyproject.toml / setup.py → Pythonpackage.json → Node.js/TypeScriptgo.mod → GoCargo.toml → Rust*.csproj / *.sln → .NETpom.xml / build.gradle → JavaIf detection fails → ask the user.
Detect framework from imports and dependencies:
Display: "Detected stack: {language} + {framework}. Generating {component}. Continue? [Y/n]"
You MUST invoke Task(subagent_type='agent-flow:scaffolder', model='sonnet'). DO NOT inline-execute.
$COMPONENT)Verify that newly generated files did not break the build:
Display the list of generated files and next steps.
EXIT after step 6. The subcommand branch MUST NOT fall through to the new-project flow.
claude-md: if CLAUDE.md already exists → ask whether to overwrite or merge