一键导入
trellisbuild
Executes implementation from tasks.json through a check-driven feedback loop. Use when all spec artifacts are ready and implementation should begin.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Executes implementation from tasks.json through a check-driven feedback loop. Use when all spec artifacts are ready and implementation should begin.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Execute a Trellis task list by dispatching each task to a Claude Code subagent in its own context window. Use when the user says "build with sub-agents", "build with subagents", or when a feature has 5-20 tasks with dependencies between them. Reads `.specs/<feature>/tasks.md` produced by the tasks skill. Each subagent gets focused context (guidelines + plan + task + learnings) and returns results to the orchestrating session. Supports parallel execution of independent tasks via background subagents with worktree isolation.
Execute a Trellis task list using Claude Code's /batch command for bulk, patterned changes across many files. Use when the user says "build with batch" or when a feature involves repetitive changes across dozens or hundreds of files (e.g., migrating from one library to another, applying naming conventions, adding error handling patterns). Reads `.specs/<feature>/tasks.md` produced by the tasks skill. Translates the task list into one or more /batch invocations with worktree-isolated parallel agents.
Creates or updates .specs/guidelines.md with project-wide stack, conventions, and principles. Use when starting a project or when a fundamental technology decision has changed.
Use when user wants to Creates a pitch document at .specs/{feature}/pitch.md defining a problem domain with constraints, appetite, and solution shape. Use to frame a feature before writing a spec.
Use when user wants to Creates a technical plan at .specs/{feature}/plan.md translating a spec's functional requirements into architecture, technology, and code decisions.
Use when user wants to Creates a lightweight experiment document at .specs/sketches/{slug}.md to test a technical hypothesis before committing to a larger initiative.
| name | trellis:build |
| description | Executes implementation from tasks.json through a check-driven feedback loop. Use when all spec artifacts are ready and implementation should begin. |
| allowed-tools | Bash(*), Read, Write, Edit, Grep, Glob, Task |
Turn specifications into working code through a task-by-task feedback loop. Each task gets tests first (TDD), then implementation, then a check command validates correctness.
tasks.json exists (or plan.md exists — tasks.json will be auto-generated)Do this FIRST, before any pre-flight scripts or file reads.
Parse the user's invocation for the with ralph suffix and optional flags:
with ralph → Set ralphMode = "ralph". Ralph is a Docker-based loop script that runs each task in a fresh context. Fire-and-forget: the user walks away and comes back when it's done.ralphMode = "off". All tasks run in the current session.Optional flags (only meaningful in ralph mode):
--silent → Output goes to log files only; status shown between tasks.--tail → Show last 50 lines of each iteration's log after it completes.--no-judge → Skip the judge review at the end.IMPORTANT: If the user wrote with ralph, you MUST recognize it as an execution mode modifier. Never ask "what is ralph?" or treat it as an unknown term.
trellis.json to get specsDir (default: .specs)python3 ${CLAUDE_PLUGIN_ROOT}/scripts/validate-prereqs.py build <feature-name> and use the specsDir value from the JSON output. Abort if prerequisites are missing.{specsDir}/{feature}/tasks.json exists.
/trellis:prep to generate it." Then invoke /trellis:prep <feature-name>. After prep completes, continue with the generated tasks.json."done" → report completion and stop.check field is empty → ask the user: "What command should pass for code to be correct? (e.g., npm run lint && npm run typecheck && npm run build && npm run test)" Write their answer into tasks.json's check field.If ralphMode == "ralph":
Verify the check field in tasks.json is non-empty. If empty, abort with: "Ralph mode requires a check command. Set it in guidelines.md or run /trellis:build <feature> interactively first."
Launch ralph in the background:
bash ${CLAUDE_PLUGIN_ROOT}/scripts/ralph-loop.sh <feature-name> [limit] [flags]
Use run_in_background: true on the Bash tool.
Enter monitoring loop. Ralph writes progress to logs/ralph-<feature>/status.json and output to logs/ralph-<feature>/output.log. Poll every 60 seconds:
a. Read logs/ralph-<feature>/status.json. If the file does not exist yet, ralph is still starting up — wait and retry.
b. Display a compact progress block (no extra commentary):
Ralph: <feature> | <Xm Ys> elapsed
Task <index>/<total> (<id>): <title> [<phase>]
Done: <N> | Blocked: <N> | Pending: <N>
c. Read the last 10 lines of logs/ralph-<feature>/output.log using tail -10 and display them in a fenced code block labeled "Recent output".
d. If status.json shows "finished": true, exit the monitoring loop.
e. If the background process is no longer running (check via TaskOutput) AND status.json does not show "finished": true, assume ralph crashed. Display the last 30 lines of output.log and report the failure.
f. Sleep 60 seconds between polls using the Bash tool.
Final summary. When ralph finishes:
status.json for exit code and counts.logs/ralph-<feature>/judge.log.exitCode is non-zero, show the last 30 lines of output.log.If ralphMode == "off": Proceed to the execution loop below.
For each task in tasks.json where status == "pending", in order:
Run the check command from tasks.json. This verifies all previous work is still green.
Evaluate the task's verify field. If it describes behavioral expectations (validates input, returns errors, handles edge cases, state transitions), spawn the test-writer agent:
verify and do fields, plus test conventions from guidelines.mdSkip the test-writer for purely structural verify text (file exists, scaffold created, config set, compiles clean). Use python3 ${CLAUDE_PLUGIN_ROOT}/scripts/should-write-tests.py if unsure.
Write the code described in the task's do field. Follow this priority for guidance:
do field — most specific instructionsplan.md — technical patterns, file structure, architectureguidelines.md — project-wide conventionsRun the check command from tasks.json:
status to "done" in tasks.json. Git commit. Proceed to next task.status as "blocked" in tasks.json. Git commit. Move to the next task.After each task, write the updated tasks.json to disk. This is the resume point — if the session is interrupted, re-running /trellis:build <feature> picks up from the first pending task.
After all tasks are processed (unless --no-judge was passed):
Spawn the judge agent with:
spec.md — the full specificationtasks.json — showing which tasks are done, blocked, or pendinggit diff --stat — summary of all changes madeThe judge evaluates intent alignment: did the implementation satisfy what the spec asked for, not just what the tasks described? It returns a structured verdict (PASS / PARTIAL / FAIL) with per-task assessments and recommendations.
If the judge says PARTIAL or FAIL, fix the specific issues and re-run the check. Limit: 2 judge re-submissions. After that, report to the user with the judge's feedback.
In ralph mode, after the judge completes, an automated redefinition loop kicks in if blocked tasks remain or the judge returns PARTIAL/FAIL:
do fields with lessons learned."pending" and the task loop re-executes.During redefinition, status.json shows "currentPhase": "redefining" and includes a redefinitionPass field. Redefiner logs are written to logs/ralph-<feature>/redefiner-pass-N.log.
After the build is functionally complete (or redefinition limit reached), a polish phase runs two review agents sequentially:
Both agents are constrained: the optimizer must not change architecture, the improver must stay within spec scope. Neither may add new features. Tasks created by these agents include a "source" field ("optimizer" or "improver") for traceability.
During polish, status.json shows "currentPhase": "optimizing" or "improving". Logs are written to logs/ralph-<feature>/optimizer.log and logs/ralph-<feature>/improver.log.
Opt out with --no-polish. Skipped automatically if --no-judge is set (no judge means no polish).
When done (or when stopping due to blocked tasks), report:
references/external-integrations.md — How Ralph mode worksreferences/git-usage.md — Git rules during implementationreferences/sub-agent-strategy.md — Test-writer and judge spawningreferences/error-recovery.md — Resume from interruption