delegate
Skill2 starsChanged 6 months agoMITView on GitHub
Spawn and cooperate with a child Claude session for a specific task. Handles tmux placement (pane/window/session/worktree), task-prompt injection, registry tracking, and returns a clean handle for follow-up. Cooperation verbs: /delegate list|status|tell|fetch|close <name>. Use when you want to hand off a scoped task to a separate session, say 'delegate this to another Claude', 'spawn a coach/agent for X', 'start a session working on Y', 'open a side Claude to handle Z', or '/delegate ...'.
78 other projects use a version of this.
Adopted by
Most recently taken up by
- brasillero/brstacktheir own version, first seen Nov 8, 2026
- go-sphere/skillstheir own version, first seen Nov 8, 2026
- victor-falcon/skillstheir own version, first seen Nov 8, 2026
- AlomoesDataScience/claude-skillstheir own version, first seen Nov 8, 2026
- lehcode/claudelegatetheir own version, first seen Nov 8, 2026
- codewhale-hq/codewhale-plugin-marketplacetheir own version, first seen Nov 8, 2026
Used with
Projects with it also use state, preview and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillstate
Store and query a Microsoft Managed App's built-in state and file attachments with `ms project state` CLI schema commands and generated TypeScript clients. First, with the user signed in to the CLI, run `ms feature status --name state --json`; if `feature.enabled` is not `true`, recommend an alternative connector or data source.
Also in 3 projects that use this
kv0906Skillpreview
Render vault notes as styled HTML and open in browser. Turn markdown docs, decisions, progress reports into readable previews. Use for "/preview docs/project-a/checkout-flow.md", "/preview progress all", "/preview decide auth-approach", or when user wants to see a doc before sharing.
Also in 3 projects that use this
GitHubSkillprd
Generate high-quality Product Requirements Documents (PRDs) for software systems and AI-powered features. Includes executive summaries, user stories, technical specifications, and risk analysis.
Also in 5 projects that use this
nicolasestremSkilldocument
Create focused documentation for specific components or features
Also in 3 projects that use this
anombyte93Skilldiscover
Phase 1 of the prd-taskmaster pipeline: brainstorm-driven discovery. Delegates to superpowers:brainstorming in Interactive Mode (one adaptive question at a time), or self-brainstorms in Autonomous Mode when no user is present. Intercepts before the brainstorming chain hands off to writing-plans — this skill owns the exit. Extracts constraints, calibrates scale (Solo / Team / Enterprise), and advances the pipeline to GENERATE.
Also in 3 projects that use this
Microsoft AzureSkillskill-authoring
Write Agent Skills that comply with the agentskills.io specification. WHEN: "create a skill", "new skill", "write a skill", "skill template", "skill structure", "review skill", "skill PR", "skill compliance", "SKILL.md format", "skill frontmatter", "skill best practices". DO NOT USE FOR: general documentation. INVOKES: vally CLI.
Also in 3 projects that use this
Other versions78 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 78
- prassanna-ravishankar/repowire★ 270same name
- HurricaHjz/SecondSelf★ 156same name
- wlsdks/ontology-atlas★ 149same name
- HurricaHjz/second-yourself★ 105same name
- spmtitsolution/OpenBA-Kit★ 38same name
- pvjbuilds/delegate-router★ 32same name
- PyModel/claude-architect★ 31same name
- peterpme/skills★ 28same name
- jisuzzzz/haechi★ 17same name
- mhlaghari/stuntman★ 16same name
68 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- chrome-validateSkill
- clarifySkill
- datavizSkill
- fresh-eyesSkill
- plan-archiveSkill
- pre-sendSkill
- respond-htmlSkill
- restart-processSkill
- restart-resumeSkill
- second-opinionSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 5 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 68 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
If the user invoked with just a verb (no task body), ask what they want delegated.
- Distinctive: line 63
When auto-resolving, tell the user what was picked + why in ONE line before spawning.
- Very specific: line 81
If --cwd provided, validate it exists (test -d).
- Very specific: line 102
Write the filled prompt to a unique temp file: /tmp/delegate-<slug>-<unix-ts>.md.
- Distinctive: line 110
Call the spawn helper:
- Very specific: line 144
After successful launch, the spawn helper has already written the initial registry JSON at ~/.claude/cache/delegate/<slug>.json …
- Very specific: line 146
Use the registry field from the spawn helper's JSON output as the path.
- Distinctive: line 164
If cooperate=false, omit the follow-up block and add: "Fire-and-forget — no registry, no tracking.
- Very specific: line 172
All verbs delegate name resolution and registry I/O to scripts/registry.sh.
- Distinctive: line 217
Never respawn on child crash: If the spawn script returns code 3, surface it.
- Very specific: line 220
Match model to task weight: If the task description implies judgment-heavy work (security, irreversible deploy, architectural decision) and …
“Common” is measured: kept by at least 6 in 10 of the 68 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/delegate — Spawn + cooperate with child Claude sessions
Takes a task description, opens a new Claude session in tmux pre-loaded with that task, writes a JSON registry entry for cooperation verbs, and hands the parent back a clean handle (tmux location + registry name).
Architecture: cooperation uses tmux send-keys + a JSON registry at ~/.claude/cache/delegate/<slug>.json — no MCP dependency. Works even when every MCP server is down.
Arguments: {{ arguments }}
Step 1 — Parse arguments
Accepted forms:
/delegate <task description>— spawn with defaults/delegate @<path-to-prompt-file> [--name ...]— use file content as the task/delegate list [--prune]— list active children (--pruneremoves dead targets)/delegate status <name>— show child's summary + last-seen + live tail/delegate tell <name> <message>— send message via tmux send-keys/delegate fetch <name>— retrieve last message received from child/delegate close <name>— ask child to wrap up + close window
Flags on spawn:
| Flag | Default | Effect |
--where pane|window|session|worktree|auto | auto (resolves to pane if parent's window has 1 pane, else window) | tmux placement |
--cwd <path> | inferred from task, else current | working directory of child |
--name <slug> | auto-slug from task | tmux window name + registry filename (~/.claude/cache/delegate/<slug>.json; slug derived from --name by lowercasing + hyphenating) |
--model opus|sonnet|haiku | inherit (no flag) | model override |
--cooperate / --fire-and-forget | --cooperate (true) | whether child should register + message back |
--summary "<line>" | auto | registry summary line (shown in /delegate status) |
--from-file <path> | — | load task body from a file (alternative to inline) |
--no-prefix | (off — default uses ↳ prefix on window/pane name) | suppress visual child marker |
--color <name> | yellow | runs /color <name> in the child session for visual differentiation; pass --no-color to skip |
--no-color | (off) | suppress the auto-/color step |
--permission-mode <mode> | auto | sets --permission-mode on the child claude process; auto prevents prompt stalls in unwatched windows |
--no-auto | (off) | revert to claude's default permission mode (removes --permission-mode auto) |
If the user invoked with just a verb (no task body), ask what they want delegated.
Step 2 — Resolve placement
All five placements are implemented. Default: auto — resolves to pane if the calling pane's window has exactly 1 pane (clean split), else window (avoid clutter). This makes most short-lived /delegate calls land as a sibling pane in the parent's window — child output is visible at-a-glance without window switching. Heavy or multi-pane parents fall back to a new window automatically.
Manual override decision tree:
- Debugging / parallel review / side-by-side comparison → explicit
--where pane - Substantive multi-step work in a clean parent window →
autolands here aspane - Substantive multi-step work in an already-busy parent →
autolands here aswindow - Fully isolated context, different repo or life area →
--where session - Risky / sandboxed code changes →
--where worktree
When auto-resolving, tell the user what was picked + why in ONE line before spawning. ("Spawning as pane in current window since it's not split — say if you want a separate window.")
Placement-specific semantics (handled by spawn.sh):
pane:tmux split-window -h -t <current-session>: -c <cwd>— target session is current tmux session only. v2 also callstmux select-pane -T '↳ <name>'to label the pane and enablespane-border-status topso the title shows in the border.window:tmux new-window -t <current-session>: -n '↳ <name>' -c <cwd>— the↳prefix marks this as a child relative to its spawner.session:tmux new-session -d -s <name> -n '↳ <name>' -c <cwd>— detached; won't steal focus. Session name itself stays clean (raw<name>); only the first window inside gets the prefix. Errors if session name already exists.worktree: same aswindow(with prefix), but claude is invoked withclaude -w <worktree-name>. claude creates the git worktree itself. Errors if cwd isn't inside a git repo.
Window/session naming:
--namewins for the base name. The↳prefix is applied automatically to the tmux display name (window or pane title); the registry JSON keeps the un-prefixed name. Use--no-prefixto suppress the visual marker.- Auto-slug from task: first 4–6 significant words, Title Case, joined with spaces, capped at ~30 chars.
- For
--where session, the<name>is also the tmux session name, so avoid names that collide with existing sessions (tmux has-session -t <name>pre-check recommended).
Step 3 — Resolve cwd
- If
--cwdprovided, validate it exists (test -d). - Else look for path hints in the task description (absolute paths,
~/...paths, or project-name keywords matching your dev-root layout — e.g.~/dev/<project>/). - Else use the parent's current cwd.
- Confirm with the user if inferred from hint — "cwd:
<path>— ok?"
Step 4 — Build startup prompt
Load templates/startup-prompt.md and fill placeholders:
{{TASK_BODY}}— the task description (or file contents if--from-file/@pathused){{NAME}}— the child's name (same as tmux window name / registry filename){{PARENT_TARGET}}— the parent's tmuxsession:windowname (fromtmux display-message -p '#S:#W'){{CHILD_TMUX_TARGET}}— where the child will end up (resolved after spawn; see Step 5 helper output){{CWD}}— resolved working directory{{SUMMARY}}—--summaryvalue or auto-generated from task (one line, ≤80 chars){{COOPERATE}}—trueorfalse{{SPAWNED_AT}}— ISO timestamp (date -u +%Y-%m-%dT%H:%M:%SZ){{COOPERATE_INSTRUCTIONS}}— the appropriate section ofreferences/cooperate-instructions.md(don't include both; pick one)
Write the filled prompt to a unique temp file: /tmp/delegate-<slug>-<unix-ts>.md.
Precompute {{CHILD_TMUX_TARGET}} from the parent's tmux session + the resolved placement: <session>:↳ <name> for window/worktree/session placements, or <session>:<window_idx>.<pane_idx> for pane (pane index is unknown pre-spawn — for pane placement, leave as the literal <pending> and the child can fetch its own target via tmux display-message -t "$TMUX_PANE" -p '#S:#I.#P' if needed).
Step 5 — Launch
Call the spawn helper:
~/.claude/skills/delegate/scripts/spawn.sh \
--name "<name>" \
--cwd "<resolved-cwd>" \
--prompt-file "<tmp-prompt-path>" \
--where "<pane|window|session|worktree>" \
[--session "<tmux-session>"] \
[--model "<model>"] \
[--cooperate "true|false"] \
[--worktree-name "<git-worktree-name>"]On success it emits one JSON line:
{"session":"main","window":"My Child Task","cwd":"/...","tty":"/dev/ttysNNN","pid":12345,"target":"main:My Child Task","where":"window"}The spawn script auto-dismisses the startup interstitial:
- Trust-folder prompt — first-run "Do you trust the files in this folder?" is auto-answered with Enter (default yes).
(The dev-channels warning no longer fires since claude() dropped those flags on 2026-04-24.)
Exit codes:
- 0 → success, parse JSON and build handle
- 1 → argument error (fix and retry, don't re-spawn)
- 2 → tmux error (surface to user, don't retry automatically)
- 3 → timeout waiting for claude REPL (window/pane/session exists but REPL never rendered — surface and let user inspect)
Step 6 — Return handle to parent
After successful launch, the spawn helper has already written the initial registry JSON at ~/.claude/cache/delegate/<slug>.json (status=initializing, placeholder summary). The child updates summary + status=active on its first turn — no need to poll for it from the parent.
Use the registry field from the spawn helper's JSON output as the path. The slug is the lowercased, hyphen-joined version of <name> (e.g., "Deep Delegate" → deep-delegate.json).
Print the handle in this shape:
✓ Delegated "<name>" to tmux <session>:<window>
cwd: <path>
pid: <N> tty: <tty>
registry: ~/.claude/cache/delegate/<slug>.json
Follow up:
- /delegate tell "<name>" <message> # send a message via tmux send-keys
- /delegate status "<name>" # read registry + live tail
- /delegate fetch "<name>" # capture-pane the latest child output
- /delegate close "<name>" # ask child to wrap up
- tmux select-window -t "<target>" # jump to it visuallyIf cooperate=false, omit the follow-up block and add: "Fire-and-forget — no registry, no tracking. Check the tmux window manually."
Step 7 — Cooperation verbs
Supported forms: /delegate list [--prune], /delegate status <name>, /delegate tell <name> <message>, /delegate fetch <name>, /delegate close <name>.
All verbs delegate name resolution and registry I/O to scripts/registry.sh. Use it from your Bash tool — don't reimplement the logic inline.
# Show all children (human table)
~/.claude/skills/delegate/scripts/registry.sh list
# Show as JSON (for parsing)
~/.claude/skills/delegate/scripts/registry.sh list --json
# Fuzzy-resolve a name to a tmux target (exit 0 = single match; 1 = zero or ambiguous)
~/.claude/skills/delegate/scripts/registry.sh resolve "<name>"
# Resolve with full JSON entry
~/.claude/skills/delegate/scripts/registry.sh resolve "<name>" --json
# Status card for one child (registry data + live tail)
~/.claude/skills/delegate/scripts/registry.sh status "<name>"
# Remove stale entries (dead tmux targets + unparseable JSON)
~/.claude/skills/delegate/scripts/registry.sh prune [--dry-run]Verb implementations (all <name> arguments get resolved first via registry.sh resolve):
/delegate list→registry.sh list(add--jsonfor parseable output)./delegate list --prune→registry.sh prune(the prune subcommand is separate fromlist; the parent-side verb maps to it)./delegate status <name>→registry.sh status <name>./delegate tell <name> <message>→ resolve target, thentmux send-keys -t <target> "<message>" Enter; sleep 1; tmux send-keys -t <target> Enter. Echo the send to the user; don't wait for reply./delegate fetch <name>→ resolve target, thentmux capture-pane -t <target> -p -S -300 | tail -80. Show the latest assistant response./delegate close <name>→ resolve target, clear stray input withC-u, send/close, monitor up to 60s./closesaves the child's work but does NOT terminate the Claude process — then send/exitfor a graceful shutdown. The window auto-closes when the process exits;tmux kill-windowis a fallback only if it lingers (ask the user first). Finallyrm <slug>.json.
Full spec (edge cases, exact output formats): references/cooperation-verbs.md.
Key rules:
- Never block waiting for a reply.
/delegate tellfires and returns immediately. Use/delegate fetchto read the child's latest output. - Never force-kill a live Claude process.
/delegate closeruns/close(saves work) then/exit(graceful termination) so the window auto-closes cleanly;tmux kill-windowis a fallback for a lingering shell only, and asks the user first. - The parent's own window is auto-excluded from resolve matches.
registry.shreads$TMUX_PANEto identify the calling pane. (NOT baretmux display-message— that returns the focused pane, not the calling pane.) - Stale registry entries are ignored by resolve and flagged as
☠ stalein list. Run/delegate list --pruneto clean them up.
Design constraints
- Never auto-spawn without user intent.
/delegateis invoked explicitly. Don't auto-trigger from other skills without "y/n ok to delegate?" first. - Never respawn on child crash. If the spawn script returns code 3, surface it. Let the user inspect.
- No MCP dependency for cooperation. Verbs use tmux + the registry. They work even if every MCP server is down.
- No cross-machine. tmux is local. Fail fast if user passes a hint suggesting remote.
- Match model to task weight. If the task description implies judgment-heavy work (security, irreversible deploy, architectural decision) and no
--modelwas passed, suggest--model opusbefore spawning. For pure mechanical work, suggest--model haiku.
References
- New to tmux? Start here:
tmux-primer.md— session/window/pane in plain English, with the placement table. - Startup prompt template:
templates/startup-prompt.md - Cooperation instructions appended to child:
references/cooperate-instructions.md - Cooperation verbs full spec:
references/cooperation-verbs.md - Spawn helper:
scripts/spawn.sh - Registry helper (list / resolve / prune / status):
scripts/registry.sh
Related skills
/close— referenced by the close verb. Not bundled here; the child can still be terminated viatmux kill-windowif you don't have a similar wrap-up skill./loop— a different pattern (recurring self-ping on the current session), not parallel work.
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.

