/mad-skills:build <plan text or spec file path> [--skip-questions] [--skip-review] [--no-ship] [--parallel-impl]from mad-skills
Executes a full feature-development lifecycle (explore, architect, implement, review, ship) in isolated subagents to minimize context consumption. Use with a detailed plan for autonomous execution.
Ships in mad-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
When this skill is invoked, IMMEDIATELY output the banner below before doing anything else.
Pick ONE tagline at random — vary your choice each time.
CRITICAL: Reproduce the banner EXACTLY character-for-character, including the diagonal / glyph before the name.
{tagline}
/$$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$ /$$$$$$$
/$$/| $$__ $$| $$ | $$|_ $$_/| $$ | $$__ $$
/$$/ | $$ \ $$| $$ | $$ | $$ | $$ | $$ \ $$
/$$/ | $$$$$$$ | $$ | $$ | $$ | $$ | $$ | $$
/$$/ | $$__ $$| $$ | $$ | $$ | $$ | $$ | $$
/$$/ | $$ \ $$| $$ | $$ | $$ | $$ | $$ | $$
/$$/ | $$$$$$$/| $$$$$$/ /$$$$$$| $$$$$$$$| $$$$$$$/
|__/ |_______/ \______/ |______/|________/|_______/
Taglines:
After the banner, display parsed input:
┌─ Input ────────────────────────────────────────
│ {Field}: {value}
│ Flags: {parsed flags or "none"}
└────────────────────────────────────────────────
Pre-flight results:
── Pre-flight ───────────────────────────────────
✅ {dep} {version or "found"}
⚠️ {dep} not found → {fallback detail}
❌ {dep} missing → stopping
──────────────────────────────────────────────────
Stage/phase headers: ━━ {N} · {Name} ━━━━━━━━━━━━━━━━━━━━━━━━━
Status icons: ✅ done · ❌ failed · ⚠️ degraded · ⏳ working · ⏭️ skipped
Execute a detailed design/plan through the full feature-dev lifecycle with maximum context isolation. Every heavy stage runs in a subagent so the primary conversation only accumulates structured reports.
Stage prompts: references/stage-prompts.md
Report budgets: references/report-contracts.md
Agent selection: references/architecture-notes.md
Project detection: references/project-detection.md
Parse optional flags from the request:
--skip-questions: Skip Stage 2 (the single front-load checkpoint, REQ-007)--skip-review: Skip Stage 5's native /code-review + /security-review dispatch--no-ship: Stop after Stage 8 docs update--parallel-impl: Split implementation into parallel agents when independent--no-superpowers: Force the standalone pipeline even when Superpowers is installed--handoff: Skip the execution-mode question and hand off to a clean session--no-handoff: Skip the execution-mode question and run here nowCaps (flag/env/default, any hit forces stop-and-report): --iterations/BUILD_AUTO_ITERATIONS/20, --budget/BUILD_AUTO_BUDGET/5M, wall-clock/BUILD_AUTO_WALLCLOCK/4h — see references/autonomous-pipeline.md.
Worktree creation MUST NOT be skipped or degraded for any reason, including perceived cost (e.g. per-tree dependency install time) — it is a correctness requirement (traceability, evidence isolation, avoiding polluting the primary checkout with in-progress feature branches), not a performance optimization (REQ-002).
Find-or-create (REQ-002–REQ-006): before any other pre-flight check, run
find-or-create (canonical flow in references/autonomous-pipeline.md's
"Find-or-create" section and references/autonomous-worktree-lifecycle.md's
"Creation — find-or-create" section):
branch/worktree_path frontmatter AND a
live worktree exists at that path on that branch → resume it, skipping
straight to the front-load checkpoint (step 6 below).gh pr list / AzDO equivalent) → STOP and report the conflict (lock holder,
or existing PR URL). Do NOT create a second competing worktree/branch (REQ-003,
CON-002).origin/main in the current working directory
(no worktree yet) → update the spec's frontmatter (branch, worktree_path)
and content-hash it → commit that updated spec as the branch's first commit →
only then create the worktree checking out that branch (native
EnterWorktree, or Superpowers' using-git-worktrees fallback, per
references/autonomous-worktree-lifecycle.md's standing CON-001 constraint
that mad-skills never invents its own worktree primitive) → push → open a
draft PR via skills/ship/scripts/create-pr.sh --draft (idempotent, reuses
any existing open PR).Enforcement guard (REQ-003–REQ-004): immediately after find-or-create's Create path completes, and before Stage 1 (Explore) begins, verify the working directory actually landed inside the new worktree:
if [ "$(git rev-parse --git-common-dir)" = "$(git rev-parse --git-dir)" ]; then
echo "❌ find-or-create did not result in a worktree — still in the primary checkout."
# report branch/commit state and the two recovery options; hard-stop, no Stage 1.
fi
--git-common-dir and --git-dir differ inside a linked worktree and are
identical in the primary checkout. On mismatch, hard-stop immediately, before
Stage 1, with an error naming the branch and commit that already exist in the
primary checkout and exactly two recovery options: manually create a worktree
checking out the existing branch, then re-run /build; or investigate why
creation failed. Do NOT attempt automated repair of the inconsistent state.
/build still refuses to run without a resolvable spec file argument (REQ-001,
AC-011): invoked with no spec (or a path that doesn't resolve to an existing
specs/*.md), it refuses immediately, directing the user to run /speccy first
— naming the missing spec (not a missing worktree) as the precondition, and
stops. Never fall back silently.
Before starting, check all dependencies in this table:
| Dependency | Type | Check | Required | Resolution | Detail |
|---|---|---|---|---|---|
| ship | skill | ls .claude/skills/ship/SKILL.md ~/.claude/skills/ship/SKILL.md ~/.claude/plugins/marketplaces/slamb2k/skills/ship/SKILL.md 2>/dev/null | yes | stop | Install with: npx skills add slamb2k/mad-skills --skill ship |
| prime | skill | ls .claude/skills/prime/SKILL.md ~/.claude/skills/prime/SKILL.md ~/.claude/plugins/marketplaces/slamb2k/skills/prime/SKILL.md 2>/dev/null | no | fallback | Context loading; falls back to manual instructions-file scan |
| feature-dev | plugin | registered + enabled check via scripts/lib/feature-dev.js | no | fallback | Detected → try feature-dev:code-explorer / code-architect / code-reviewer first, general-purpose agent as fallback if the subagent_type isn't actually registered |
| superpowers | plugin | registered + enabled check via scripts/lib/superpowers.js | no | fallback | Detected for --no-superpowers parity with speccy/ship; Stage 4 never defers to it (model-tiering enforceability, see references/autonomous-pipeline.md's Model tiering section) — see references/superpowers-deferral.md |
| ferry | skill | ls .claude/skills/ferry/SKILL.md ~/.claude/skills/ferry/SKILL.md ~/.claude/plugins/marketplaces/slamb2k/skills/ferry/SKILL.md 2>/dev/null | no | fallback | Powers the "hand off to a clean session" execution mode; ships with mad-skills, so normally present |
For each row, in order:
Run the Check command (for cli/npm) or test file existence (for agent/skill)
If found: continue silently
If missing: apply Resolution strategy
After all checks: summarize what's available and what's degraded
Capture PLAN (the user's argument) and FLAGS
Clear pending build handoff — if a build handoff was left by /speccy
or /build --handoff, clear it (keys are repo-wide, so this works from the
worktree too):
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/slamb2k}"
node "$PLUGIN_ROOT/hooks/session-guard.cjs" handoff-clear --kind build
Load project context — invoke /prime to load domain-specific context
(project instructions, specs, memory). If /prime is unavailable, fall back to
reading AGENTS.md, plus CLAUDE.md if it holds anything beyond @AGENTS.md,
and scanning specs/.
Detect project type using references/project-detection.md to populate
PROJECT_CONFIG (language, test_runner, test_setup)
Create task list — ALWAYS create tasks upfront for all stages using
TaskCreate. This provides visible progress tracking throughout the build:
--skip-questions)--skip-review)--no-ship)
Mark each task in_progress when starting and completed when done.Gather outstanding items from previous work (do not prompt yet — they are presented in the single front-load checkpoint at Stage 2, REQ-007):
TaskList for incomplete items@AGENTS.md,
for a "Known Issues" or "Open Questions" sectionBefore Stage 1, resolve the plan, check the branch, and pick the execution
mode — see references/pre-stage.md for the full procedure:
references/location-check.md; warns via a blocking AskUserQuestion if
Bash's cwd toplevel doesn't match the session's declared working
directory, otherwise passes silently./sync
if on an out-of-date default branch.ferry (only offered when context is already large and the plan is
self-contained; --handoff/--no-handoff force it). Subagents are always on
underneath either choice.Launch feature-dev:code-explorer (fallback: general-purpose):
Task(
subagent_type: "feature-dev:code-explorer",
description: "Explore codebase for build plan",
prompt: <read from references/stage-prompts.md#stage-1>
)
Substitute {PLAN} into the prompt.
Parse EXPLORE_REPORT. Extract questions for Stage 2.
Skip if --skip-questions or no questions and no OUTSTANDING_ITEMS found.
This is the single front-load checkpoint (REQ-007) — the only interview
round in the run. It asks all clarifying questions /build can reasonably
anticipate in one continuous Q&A phase (it may span multiple AskUserQuestion
calls if there are more than the 4-per-call limit, but no second checkpoint
occurs later). After it, the autonomous loop runs unattended — every later
ambiguity is decided-and-recorded, never escalated to a mid-build interview
(REQ-008; see references/autonomous-pipeline.md's per-decision self-evaluation).
Runs on the primary thread (requires user interaction).
questions and potential_issuesLaunch feature-dev:code-architect (fallback: general-purpose):
Task(
subagent_type: "feature-dev:code-architect",
description: "Design implementation architecture",
prompt: <read from references/stage-prompts.md#stage-3>
)
Substitute {PLAN}, {EXPLORE_REPORT}, {CLARIFICATIONS}.
Parse ARCH_REPORT. Present approach_summary to user for confirmation.
If rejected, incorporate feedback and re-run.
Implementation subagents MUST use Sonnet (REQ-013 (autonomous-execution-mode.md),
other stages keep interactive-default tiers). This stage never defers to
Superpowers, even when Superpowers is detected and --no-superpowers is not
set: the Skill tool used to invoke superpowers:executing-plans /
superpowers:subagent-driven-development has no model-override parameter, so
REQ-013's Sonnet mandate can't be enforced through that path. Stage 4 always
runs the standalone implementation below — see
references/autonomous-pipeline.md's Model tiering section (Resolved
interaction) for the full rationale, and references/superpowers-deferral.md
for how this differs from speccy and ship.
Draft PR (REQ-005): the draft PR was already opened by find-or-create in
pre-flight (skills/ship/scripts/create-pr.sh --draft, idempotent) — see
references/autonomous-pipeline.md's "Draft PR" section. It is not re-opened
here. Capture the pr_url from find-or-create; every evidence artifact from
here on posts against it.
If ARCH_REPORT identifies independent parallel_groups, launch multiple
general-purpose subagents in parallel — one per group. Do NOT wait for
--parallel-impl flag; parallel execution is the default when the
architecture supports it. The flag is retained only as an explicit override.
After each parallel group of 2+ implementers completes, run the cross-file
consistency check in references/autonomous-pipeline.md's "Parallel
implementation — cross-file consistency check" section before dispatching
any group that depends on it, or before Stage 5 if none remain.
If the architecture has no independent groups, launch one general-purpose subagent:
Task(
subagent_type: "general-purpose",
description: "Implement plan",
prompt: <read from references/stage-prompts.md#stage-4>
)
Substitute {PLAN}, {ARCH_REPORT}, conventions, {PROJECT_CONFIG.test_runner}.
Parse IMPL_REPORT(s). If any failed, assess retry or abort.
Skip if --skip-review.
Dispatch review-depth selection and native review per
references/autonomous-pipeline.md's Review-depth dispatch section (REQ-015,
GUD-002): compute the changed-file set and apply the
file-count-plus-risk-keyword-path rule from
references/autonomous-review-thresholds.md to select Standard or
Deep depth, then invoke the native /code-review and /security-review
commands directly via the Skill tool, passing the selected depth.
Draft PR is expected here — proceed anyway. Find-or-create opens the PR
as a draft and it stays draft through Stage 5; undrafting only happens at
Stage 9 (Ship). The native /code-review command's own eligibility check
treats any draft PR as "not eligible for review" — that check is written for
a human running /code-review on some arbitrary half-finished PR, not for
this pipeline, where Stage 4 (Implementation) has already completed and the
draft flag is pure bookkeeping. Do not let that check halt the pipeline:
dispatch the review regardless of the draft-eligibility verdict.
Parse findings into REVIEW_REPORT.
Only if Stage 5's native review found Critical/Important findings —
fix-loop mechanics (max 2 fix→re-review attempts per finding-set, then escalate
as stuck) are references/autonomous-pipeline.md's Fix loop section
(REQ-016, REQ-021).
Launch general-purpose subagent:
Task(
subagent_type: "general-purpose",
description: "Fix review findings",
prompt: <read from references/stage-prompts.md#stage-6>
)
Dispatch the native /verify command per references/autonomous-pipeline.md's
Verify against Definition of Done section (REQ-017, REQ-020): check the
implementation against the spec's ## Definition of Done checklist item by
item — each item is either verified-via-evidence or outstanding, never a
general "looks done" judgment. The stage is complete only when every
checklist item is verified.
If items remain outstanding, dispatch a fix subagent and re-verify, subject to the same fix-loop cap as Stage 6.
Skip if EXPLORE_REPORT has no source_docs.
Launch general-purpose subagent:
Task(
subagent_type: "general-purpose",
description: "Update progress documentation",
prompt: <read from references/stage-prompts.md#stage-8>
)
If --no-ship: Stop here and present final summary.
Reached once Stage 7 confirms every ## Definition of Done item verified.
Silently checkpoint before proceeding (GUD-004,
references/autonomous-pipeline.md): write a brief checkpoint waybill (status,
what remains, next action) to the path printed by
node "$PLUGIN_ROOT/hooks/session-guard.cjs" handoff-path --kind checkpoint
(distinct from /ferry's path, so a waiting ferry waybill is never overwritten), then arm it with
node "$PLUGIN_ROOT/hooks/session-guard.cjs" handoff-arm --kind waybill --source auto-checkpoint --waybill "<that path>".
Never instruct the user to /clear here. If a /ferry waybill is already
waiting, arm prints kept existing ferry waybill; auto-checkpoint skipped and
leaves it alone (exit 0).
Once this stage finishes — /ship returned, or the user chose "Finish here" —
retire the checkpoint so it is not replayed into an unrelated session:
node "$PLUGIN_ROOT/hooks/session-guard.cjs" handoff-clear --kind waybill --source auto-checkpoint
(--source makes this a no-op for a /ferry waybill).
Undraft the PR (mark ready for review) and push final state. Then branch on
the spec's completion_mode frontmatter field (REQ-009, REQ-011):
completion_mode: auto-ship — invoke /ship --auto directly, no
question asked (AC-004). --auto now runs full autopilot: CI-watch,
fix-loop, merge, and post-merge teardown (REQ-013).
/ship --auto --next-up-by-caller {approach_summary from ARCH_REPORT}. Files: {files from IMPL_REPORT}
completion_mode: pr — report the PR URL and summary, then stop. No
question asked (AC-005).AskUserQuestion (AC-006):
/ship --auto" → hand off to full autopilot, same as the
auto-ship branch above.Always runs on the primary thread (requires user interaction).
Scan all stage reports for unresolved items:
potential_issues not addressed by implementationrisks with deferred mitigationsmedium/low findings not fixed in Stage 6docs_skipped itemsissues_encountered that were worked aroundCompile into DEBRIEF_ITEMS (see references/stage-prompts.md#stage-10).
Categorise each as: unresolved_risk, deferred_fix, open_question,
assumption, or tech_debt.
If no items found, skip to Final Report.
Auto-capture into the Follow-ups Ledger (REQ-010 — always, not skippable).
Every surfaced item goes into the committed LOGBOOK.md so it survives
/clear. This is frictionless by design — the old "note it and forget it"
evaporation is the exact failure being fixed; capture is not gated on a
choice. The ledger dedupes on entry, so re-surfaced items don't pile up.
Build a JSON array (map each item's category to a ledger category —
unresolved_risk/deferred_fix/open_question/assumption/tech_debt are
accepted verbatim).
Breach-time triage first (REQ-006/008). Before the real capture, preview what it would do, against the same items array:
_R="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/slamb2k}"
node "$_R/hooks/session-guard.cjs" logbook-capture-preview \
'[{"title":"…","category":"deferred_fix","source":"/build debrief"}, …]'
Parse the would_relocate list between LOGBOOK_CAPTURE_PREVIEW_BEGIN/END.
If it reads would_relocate: none, skip straight to the real capture below —
no prompt needed.
If would_relocate lists one or more candidates AND this is a live
interactive session (the same condition that gates step 6's AskUserQuestion
below, not a headless/--auto run), present each candidate to the user via
AskUserQuestion. Address each candidate by its title text, not the
preview list's ordinal — the preview numbers candidates in victim-selection
order (lowest priority, then oldest date), which does not match
logbook-resolve/logbook-dismiss's plain-number selector (hot-file
display order); the title is matched by substring regardless of ordering,
so it's the only selector guaranteed to hit the right item. Options per
candidate:
node "$_R/hooks/session-guard.cjs" logbook-resolve "<title>"node "$_R/hooks/session-guard.cjs" logbook-dismiss "<title>"On a headless/non-interactive run, skip this prompt entirely and go straight to the real capture (REQ-007) — same silent-safety-net behavior as today.
Then run the real capture:
node "$_R/hooks/session-guard.cjs" logbook-capture \
'[{"title":"…","category":"deferred_fix","source":"/build debrief"}, …]'
Note any relocated:[…] in the output — mention relocations to the user
(never silent, GUD-002): those items moved to the archive file
(LOGBOOK-ARCHIVE.md), never dismissed or resolved — still open, still
addressable via /logbook archive.
Display the existing open ledger (REQ-044) alongside the new items, so the user reviews the whole backlog at the checkpoint where they're most likely to act:
node "$_R/hooks/session-guard.cjs" logbook-list
Present numbered summary via AskUserQuestion grouped by category.
Each item shows: [category] summary (effort). All items are already captured
in the ledger; this choice is about what to do now:
Options:
node "$_R/hooks/session-guard.cjs" logbook-resolve <n>.TaskCreate for each
item as a persistent task, with category as prefix and suggested
action as description. For each, link the ledger item to the task
(REQ-012) so it auto-resolves when the task completes — re-capture that
item with a link (dedupe attaches it to the existing entry):
node "$_R/hooks/session-guard.cjs" logbook-capture '[{"title":"<same title>","source":"/build debrief","link":"task#<id>"}]'.LOGBOOK.md; resurface
later via /logbook. No further action now (nothing is lost).After resolution, include debrief summary in the Final Report.
┌─ Build · Report ───────────────────────────────
│
│ ✅ Build complete
│
│ 📋 Plan: {first line of plan}
│ 🏗️ Approach: {approach_summary}
│
│ 📝 Changes
│ Files modified: {count}
│ Files created: {count}
│ Tests: {passed}/{total} ✅
│ Docs updated: {count or "none"}
│
│ 🔍 Review
│ Findings addressed: {count fixed} / {count found}
│
│ 📊 Debrief: {count resolved} / {count surfaced}
│ {list of created tasks}
│
│ 🔗 Links
│ PR: {pr_url}
│ CI: {merge_commit}
│
│ ⚡ Next steps
│ {debrief items or "none — all clear"}
│
└─────────────────────────────────────────────────
If any stage failed, report the failure point and what was accomplished.
When /build was invoked as part of a chained pipeline (e.g., from /speccy),
emit a concise Pipeline Summary after the Final Report. This gives an
at-a-glance view of the entire end-to-end process:
┌─ Pipeline Summary ─────────────────────────────
│
│ {icon} Spec {spec file or "inline plan"}
│ {icon} Explore {files identified count}
│ {icon} Questions {answered or "skipped"}
│ {icon} Architect {approach one-liner}
│ {icon} Implement {files changed summary}
│ {icon} Review {findings summary}
│ {icon} Verify {test result}
│ {icon} Ship {PR link} → {merge commit}
│
└─────────────────────────────────────────────────
Use ✅ for completed stages, ⏭️ for skipped, ❌ for failed.
Always emit this summary — even when /build was invoked directly (not
from /speccy). It serves as a compact status line for any multi-stage build,
regardless of how it was triggered.
/build always passes --next-up-by-caller when it invokes /ship, so the
ranked Next Up report is rendered here instead — after the Pipeline
Summary, as the very last output of the run (including a stopped or failed
build, where item 1 is resolving that). Follow
skills/ship/references/next-up.md (plugin root) for its sources, ranking,
and importance-banded format; the debrief items captured in Stage 10 are among its
inputs. Nothing may be printed after it.
If implementation succeeds but later stages fail:
handoff-clear --kind waybill --source auto-checkpoint so a stale
auto-checkpoint is not replayedreferences/architecture-notes.md (opens in a new tab)references/autonomous-pipeline.md (opens in a new tab)references/pre-stage.md (opens in a new tab)references/project-detection.md (opens in a new tab)references/report-contracts.md (opens in a new tab)references/stage-prompts.md (opens in a new tab)scripts/free-port.sh (opens in a new tab)scripts/free-port.test.js (opens in a new tab)tests/evals.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
14 skills in this plugin
/braceInitialize any project directory with a standard scaffold for AI-assisted development. Creates specs/ and context/ directories, a project AGENTS.md with development workflow and guardrails (plus a CLAUDE.md that just points at it), .gitignore, and branch protection. Idempotent — safe to run on existing projects. Triggers: "init project", "setup brace", "brace", "initialize", "bootstrap", "scaffold"./distilGenerate multiple unique web design variations for any website or web application. Accepts site specifications from a file (--spec path) or pasted text block. Creates a Vite + React + TypeScript + Tailwind project with Bun and produces N different creative designs accessible at /1, /2, /3, etc. Use when prototyping or exploring design directions for any web interface./docknpx claudepluginhub slamb2k/mad-skills --plugin mad-skills