reproduce-in-worktree
Skill0 starsChanged 15 days agoMITView on GitHub
Reproduce a bug or a review finding in a git worktree, and try the fix there before you ask a person. Use for bugs, investigations and reviews.
- Reads credentials
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/CLAUDE.mdCLAUDE.md
- a11y-auditSkill
- architecture-reviewSkill
- bootstrap-projectSkill
- capture-screenshotsSkill
- customizeSkill
- deliver-featureSkill
- design-reviewSkill
- docs-upkeepSkill
- fix-bugSkill
- handoffSkill
- implementSkill
- leadSkill
- log-decisionSkill
- refine-requirementsSkill
- release-readinessSkill
- security-auditSkill
- ship-prSkill
- start-taskSkill
- sync-branchSkill
- threat-modelSkill
- verify-featureSkill
- vet-dependencySkill
- write-adrSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Check the main checkout first (git status).
- Very specific: line 21
Make sure the worktree has the code you mean to test: the right branch or commit (git -C <path> log -1).
- Distinctive: line 28
Write the smallest failing test that shows the problem, next to the code it covers.
- Distinctive: line 29
Run it and keep the output.
- Very specific: line 34
Follow implement / fix-bug: find the root cause, make the smallest change that makes the test pass, and keep the test.
- Distinctive: line 35
Run the project's full check suite in the worktree.
- Distinctive: line 49
Stop anything you started in the worktree (dev servers, containers, emulators).
- Very specific: line 50
If the result is merged or no longer needed: git worktree remove <path> and delete the throwaway branch (git branch -D wt/<topic>).
- Distinctive: line 51
If a person needs to inspect it, keep it and list it under "Still running" in the handoff, with the command to remove it.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Reproduce and fix in a worktree
Playbook files named here: when the project has its own copy at
.playbook/local/<same path>, use that copy instead.
Subject: $ARGUMENTS
A worktree is a second checkout of the same repository in its own folder. You can install, break, test and fix there without touching the main checkout, other people's uncommitted work, or another agent's files. Use it to try before you hand off: a person should get a reproduced problem and an attempted fix, not a guess.
1. Create the worktree
- Check the main checkout first (
git status). Never stash, reset or commit someone else's work to make room. - Create it:
- In Claude Code: ask to "work in a worktree" (the
EnterWorktreetool;ExitWorktreeleaves it), start a session withclaude --worktree <name>, or delegate to an agent withisolation: worktree. Claude Code puts worktrees in.claude/worktrees/and branches them from the default branch, or from your currentHEADwhen the project sets"worktree": { "baseRef": "head" }. - With git (any tool): a bug on the default branch:
git worktree add .claude/worktrees/<topic> -b wt/<topic> origin/<default-branch>. A branch or PR under review:git fetch origin <branch>(orgit fetch origin pull/<n>/head:pr-<n>on GitHub), thengit worktree add .claude/worktrees/<topic> <branch or pr-n>. - Make sure the worktree has the code you mean to test: the right branch or commit (
git -C <path> log -1).
- In Claude Code: ask to "work in a worktree" (the
- Set it up the project's way, from its
AGENTS.md"Commands": install from the lockfile (npm ci,uv sync, …) and generate what's generated. - Local configuration: gitignored files (
.env, local config) aren't in a new worktree. Claude Code copies the ones listed in the project's.worktreeinclude; otherwise copy only what the reproduction needs. Never print secrets, and never commit them. - Shared local services (a database container, a dev server port, an emulator) are shared with the main checkout. Use a separate port or database when the reproduction changes data, or say what you share.
2. Reproduce
- Write the smallest failing test that shows the problem, next to the code it covers. If a test isn't possible (a device, a third-party UI), write a script or exact manual steps.
- Run it and keep the output. A bug you can't reproduce is a finding too: record what you tried and what you saw.
- For a review finding, the reproduction is the proof: the input, the command and the wrong output. A finding you can't reproduce is reported as unproven, not as fact.
3. Try the fix
- Follow
implement/fix-bug: find the root cause, make the smallest change that makes the test pass, and keep the test. - Run the project's full check suite in the worktree. A fix that breaks something else isn't a fix.
- Two real attempts at most. If the problem still isn't solved, stop and hand off with what you learned.
4. Bring it back, or hand off
- Fixed and verified: commit in the worktree on its own branch, following the project's commit rules, and say how to bring it in: a PR from that branch, or a cherry-pick onto the working branch. Ask before pushing, merging or opening a PR if the project's rules require it.
- Needs a person (a product decision, a credential, a device you don't have, or the fix needs a judgement call): hand off with the
handoffshape and include:- the worktree path and branch;
- the reproduction: the failing test or the steps, and its output;
- what you tried and the result of each attempt;
- your recommended fix, and what's still unknown.
5. Clean up
- Stop anything you started in the worktree (dev servers, containers, emulators).
- If the result is merged or no longer needed:
git worktree remove <path>and delete the throwaway branch (git branch -D wt/<topic>). Claude Code removes an agent's worktree by itself when the agent changed nothing. - If a person needs to inspect it, keep it and list it under "Still running" in the handoff, with the command to remove it.
Rules
- One writer per worktree. Never edit the main checkout from a worktree session, and never edit another agent's worktree.
- Worktrees share one
.git: don't run commands that rewrite shared refs (reset --hardon a shared branch,gc --prune, force pushes to a branch someone else uses,rebase --update-refs,git stashthat another session could pop) while others work. Rebasing and force-pushing your own task branch withsync-branchis fine. - Reviewers stay read-only in the main checkout. In their own disposable worktree they may add a failing test to prove a finding; the test goes into the handoff, not into the reviewed branch.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

