do
Skill2 starsChanged 9 months agoMITView on GitHub
Run a task in an isolated worktree, present the diff for approval, then merge back. Lightweight alternative to /q for small, single-unit work.
In this repository18 other files it gives its agents.
- affirmationSkill
- auditSkill
- councilSkill
- gitSkill
- infoSkill
- kill-playgroundSkill
- memorySkill
- mergeSkill
- opsSkill
- qSkill
- refineSkill
- runSkill
- scopeSkill
- sim-sourceSkill
- stateSkill
- thinkSkill
- ui-brainSkill
- worktree-managerSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 13
Run a single task in an isolated worktree.
- Distinctive: line 20
No queue files. No relay. No drain loop.
- Very specific: line 22
Merging is out of scope for
/do: After execution, /do leaves the worktree alive with a running playground preview. - Very specific: line 61
If .claude/DO.md does not exist, move it: mkdir -p .claude && git mv DO.md .claude/DO.md (or plain mv if not tracked).
- Very specific: line 62
If .claude/DO.md exists, just rm DO.md and continue.
- Distinctive: line 72
If inline instructions provided: use them directly.
- Very specific: line 76
IMPORTANT: Do NOT use Agent(isolation: "worktree") — it branches from origin/main instead of the current HEAD.
- Very specific: line 129
After the worker returns, run specialist review agents against the worktree.
- Distinctive: line 140
When in doubt, include.
- Very specific: line 178
If the dev server errors with a missing packages/stl/dist, symlink it from the main repo:
- Very specific: line 239
One task, one agent: No parallelism within /do.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Do
Run a single task in an isolated worktree. Review the diff. Merge or discard.
/do — read instructions from DO.md at repo root
/do <instructions> — execute task in worktree, show preview, waitNo queue files. No relay. No drain loop. No auto-merge. Just: isolate → execute → preview → wait.
Merging is out of scope for /do. After execution, /do leaves the worktree alive with a running playground preview. Iterate by talking to Claude in the same conversation, or run /merge (a separate, token-gated skill) when you're ready to land the work.
Session persistence (state MCP)
/do registers with the state MCP for dashboard visibility and worktree recovery.
Scope key: task slug derived from the first ~30 chars of instructions (slugified).
Lifecycle:
- Step 1 (VALIDATE):
mcp__state__session_start(skill: "do", repo: {cwd}, scope: {task-slug}, payload: {instructions summary, origin_branch}). - Step 3 (EXECUTE):
mcp__state__session_checkpoint(session_id, phase: "execute", state_json: {worktree_path, worktree_branch}). - Step 4 (PREVIEW):
mcp__state__session_checkpoint(session_id, phase: "preview", state_json: {worktree_path, preview_url}). Session stays active after/doreturns — it completes when/mergeor a discard happens.
Recovery: If a new conversation finds an active do session in phase: "preview", check if the worktree still exists. If so, tell the user the worktree is still live (show path + origin branch) and suggest /merge or further iteration. If the worktree is gone, abandon the stale session and start fresh.
When to use /do vs /q
/do | /q | |
| Tasks | 1 | 1–N parallel |
| Overhead | Near zero | Queue files, relay, drain |
| Use when | Small, clear scope | Multi-task or needs file-disjoint parallelism |
Execution
Step 1: VALIDATE
- Record the current branch:
git rev-parse --abbrev-ref HEAD→$ORIGIN_BRANCH - Determine repo root:
git rev-parse --show-toplevel→$REPO_ROOT
If no inline instructions provided (bare /do):
The scratch file lives at $REPO_ROOT/.claude/DO.md (co-located with other Claude project config). On first use, migrate any legacy $REPO_ROOT/DO.md to the new location.
- Migration — if
$REPO_ROOT/DO.mdexists:- If
.claude/DO.mddoes not exist, move it:mkdir -p .claude && git mv DO.md .claude/DO.md(or plainmvif not tracked). Remove any/DO.mdline from.gitignore; ensure/.claude/DO.mdis gitignored. - If
.claude/DO.mdexists, justrm DO.mdand continue.
- If
- Check for
$REPO_ROOT/.claude/DO.md. - File does not exist →
mkdir -p .claude, create an empty.claude/DO.md. Ensure/.claude/DO.mdis in.gitignore(append if missing, don't duplicate). Tell the user:Created
.claude/DO.md. Awaiting instructions (inline or via DO.md). Then stop — do not proceed to Step 2. - File exists but is empty → tell the user:
Awaiting instructions (inline or via
.claude/DO.md). Then stop. - File exists and has content → read the full contents into
$INSTRUCTIONS, then immediately overwrite.claude/DO.mdwith an empty file (Write tool, empty string). Proceed with$INSTRUCTIONS.
If inline instructions provided: use them directly.
Step 2: CREATE WORKTREE
IMPORTANT: Do NOT use Agent(isolation: "worktree") — it branches from origin/main instead of the current HEAD. Create the worktree manually:
WORKTREE_ID="do-$(date +%s)"
WORKTREE_PATH=".worktrees/$WORKTREE_ID"
WORKTREE_BRANCH="do/$WORKTREE_ID"
git worktree add -b "$WORKTREE_BRANCH" "$WORKTREE_PATH"This branches from the current HEAD, preserving all local work.
Symlink node_modules so the worktree can resolve dependencies:
ln -sf "$(pwd)/node_modules" "$WORKTREE_PATH/node_modules"Step 3: EXECUTE
Spawn a single Agent — no isolation parameter (the worktree already exists):
Agent(
prompt: <see worker prompt below>,
mode: "bypassPermissions",
description: "do: <first 5 words of instructions>"
)Worker prompt:
You are a worker. Execute this task completely:
{instructions}
Your working directory is: {absolute path to worktree}
All file reads, edits, and git commands MUST use this directory.
Do NOT modify files outside this worktree.
Rules:
- Implement the task fully. Do not ask questions.
- Commit your work with a conventional commit message.
- If you encounter a blocker you cannot resolve, commit what you have
and note the blocker in your commit message.
- Read any relevant CONSTITUTION.md, *.spec.md, or *.ai.md files
before making changes.
- All styling via STL (styled() or stl prop). No plain style={}.
- Use STL shorthands (bg, p, px, radius, etc).Step 3b: REVIEW
After the worker returns, run specialist review agents against the worktree. Reviewers with the Output Contract (see .claude/agents/<name>.md) emit a fenced JSON block the gate parses to decide retry/proceed.
Selection — include by default, skip only when clearly irrelevant:
| Agent | Skip when |
stl-enforcer | No packages/stl* edits, no styled()/stl= usage |
a11y-reviewer | No interactive or visible UI, no ARIA-relevant changes |
design-critic | No UI/visual changes |
bundle-checker | No new deps, no new exports, no build-affecting changes |
When in doubt, include.
Spawn selected reviewers in parallel (all read-only, no conflicts):
Agent(
subagent_type: "{reviewer}",
name: "{reviewer}-do",
prompt: "Review changes in {WORKTREE_PATH}. Focus on files: {changed files list}. End with the Output Contract JSON block.",
)Parse each response for the fenced ```json block:
{ "severity": "ok|warning|error", "blocking": true, "summary": "...", "findings": [...] }Verdict:
- All
severity: "ok"→ proceed silently - Warnings only (no blocking) → surface in final summary, proceed
- Any
blocking: true→ re-spawn worker with collected findings (max 1 retry), re-review - Still blocking after retry → proceed to PREVIEW anyway; flag blocking findings prominently in summary
- Malformed/missing JSON → treat as
warning, surface in summary, no retry
Step 4: PREVIEW & HAND OFF
When reviews complete:
- Start playground preview in the worktree (web Vite dev server):
If the dev server errors with a missingcd {WORKTREE_PATH} && yarn dev:playground > /tmp/$WORKTREE_ID.log 2>&1 & PREVIEW_PID=$! for i in $(seq 1 40); do URL=$(grep -oE 'http://localhost:[0-9]+/?' /tmp/$WORKTREE_ID.log 2>/dev/null | head -1) [ -n "$URL" ] && break sleep 1 donepackages/stl/dist, symlink it from the main repo:ln -sf {REPO_ROOT}/packages/stl/dist {WORKTREE_PATH}/packages/stl/dist - Create the
.PREVIEWEDmarker (kept for compatibility with the olderworktree-preview-gate.shhook). The authoritative merge gate is now the token-baseddo-merge-gate.sh, but this marker is still required by the legacy hook:touch {WORKTREE_PATH}/.PREVIEWED Show the user a summary:
## `/do` complete — worktree standing by **Branch:** `{WORKTREE_BRANCH}` **Worktree:** `{WORKTREE_PATH}` **Origin:** `{ORIGIN_BRANCH}` **Preview:** {URL} ### Changes {agent's summary of what was done} ### Diff {run `git -C {WORKTREE_PATH} diff HEAD~1` to show the committed diff} --- The worktree is still live. Iterate in this conversation, or run `/merge` when ready to land.- Single
AskUserQuestion— the ONLY question at end of/do:- Question: "Run
/sim-sourceon this worktree?" - Header: "Sim source"
- Options:
- Yes — invoke the
sim-sourceskill pointed at{WORKTREE_PATH}so the iOS Simulator loads from the worktree. - No — leave Metro untouched.
- Yes — invoke the
multiSelect: false
- Question: "Run
- After the question is answered, STOP. Do not ask anything else. Do not offer merge. Do not offer discard. Wait for the user's next instruction (further iteration, or
/merge).
NEVER in /do
- Never merge. Merging only happens via
/merge, which is token-gated by thedo-merge-gate.shhook. Attemptinggit merge do/*inside/dowill be blocked by the hook — this is intentional. - Never run
git worktree removeon ado/*worktree. Also hook-blocked. - Never run
git branch -d do/*. Also hook-blocked. - Never call
claude-merge-tokenor read~/.claude-merge-key. Both are hook-blocked; the user generates tokens in their own terminal.
Edge cases
- Agent makes no changes: still hook-blocked from removing the worktree. Tell the user "No changes made" and surface the worktree path; they can discard via
/merge. - Agent returns error: Show the error. The worktree stays. User decides next step.
- Dev server won't start: surface the log tail, leave worktree alive, don't merge.
Rules
- Never queue.
/dois not/q. No queue files, no relay, no drain. - One task, one agent. No parallelism within
/do. - Worktree placement:
.worktrees/do-{id}subfolder convention. - No merging, no discarding. Those are
/merge's job and require user-supplied tokens. - Never use
Agent(isolation: "worktree")— it branches fromorigin/main, not HEAD. Always create the worktree manually withgit worktree add.
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.

