impl-via-git-worktree
Manual invocation only; use only when the developer explicitly requests `impl-via-git-worktree` or asks for implementation in a fresh local branch/worktree. Snapshot the current repository state into a new local `feature/topic-slug` or `fix/topic-slug` branch, create a separate git worktree, bridge the ignored local resources that worktree needs, implement and test there, and commit the result without pushing. If the target is an OpenSpec change or a path under `openspec/changes/`, derive the change from that target and, once inside the worktree, use OpenSpec tooling plus `openspec-apply-change` there instead of manually assuming artifact paths.
Best use case
impl-via-git-worktree is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Manual invocation only; use only when the developer explicitly requests `impl-via-git-worktree` or asks for implementation in a fresh local branch/worktree. Snapshot the current repository state into a new local `feature/topic-slug` or `fix/topic-slug` branch, create a separate git worktree, bridge the ignored local resources that worktree needs, implement and test there, and commit the result without pushing. If the target is an OpenSpec change or a path under `openspec/changes/`, derive the change from that target and, once inside the worktree, use OpenSpec tooling plus `openspec-apply-change` there instead of manually assuming artifact paths.
Teams using impl-via-git-worktree should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/impl-via-git-worktree/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How impl-via-git-worktree Compares
| Feature / Agent | impl-via-git-worktree | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manual invocation only; use only when the developer explicitly requests `impl-via-git-worktree` or asks for implementation in a fresh local branch/worktree. Snapshot the current repository state into a new local `feature/topic-slug` or `fix/topic-slug` branch, create a separate git worktree, bridge the ignored local resources that worktree needs, implement and test there, and commit the result without pushing. If the target is an OpenSpec change or a path under `openspec/changes/`, derive the change from that target and, once inside the worktree, use OpenSpec tooling plus `openspec-apply-change` there instead of manually assuming artifact paths.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Implement via Git Worktree Manual invocation only: use this skill only when the developer explicitly wants this workflow. Implement a change in an isolated worktree without disturbing the active checkout. Carry the current dirty repository state forward into a new local branch, bridge the local-only state the worktree needs, and do all edits, builds, and tests from inside that worktree. ## Defaults Unless the developer says otherwise, use these defaults: - **Topic slug**: derive from the target; normalize to hyphen-case; keep stable for the whole session - **Branch kind**: use `fix` for broken behavior, regressions, failing tests, or bug repairs; otherwise use `feature` - **Implementation branch**: `<branch-kind>/<topic-slug>` - **Implementation home**: `<repo-root>/.agent-automation/impl-branches/<branch-kind>/<topic-slug>` - **Worktree**: `<impl-home>/repo` - **Extra link dirs**: none - **Default linked dirs**: `.claude`, `.codex`, `.gemini`, `.github`, `.aider`, `.cursor`, `.continue`, `.windsurf`, `.kiro`; also `.pixi` when the repository appears Pixi-managed and `.pixi/` exists locally - **Final commit**: one or more local commits on the new branch after relevant verification passes; do not push them If this skill creates `.agent-automation/impl-branches/`, add it to `.gitignore`. If `.gitignore` already has commented `impl-branches` entries, do not auto-add the rule. ## Workflow ### 1. Resolve the target and branch naming - Identify the exact change to implement and the verification commands you expect to use. - Choose the branch kind: `fix` for repairs, `feature` for new behavior or refactors. - Derive a stable topic slug from the target; normalize it to hyphen-case and keep it stable for the whole session. - Decide whether the task obviously depends on extra local directories beyond the helper defaults. #### Special case: OpenSpec target When the target is an OpenSpec change, use this special-case path instead of assuming a normal repository task flow. - Treat a path under `openspec/` that clearly points to a change, especially `openspec/changes/<change-name>/...`, as an explicit OpenSpec target signal. - Prefer deriving the change name directly from that path. If the path is not enough to identify the change confidently, confirm it with `openspec list --json` before proceeding. - Prefer the resolved change name as the topic slug unless the developer asks for a different slug. - Plan to run the OpenSpec commands from inside the worktree and hand implementation flow to `$openspec-apply-change` there. ### 2. Create the isolated branch and worktree Use the bundled helper instead of inventing the Git plumbing ad hoc: ```bash bash <skill-dir>/scripts/create_impl_worktree.sh --topic TOPIC_SLUG --kind feature ``` For repair work, switch `--kind fix`: ```bash bash <skill-dir>/scripts/create_impl_worktree.sh --topic TOPIC_SLUG --kind fix ``` Optional arguments: ```bash bash <skill-dir>/scripts/create_impl_worktree.sh \ --repo PATH \ --topic TOPIC_SLUG \ --kind feature \ --branch feature/TOPIC_SLUG \ --impl-home IMPL_HOME \ --path WORKTREE_PATH \ --link-dir RELATIVE_DIR ``` If the helper reports that the branch or path already exists, stop and choose whether to continue that existing isolated session or create a new topic slug. Do not silently reuse or overwrite an existing worktree. ### 3. Bridge local resources before testing - Review the helper output for which directories were linked or skipped. - Before the first test run, inspect the target and do a best-effort setup pass. - If the task depends on ignored, untracked, external, or otherwise non-snapshotted resources, create the narrowest useful symlink into the worktree so the system can run. - Treat these bridges as local setup, not as product changes. Do not commit them unless the repository intentionally tracks that path. ### 4. Move into the worktree and stay there - `cd` into the `WORKTREE` path returned by the helper. - After that point, read files, edit files, run builds, and run tests from the worktree only. - Do not switch branches or patch files in the original checkout once the isolated worktree exists. - For OpenSpec targets, this also becomes the only place where you run `openspec` commands or edit change artifacts. ### 5. Implement and verify in the isolated tree - Make the requested code changes in the worktree. - Run the most relevant tests, linters, or build steps there, using the repository's normal workflow. - If a missing local resource blocks verification, bridge it into the worktree and rerun from there. - Keep focus on the requested change; do not clean unrelated problems unless they directly block delivery. #### Special case: OpenSpec target When the target is an OpenSpec change, use this special-case path instead of assuming a normal repository implementation flow. - Do not assume files such as `proposal.md`, `design.md`, or `tasks.md` exist just because the user pointed at an OpenSpec-looking path. - First gather authoritative context in the worktree with OpenSpec tooling such as `openspec status --change "<change-name>" --json`. - Then use `$openspec-apply-change` inside the worktree to drive the implementation loop. - Let `$openspec-apply-change` own artifact discovery, context-file reading, task progression, and checkbox updates while this skill continues to own the isolated branch/worktree boundary. ### 6. Commit locally on the new branch - Review `git status` in the worktree before committing. - Commit the implementation on the new branch once relevant verification passes. - Follow the repository's commit convention if it is obvious. Otherwise use a concise imperative message with `feat:` or `fix:` matching the branch kind. - Never push unless the developer explicitly asks. ### 7. Report the isolated result - Report the worktree path, branch name, final commit SHA, and the commands you used for verification. - Call out any extra symlinked resources or manual setup assumptions that the developer should know about. - State explicitly that the branch and worktree remain local. ## Guardrails - Never switch branches in the developer's original checkout. - Never keep implementing in the original checkout after the isolated worktree exists. - For OpenSpec targets, never update the change artifacts from the original checkout; use OpenSpec tooling and `$openspec-apply-change` from inside the worktree. - Never push, open a PR, or delete the branch/worktree unless the developer explicitly asks. - Never copy the repository manually; use `git worktree`. - Never treat a missing local resource as a product bug before checking whether it should simply be bridged into the worktree. - For OpenSpec targets, never bypass OpenSpec CLI discovery by hard-coding the artifact layout when the tool output can tell you what artifacts actually exist. ## Resources - `<skill-dir>/scripts/create_impl_worktree.sh`: Create the implementation branch/worktree from the current repository state and safely link reusable local-state directories. ## Example Prompts - `Use $impl-via-git-worktree to implement this feature in a fresh local worktree and commit it there without pushing.` - `Use $impl-via-git-worktree to fix the failing runtime bug on a local fix branch, run the relevant tests from inside that worktree, and leave the branch local for review.` - `Use $impl-via-git-worktree for this refactor, keep my active checkout untouched, and tell me which extra local directories had to be linked into the worktree.` - `Use $impl-via-git-worktree on openspec/changes/<change-name>, create a local worktree for it, and then use $openspec-apply-change inside that worktree to implement the remaining tasks.`
Related Skills
create-git-worktree
Manual invocation only; use only when the user explicitly requests `create-git-worktree` by exact name. Create a clean git worktree for the current repository and symlink reusable local tool-state directories into it.
pixi-make-offline-channel
Use when the user wants to create a self-hosted, offline-installable Conda channel (mirror) containing a specific subset of packages using Pixi.
pixi-make-cu-build-env
Guides the agent to setup a new or existing Pixi environment for compiling C++ and CUDA code. It ensures the correct compilers, toolkits, and CMake configurations are in place for a robust user-space build.
pixi-install-nvidia
Use when the user says "use pixi to install <some nvidia tool>" (or similar) and wants NVIDIA/CUDA/GPU packages installed via Pixi (no sudo/apt), e.g., CUDA toolkit pieces, cuDNN/NCCL, PyTorch CUDA builds, RAPIDS.
pei-docker-usage
Helper for PeiDocker (`pei-docker-cli`). Trigger ONLY when the user explicitly requests PeiDocker usage OR when working within a PeiDocker-generated project (indicated by `user_config.yml`).
conan-basic-usage
Basic operations for the Conan C++ package manager. Use when the user explicitly asks to 'use conan' for tasks like creating projects, installing dependencies, or building packages, or asks for 'how to' guidance on Conan setup.
explore-dnn-model
Manual invocation only; use only when the user explicitly requests `explore-dnn-model` by name. Explore how to run a given DNN model checkpoint in the current Python environment by locating weights + upstream source code, resolving dependencies with user confirmation, running reproducible experiments under `tmp/`, and producing reports about I/O contracts, timing, and profiling.
openspec-ext-revise-by-decision
Manual invocation only; use only when the user explicitly requests `openspec-ext-revise-by-decision` by exact name. Revise OpenSpec change artifacts from a review or decision document that contains questions plus `DECISION` blocks, applying chosen decisions from a review file such as `openspec/changes/<change>/review/review-*.md` back into proposal, design, specs, and tasks.
openspec-ext-review-plan
Review an OpenSpec change (or a single OpenSpec change artifact file) for completeness, coherence, and alignment with existing system design; capture actionable feedback plus open questions; write a review report under the change directory (review/review-YYYYMMDD-HHMMSS.md).
openspec-ext-respond-to-review
Read an OpenSpec review report critically, evaluate the reviewer's proposals and findings against the current change artifacts and repository context, and write developer-owned final decisions/responses back into the review document. Use when the user explicitly mentions `openspec` or points to a path under `openspec/` while asking to examine a review report carefully, decide open questions, respond to findings, fill `DECISION` blocks, respond to an OpenSpec review file, or record final answers in an OpenSpec review document without yet revising the proposal, design, specs, or tasks.
openspec-ext-hack-through-test
Manual invocation only. OpenSpec-specific hack-through-testing workflow targeting production-level end-to-end paths using real data and real user workflows — not CI smoke/unit/integration tests. Three subskills: `propose` to create an OpenSpec change with HTT-ready test cases (automatic scripts and interactive guides) by invoking `openspec-propose` or `openspec-ff-change`, `revise` to update an existing OpenSpec change so its artifacts support hack-through-testing-driven implementation and testing, and `run` to exercise an implemented OpenSpec change through the full hack-through-testing loop (in-place by default, or in a disposable snapshot worktree when requested). Use when the user explicitly asks for `openspec-ext-hack-through-test`, points to `openspec/changes/...` while asking to propose, revise, run, exercise, or prepare work under hack-through-testing principles, or wants OpenSpec work shaped for fast blocker discovery through patch-forward testing.
openspec-ext-explain
Create or update OpenSpec change explanation docs that capture developer-facing questions and answers under `openspec/changes/.../explain/`. Use when the user explicitly mentions `openspec` or points to a path under `openspec/` while asking to create, update, document, or maintain a Q&A, FAQ, explain note, or question-and-answer doc for an OpenSpec change based on user questions, implementation notes, review questions, or current chat context.