Skip to main content

build

Execute an approved implementation plan in small per-behavior batches. Reads the plan, implements each step one behavior at a time in the Code-First Small Batches cadence with a refactor on every green, runs inline review checkpoints, and produces verification evidence. Use when the user says "build this", "implement the plan", "start building", or after /plan has been approved.

来源信息

仓库
bdfinst/agentic-dev-team
最近来源活动
2026年11月6日 16:22
检测到的 SKILL.md 语言
英语
星标
302
Forks
35

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
3 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
build
description
Execute an approved implementation plan in small per-behavior batches. Reads the plan, implements each step one behavior at a time in the Code-First Small Batches cadence with a refactor on every green, runs inline review checkpoints, and produces verification evidence. Use when the user says "build this", "implement the plan", "start building", or after /plan has been approved.
argument-hint
[--plan <path>] [--yes] [--backstop-review=skip] [--candidates N] [--max-cost-usd X]
user-invocable
true
allowed-tools
Read, Write, Edit, Glob, Grep, Bash, Agent, AskUserQuestion
# Build Role: orchestrator. This command implements an approved plan — it does not create plans or specs. You have been invoked with the `/build` command. ## Orchestrator constraints **MUST — confirm agent-dispatch capability before any review-agent dispatch (issue #1461).** This skill dispatches review agents at four points: Step 3 (`spec-compliance-review` acceptance-criteria gate), sub-step 4 (per-step review checkpoint for `complex` steps), sub-step 6 (slice review checkpoint), and Step 7.6 (`acceptance-examiner` dispatch). Before any of those dispatches, you MUST confirm the `Agent` (or `Task`) tool is actually present and available in your current toolset. If it is not: **STOP** at that point — do not self-apply the reviewer's checklist inline as a substitute for independent dispatch, and do not mark the gate/checkpoint passed on that basis. Report to the user/operator plainly: this review checkpoint cannot run in this environment because no agent-dispatch capability (`Agent`/`Task` tool) is available; name exactly what's missing; and state that the build cannot proceed past this gate (nor reach the Step 6 `/code-review` backstop, which independently enforces the same rule) until it is run from a session with that capability. This is a hard requirement, not a preference. 1. **Follow the plan exactly.** If the plan is wrong, stop and ask the user — do not deviate silently. 2. **Every step is small per-behavior batches, one agent.** The cadence is **Code-First Small Batches** — each behavior follows IMPLEMENT → TEST → REFACTOR (the statistically separated winner of the workflow experiments; `docs/experiments/RECOMMENDATIONS.md` Rec 3). There is no cadence to resolve and no per-plan opt-in (ADR 0017) — Code-First Small Batches is the only cycle a step follows. One agent writes the code, the test, and the refactor for a unit of work; the refactor runs on **every** green — never deferred to an end-of-build pass, never skipped, never made conditional on task size or complexity (Rec 4); tests are frozen during REFACTOR; and big-batch shapes are prohibited — never all the code then all the tests, never all the tests then all the code. 3. **Incremental.** Each step must leave the codebase in a working, committable state. 4. **Verification evidence required.** Paste fresh test output before claiming a step is done. 5. **Review checkpoints (granularity scales with complexity).** Run inline review (static self-heal pass first, then spec-compliance, then quality agents) per step for `complex` steps; batch `standard`/`trivial` steps into one review at the slice boundary. When `~/.claude/telemetry.json` consent is enabled (and `DEV_TEAM_REVIEW_VALUE` is not `off`), record each checkpoint's find/fix/no-op outcome to `.claude/metrics/review-value.jsonl`. The final `/code-review` is the backstop. 6. **Be concise.** Report step status and verification evidence, no narration. 7. **Diagnose before retry.** When any bash command run during the build fails (a script, a test run, a build-tooling invocation), read the exit code and error text and state a one-line cause hypothesis before correcting and re-issuing it. Never re-run a failed command unmodified. If the shallow diagnosis reveals a real defect rather than a shell-level mistake (bad path, typo, missing arg), escalate to Systematic Debugging per the Escalation section below. ## Parse Arguments Arguments: $ARGUMENTS - `--plan <path>`: Path to the plan file. If omitted, search `plans/` for the most recently modified plan with status `approved`. - `--yes`: Auto-approve the build's approval gates (steps 2 and 3) without prompting (non-interactive opt-in). - `--backstop-review=skip`: Suppress **only** Step 6's backstop `/code-review` (#1962). Legal **only** when the caller has its own review pass over a diff that strictly contains this build's — an enclosing orchestrator's end-of-phase review loop, not a human running `/build` directly. Default **off**: an unflagged `/build` runs Step 6 exactly as before. Everything else is untouched — the inline checkpoints (sub-steps 4/6), the full-suite run (Step 5), runtime verification (4.9), invariants (4.10), and the Farley Score (Step 7) all still run, so this narrows one duplicated layer rather than trading review for speed. When set, print an audit line into the build output naming the enclosing reviewer: `Step-6 backstop review skipped (--backstop-review=skip) — enclosing reviewer: <name>.` Never set it on a `/build` whose diff nothing else reviews. - `--candidates N`: **experimental**. Applies only to steps whose `**Complexity**` is `complex`; N is between 1 and 8, and 1 is the unchanged build. The `--max-cost-usd` cap bounds candidate dispatch spend, not screening, and the skill checks it between batches, so one batch may overrun it. The cap bounds one step; a wave of W speculative steps may spend up to W times the cap, where W is their count. With N ≥ 2, `--jobs` greater than 1 is rejected (exit 2); set `DEV_TEAM_MAX_PARALLEL_BUILDS` for wave fan-out. The procedure is in [`skills/speculative-build/SKILL.md`](../speculative-build/SKILL.md). - `--max-cost-usd X`: Required with N ≥ 2, and rejected otherwise (exit 2). The step's cost cap in dollars. Validate the speculative flags before Step 0. Pass each raw value with the `=` form, so a value that begins with `-` reaches the validator instead of argparse. Omit a flag the user did not pass from the command below. Single-quote each raw value. If a raw value contains a single quote, stop before running the validator and print `--candidates, --max-cost-usd and --jobs values must not contain a single quote`. Before Step 0, also confirm the `Agent` (or `Task`) tool is available, as the Orchestrator constraints require. ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_candidates.py" validate-flags --candidates='<raw>' --max-cost-usd='<raw>' --jobs='<raw>' ``` On exit 2, print its stderr and stop. When the printed JSON has `"speculative": true`, locate the session transcript as [`/cost-report`](../cost-report/SKILL.md) does. Then run `python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_worktree_baseref.py" detect`, which must print `head`. If the transcript is not located or baseRef is not `head`, stop before Step 0 with the matching message below. - No transcript located: `--candidates needs the session transcript to enforce --max-cost-usd; none located — run without --candidates` - Any value other than `head`: `--candidates needs worktree.baseRef = head (detected: <value>); set it in .claude/settings.json or run without --candidates` When `"speculative": true`, print this line after Step 1 finds the plan: `speculative dispatch: <n> complex step(s) will use <N> candidates under a $<X> cap; other steps run as normal` Count n as the steps in the plan whose `**Complexity**` is `complex`. When n is 0, print `speculative dispatch: no complex steps in this plan; --candidates has no effect` instead. **Interactivity.** The run is **non-interactive** when any of these hold: `--yes` was passed, `DEV_TEAM_AUTO_APPROVE=1` is set, or stdin is not a usable TTY (`test -t 0` is false — the headless/CI/automation case). The approval gates in steps 2 and 3 use this: interactive runs prompt exactly as before; non-interactive runs auto-proceed and **record the bypass in the build output** rather than hanging. ## Steps ### 0. Context loading Invoke the [Context Loading Protocol](../context-loading-protocol/SKILL.md) at the start of this task. It decides which agents and skills to load for the current phase, and sets the context budget before any implementation work begins. This is a lightweight read — it does not add agents to context; it decides the load order so context stays under the 40% ceiling throughout the build. ### 1. Find the plan If `--plan` was provided, read that file. Otherwise, search `plans/` for `.md` files and find the most recently modified one with `**Status**: approved`. If no approved plan is found, tell the user: "No approved plan found. Run `/plan` first, then approve it." When the Parse Arguments validation reported `"speculative": true`, print the `speculative dispatch:` line defined there once the plan is found. ### 1.5. JS project bootstrap gate Before any implementation step runs, make sure a JS-flavored plan has a project to build in. A fresh JS project with no `package.json` will fail the first test run (no test runner, no scripts), so bootstrap it first. 1. **Check for `package.json`** in the working directory. If it exists, **skip this gate silently** and continue to Step 2. 2. **Check the plan file for JS/TS signals** — any of `.js`, `.mjs`, `.ts`, `.jsx`, `.tsx`, `node`, `npm`, `vitest`, `jest`, `eslint`. If none are present, the plan is non-JS: **skip this gate silently** and continue to Step 2. 3. **Bootstrap** (only when `package.json` is absent **and** the plan is JS-flavored): print exactly one line — `No package.json found for a JS plan — bootstrapping with project-init.` — then invoke the `project-init` skill. 4. **Halt on failure.** If `project-init` fails, **stop `/build`** and report the failure — do not proceed to Step 2 or any implementation step. The user sees no more than one line of output before `project-init` runs, and nothing at all when the gate is skipped. ### 2. Verify plan status Read the plan file. If the status is not `approved`: - **Interactive** → ask the user: "This plan has status '<status>'. Approve it before building, or continue anyway?" - **Non-interactive** (see Parse Arguments) → do **not** block. Auto-approve and continue, and print an explicit audit line into the build output: `Auto-approved plan status '<status>' (non-interactive) — no human gate. Trigger: <--yes | DEV_TEAM_AUTO_APPROVE=1 | no TTY>.` Either path appends an `approval` entry to `.claude/metrics/config-changelog.jsonl` per the [human-oversight-protocol § Audit trail](../human-oversight-protocol/SKILL.md#audit-trail) schema — `proposed` states the plan status being approved, `evidence_shown` points at the plan file, `risks_surfaced` is `[]` unless the plan's status itself signals a risk (e.g. resuming an `in-progress` plan). The non-interactive path writes the same three fields; `description` names the bypass trigger. ### 3. Verify acceptance criteria (gate) **Dispatch-capability gate (re-confirm here — issue #1461).** Before dispatching `spec-compliance-review` below, re-verify the `Agent`/`Task` tool is present. If it is not, STOP per the Orchestrator constraints above — do not self-verify the criteria inline; report the missing capability and halt before implementation begins. Before implementation begins, dispatch the `spec-compliance-review` agent (by `subagent_type`) in **criteria verification mode**: pass it the plan's acceptance criteria and per-step test expectations, and ask it to evaluate the criteria themselves (see below) rather than a diff. The reviewer evaluates each criterion for: - **Specificity**: Could two developers independently verify this criterion and agree on pass/fail? - **Testability**: Can this criterion be validated with a test or observable output? - **Completeness**: Are edge cases and error conditions addressed? If any criteria are flagged: 1. Present the findings to the user with the reviewer's suggested improvements 2. **Interactive** → Ask: "Revise these criteria before building, or proceed anyway?" - If the user overrides, log the override in the build output and continue - If the user revises, update the plan file and re-verify 3. **Non-interactive** (see Parse Arguments) → do **not** block. Proceed and record the bypass in the build output: `Acceptance-criteria gate auto-passed with N flagged criterion(s) (non-interactive) — no human gate. Trigger: <--yes | DEV_TEAM_AUTO_APPROVE=1 | no TTY>.` Include the flagged findings in the record so the bypass is auditable. Whichever path is taken (proceed, revise, or override), append an `approval` entry to `.claude/metrics/config-changelog.jsonl` per the [human-oversight-protocol § Audit trail](../human-oversight-protocol/SKILL.md#audit-trail) schema — `proposed` is the acceptance-criteria set under review, `evidence_shown` points at the plan file (and, for an interactive override, the reviewer's findings if written to `.claude/memory/`), and `risks_surfaced` lists the flagged criteria (`[]` if none were flagged). An interactive `override` (user overrides the reviewer's findings) is logged as `type: "override"` instead, with `proposed` recording the reviewer's flagged concern and `description` recording the user's decision to proceed anyway. ### 4. Implement each step Work the plan **wave by wave** (the plan's `## Parallelization` section, derived by `scripts/plan_waves.py`). Within a wave, independent slices may build concurrently; across waves a barrier holds the next wave until the current one reconciles green. **Base-ref check (top-level session, before any subagent dispatch).** Worktree subagents (`isolation: "worktree"`) must branch from the caller's local HEAD, not `origin/<default>`, so the `docs/specs/<slug>.md` (when the spec was file-persisted — see `/specs`' GitHub-issue persistence path for the alternative, which leaves no local file to miss) and `plans/<slug>.md` files `/ship` just produced are visible to them (issue #553). This is controlled by Claude Code's `worktree.baseRef` setting, which is honored only at project (`.claude/settings.json`) or user (`~/.claude/settings.json`) scope — **not** at plugin or project-local scope (`docs/spikes/worktree-baseref-head-spike.md`). `/build` cannot set this on the user's behalf, so it runs a read-only detect-and-warn **in this top-level `/build` session, before any subagent dispatch**, so the warning is visible in the human-facing transcript: ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_worktree_baseref.py" detect # prints head|fresh|unset|unknown ``` - **`head`** → no warning. Proceed. - **`fresh`**, **`unset`**, or **`unknown`** (detection failed — e.g. `jq` unavailable; treated fail-safe) → unless `DEV_TEAM_WORKTREE_BASE_FRESH=1` is set, print a loud warning naming the exact file to edit and a paste-ready snippet, then continue: ``` ⚠ worktree.baseRef is not "head" (detected: <value>) — worktree subagents will branch from origin/<default>, not your current HEAD. Any uncommitted-to-origin spec/plan/WIP files will be invisible to them. Add this to .claude/settings.json (project) or ~/.claude/settings.json (user) — plugin and project-local settings.json are NOT honored for this key: { "worktree": { "baseRef": "head" } } To keep fresh-from-origin worktrees deliberately, set DEV_TEAM_WORKTREE_BASE_FRESH=1 to silence this warning. ``` If detection returned `unknown`, the warning additionally states that `worktree.baseRef could not be detected`. **`/build` never mutates a settings file.** The check is read-only end to end — it never writes `.claude/settings.json`, `~/.claude/settings.json`, or any other settings file. There is nothing to restore and no crash-recovery surface. **Resolve the wave schedule and concurrency first:** ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_wave.py" <plan-file> # ordered waves + members python3 "${CLAUDE_PLUGIN_ROOT}/scripts/build_jobs.py" --wave-width <W> [--jobs N] # effective concurrency ``` `build_jobs.py` resolves `min(--jobs, DEV_TEAM_MAX_PARALLEL_BUILDS, wave width)`. Parallel fan-out is **opt-in**: when neither `--jobs` nor `DEV_TEAM_MAX_PARALLEL_BUILDS` is set, the **default is sequential** (effective 1) — fan-out never *saves* tokens, it trades them for wall-clock (#1515). Opt in with `--jobs N` (bounded only by wave width) or `DEV_TEAM_MAX_PARALLEL_BUILDS` (an explicit env value is honored verbatim, never re-capped); non-positive/non-integer values clamp to 1. **Sequential fallback:** when effective concurrency is **1** (the unset default, a fully-dependent plan, `--jobs 1`, or max 1), build slices one at a time in a single worktree in dependency order — **no worktree fan-out, no reconcile step** (today's behavior exactly). **Concurrent dispatch (effective concurrency > 1):** 1. Dispatch each independent slice in the wave to its **own** git worktree (`isolation: "worktree"`), up to the effective concurrency. Each slice's changes stay isolated until reconcile, and each slice still runs its full per-behavior cycle and inline review gates. When two slices in the wave each hold a speculative step, dispatch those two steps one after another (see Speculative dispatch below). 2. **Report the concrete level and cost** — name the slice count and the resulting multiplier, e.g. *"building wave 2 — 5 slices concurrently; ~5× wall-clock speedup, but burns your token budget faster — roughly 5× for 5 concurrent slices."* The cost is reported, never auto-throttled: cap it yourself with `--jobs N` or `DEV_TEAM_MAX_PARALLEL_BUILDS` if the burn rate is too high (#1170). 3. **Barrier + reconcile** once the wave's slices finish: `build_wave_reconcile.py --into <integration> --base <ref> --test-cmd "<full suite>" <slice-branch>...` merges them order-independently and gates on the full suite before any next-wave slice starts. 4. **Loud halt, never silent:** - A **failing slice** → exit non-zero naming it, list which same-wave slices succeeded and where their (preserved) worktrees are, print the resume command, and start no next-wave slice. Resume rebuilds only the incomplete slice. - A **reconcile conflict** (two same-wave diffs touch one file) → exit non-zero naming the file, pick no side, start no next-wave slice. **Slice dispatch bookkeeping (issue #865).** Before a slice's first step begins:
在 GitHub 查看
这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看