build-unplanned
Build a feature from description with worktree isolation and TDD. Usage /groundwork:build-unplanned "Add user login"
etr · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add etr/groundwork --skill build-unplanned技能说明
name: build-unplanned description: Build a feature from description with worktree isolation and TDD. Usage /groundwork:build-unplanned "Add user login" argument-hint: "[feature-description]" allowed-tools: ["Read", "Edit", "Write", "Bash", "Glob", "Grep", "Task", "Skill", "AskUserQuestion"] disable-model-invocation: true
Build Unplanned Feature
Thin orchestrator for ad-hoc feature development without existing task definitions. Delegates to plan-task (blurb mode), implement-task, and validate.
Token Discipline
This skill orchestrates long multi-agent workflows. Every turn re-reads the full context window, so unnecessary turns are expensive.
- No narration turns. Do not output text-only turns like "Let me understand your feature" or "Now I'll dispatch implementation." Combine text with a tool call in the same turn, or skip the text entirely.
- Batch tool calls. When multiple tool calls are independent, issue them all in one turn.
- No waiting updates. Do not output "Waiting for results..." turns. Wait silently until results arrive.
- Keep context lean. Do not read file contents you won't use directly. Pass file paths to subagents and let them read in their own context windows.
Pre-flight: Model Recommendation
Your current effort level is {{effort_level}}.
Skip this step silently if effort is high, xhigh, or max (the scale is low < medium < high < xhigh < max, so xhigh and max are already above high) AND you are Sonnet or Opus.
If effort is low or medium (i.e. below high), you MUST show the recommendation prompt — regardless of model.
If you are not Sonnet or Opus, you MUST show the recommendation prompt — regardless of effort level.
Otherwise → use AskUserQuestion:
{
"questions": [{
"question": "Feature development benefits from consistent multi-domain reasoning.\n\nRecommended: Sonnet or Opus at high effort.\n\nTo switch: cancel, run `/effort high` (and `/model sonnet` if on Haiku), then re-invoke.",
"header": "Effort check",
"options": [
{ "label": "Continue anyway" },
{ "label": "Cancel — I'll switch first" }
],
"multiSelect": false
}]
}
If the user selects "Cancel — I'll switch first": output the switching commands and stop. Do not proceed with the skill.
Step 0: Resolve Project Context
- Monorepo check: Does
.groundwork.ymlexist at the repo root?- If yes → Is
{{project_name}}non-empty?- If empty → Invoke
Skill(skill="groundwork:select-project")to select a project, then restart this skill. - If set → Project is
{{project_name}}, specs at{{specs_dir}}/.
- If empty → Invoke
- If no → Continue (single-project repo).
- If yes → Is
- CWD mismatch check (monorepo only):
- Skip if not in monorepo mode or if the project was just selected above.
- If CWD is the repo root → fine, proceed.
- Check which project's path CWD falls inside (compare against all projects in
.groundwork.yml). - If CWD is inside the selected project's path → fine, proceed.
- If CWD is inside a different project's path → warn via
AskUserQuestion:"You're working from
<cwd>(inside [cwd-project]), but the selected Groundwork project is [selected-project] ([selected-project-path]/). What would you like to do?"- "Switch to [cwd-project]"
- "Stay with [selected-project]"
If the user switches, invoke
Skill(skill="groundwork:select-project").
- If CWD doesn't match any project → proceed without warning (shared directory).
- Proceed with the resolved project context.
Step 1: Parse Feature Description
- Argument provided: Use the argument text as the feature blurb.
- No argument: Use
AskUserQuestionto ask:"What feature would you like to build? Describe it briefly."
Step 2: Plan → plan-task
Call Skill(skill="groundwork:plan-task") with the blurb from Step 1 in the conversation context. Do NOT pass a task_id — this triggers blurb/feature mode in plan-task, which will:
- Load existing specs (if any)
- Call
understanding-feature-requestsfor requirement clarification - Generate a
FEATURE-<slug>identifier - Spawn a Plan agent and persist the plan
Parse the output:
RESULT: PLANNED | plan_file_path=<path> | identifier=<id> | branch_prefix=<prefix>→ Saveplan_file_path,identifier,branch_prefix. Proceed.RESULT: FAILURE | ...→ Report the failure to the user and stop.
Step 2.5: Confirm Start
Use AskUserQuestion:
"[identifier] — plan ready. Proceed to implementation?"
- Option 1: "Yes, begin implementation"
- Option 2: "Stop here — I'll review the plan first"
If "Stop here": Print the plan file path and stop:
Plan saved to: <plan_file_path>
To resume implementation later:
/groundwork:implement-task <plan_file_path>
Step 3: Implement → implement-task
Call Skill(skill="groundwork:implement-task") with plan_file_path in the conversation context. Do NOT pass a task_id.
Parse the output:
RESULT: IMPLEMENTED | worktree_path=<path> | branch=<branch> | base_branch=<bb>→ Save values. Proceed.RESULT: FAILURE | ...→ Report failure to the user and stop.
Step 3.5: Optional Context Clear Pause
Use AskUserQuestion:
"Implementation complete for [identifier]. Validation runs 9 reviewer agents next and can compound context. Clear context before validation?"
- Option 1: "Continue to validation now"
- Option 2: "Stop here — I'll clear and resume manually"
If "Continue to validation now": Proceed to Step 4.
If "Stop here": Print resume instructions and STOP:
## Paused before validation
Implementation is committed in:
- **Worktree:** `<worktree_path>`
- **Branch:** `<branch>`
- **Base branch:** `<base_branch>`
To resume validation in a clean context:
1. Run `/clear` to clear Claude Code context
2. `cd <worktree_path>`
3. Run `/groundwork:validate`
After validation
阅读完整来源 ↗