src/autoskillit/skills_extended/implement-worktree/SKILL.md
Worktree implementation executor. ALWAYS invoke this skill when instructed to implement a plan in a worktree with testing and merging. Do not read the plan or edit files directly — use this skill first to load the full implementation workflow.
npx skillsauth add talont-org/autoskillit implement-worktreeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implement a provided plan in an isolated git worktree branched from the current branch.
{plan_path} — Absolute path to the implementation plan file (required)
NEVER:
run_in_background: true is prohibited)ALWAYS:
model: "sonnet" when spawning all subagents via the Task toolEdit call on any file, ensure you have issued a Read on that file earlier in this session. Claude Code rejects Edit on unread files — the retry wastes a full API turn at current context size. If you are uncertain whether a file was read, issue a targeted Read (offset + limit to the region you plan to edit) rather than risk an error.If this skill hits the Claude context limit mid-execution, the headless session
terminates with needs_retry=true in the tool response. The worktree remains
intact on disk with all commits made up to that point.
The orchestrator must not retry this skill when needs_retry=true. Retrying
creates a brand-new timestamped worktree, discarding all partial progress.
Correct orchestration on needs_retry=true:
/autoskillit:retry-worktree (via retry.on_exhausted)worktree_path from context.worktree_path (captured from this step's output)max_attempts: 0 on this step's retry block to ensure immediate escalation/, ./, {{AUTOSKILLIT_TEMP}}/,
or .autoskillit/ — that token is the plan path. Ignore any non-path words
that appear before it. If no path-like token is found, treat the entire
argument string as pasted plan content. Verify the resolved file exists before
proceeding; if it does not, abort with:
"Plan file not found: {path}. Correct format: /autoskillit:implement-worktree <plan_path>"Dry-walkthrough verified = TRUE:
AskUserQuestion to prompt: "Do you want to continue without dry-walkthrough validation?"/autoskillit:dry-walkthrough firstgit status --porcelain — if dirty, warn user_part_ (e.g., _part_a, _part_b, _part_1):
"🚧 SCOPE FENCE ACTIVE: I am implementing PART {X} ONLY. I MUST NOT open, read, or execute any other part files, regardless of what I encounter in {{AUTOSKILLIT_TEMP}}/ or any other directory. Sibling part files are out of scope for this entire session."
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
WORKTREE_NAME="impl-{plan_name}-$(date +%Y%m%d-%H%M%S)"
WORKTREE_PATH="../worktrees/${WORKTREE_NAME}"
git worktree add -b "${WORKTREE_NAME}" "${WORKTREE_PATH}"
WORKTREE_PATH="$(cd "${WORKTREE_PATH}" && pwd)"
mkdir -p "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}"
echo "${CURRENT_BRANCH}" > "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}/base-branch"
Before implementing ANY code, launch parallel Explore subagents to understand affected systems:
Set up the project's development environment in the worktree. Use the project's configured worktree_setup.command from .autoskillit/config.yaml if available. If not configured, check for a Taskfile with install-worktree task, or detect the project type and run appropriate setup.
cd "${WORKTREE_PATH}"
# If worktree_setup.command is configured, run it. Otherwise:
task install-worktree # or equivalent for the project type
Why isolated env matters: Installing packages without isolation overwrites the global state. When the worktree is deleted, CLI commands break with import errors.
All commands in Steps 4–6 must run from ${WORKTREE_PATH}. Use absolute paths to avoid CWD drift across Bash tool calls.
NEVER pause for confirmation between phases. Once the plan is loaded, execute all phases sequentially without asking the user whether to proceed to the next phase.
For each phase:
Where practical, delegate test updates to subagents to keep main conversation context lean.
Before running the test suite, confirm the following to prevent avoidable test-fix cycles:
## Architecture section in CLAUDE.md reflects themtask diagrams) or confirm new diagram files are listed in .gitignoreassert len(...) == assertions in the test suite before running {test_command}This checklist exists because these categories produce avoidable test-fix cycles: a single missed registration generates 5–30 cascading test failures that require a second commit to fix.
Read the configured test command(s) from .autoskillit/config.yaml: check test_check.commands (ordered list of commands, if set) or test_check.command (single command, default: task test-check). The test_check MCP tool runs all configured commands automatically.
Run the project's code quality checks and test suite from the worktree.
cd "${WORKTREE_PATH}" && pre-commit run --all-files
cd "${WORKTREE_PATH}" && \
AUTOSKILLIT_TEST_FILTER="${AUTOSKILLIT_TEST_FILTER:-conservative}" \
AUTOSKILLIT_TEST_BASE_REF=$(cat "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}/base-branch") \
{test_command}
If tests fail, fix the issue and re-run.
CURRENT_BRANCH=$(cat "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}/base-branch")
REMOTE=$(git remote get-url upstream >/dev/null 2>&1 && echo upstream || echo origin)
git fetch "$REMOTE"
git rebase "$REMOTE/${CURRENT_BRANCH}"
If conflicts occur, resolve them, git rebase --continue, then re-run tests. Report rebase status.
Output to terminal: worktree path, branch name, base branch, status, summary of changes, and next steps (fast-forward merge then clean up). Change directory before removing worktree to prevent deleting the cwd. Always confirm the merge went through before removing work tree. Do not merge until user confirms first!
Then emit these structured output tokens on their own lines so recipe capture blocks can extract them:
CURRENT_BRANCH=$(cat "{{AUTOSKILLIT_TEMP}}/worktrees/${WORKTREE_NAME}/base-branch")
IMPORTANT: Emit the structured output tokens as literal plain text with no markdown formatting on the token names. Do not wrap token names in
**bold**,*italic*, or any other markdown. The adjudicator performs a regex match on the exact token name — decorators cause match failure.
worktree_path = ${WORKTREE_PATH}
branch_name = ${WORKTREE_NAME}
base_branch = ${CURRENT_BRANCH}
git worktree list, suggest git worktree prunedevelopment
Generate YAML recipes for .autoskillit/recipes/. Use when user says "make script skill", "generate script", "script a workflow", "write a script", "create a script", "new recipe", "write a pipeline", or when loaded by other skills for script formatting.
data-ai
Create Uncertainty Representation visualization planning spec showing error bar definitions, distribution-aware alternatives, and multi-seed variance protocols. Statistical lens answering "How is uncertainty honestly represented?"
data-ai
Create Temporal Dynamics visualization planning spec showing axis scaling (linear vs log), smoothing disclosure, epoch/step alignment, run aggregation (mean + variance bands), early-stopping markers, and wall-clock vs step-count x-axis. Temporal lens answering "Are training dynamics shown clearly and honestly?"
data-ai
Create Narrative Story Arc visualization planning spec showing visual consistency across the report (same color = same model everywhere), logical figure progression, redundant figure detection, and narrative dependency between figures. Narrative lens answering "Do the figures tell a coherent story across the report?"