agentleFS
Damon-Stewart-1Damon-Stewart-1/claude-skills-public/skills/dispatch/SKILL.md

dispatch

Skill3 starsChanged 7 months agoMITView on GitHub

Dispatch a task to a background Claude Code instance. Use when the user wants to kick off work without blocking the current session. Triggers on "dispatch", "background task", "run in background", "kick off", or "/dispatch".

  • Installs packages

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use orient, spec and 5 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.
  • moredipSkill

    orient

    Orient yourself to this codebase by reading the README and documentation

    Also in 3 projects that use this

  • SentrySkill

    spec

    Produce a verified spec — problem, desired outcome, and acceptance criteria — before building. Use when given a GitHub/Linear issue link, when starting from a fuzzy in-conversation idea, or asked to "figure out what to do" / "scope this" / "what should I build" — whenever the *what* isn't yet pinned down. Grills the ambiguities, checks the premise against the code, and produces acceptance criteria you sign off on — then hands to design-first.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 3 projects that use this

  • AWSSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 4 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 4 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default to read-only unless the task clearly requires writes.

    line 20
  2. Distinctive:

    Pick LLM target: Default is Claude. Ask if the task warrants a different LLM:

    line 24
  3. Very specific:

    Run with run_in_background: false since the subshell backgrounds via & and returns immediately.

    line 59
  4. Very specific:

    If a job shows failed, check ~/.claude/jobs/<JOB_ID>.log for the last 20 lines.

    line 83
  5. Very specific:

    If the task involves a specific project directory, pass it as the ADD_DIR argument.

    line 93
  6. Distinctive:

    Never dispatch tasks that need user judgment mid-execution.

    line 94
  7. Distinctive:

    Never dispatch tasks that touch production systems, push code, or send external messages.

    line 95
  8. Very specific:

    Do NOT use --bare flag (breaks keychain auth and disables hooks/plugins/CLAUDE.md).

    line 97

“Common” is measured: kept by at least 6 in 10 of the 24 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Dispatch: Background Claude Task Runner

The user wants to send a task to a separate Claude Code process running in the background.

What to do

  1. Confirm the task. Restate what the user wants done in one sentence. If unclear, ask.
  2. Pick permission tier. Based on the task:
    • Read-only (research, summarize, explain): "Read,Glob,Grep,Write,WebSearch,WebFetch" (Write always included so output file can be created)
    • Code (fix bugs, write features, refactor): "Read,Glob,Grep,Edit,Write,Bash(git diff *),Bash(git status *),Bash(npm test *),Bash(npx *)"
    • Full (commits, installs, builds): "Read,Glob,Grep,Edit,Write,Bash"
    • LLM review (Gemini/ChatGPT): "Read,Glob,Grep,Write,Bash" (unrestricted Bash needed for source ~/.api-keys-cache)
    • Default to read-only unless the task clearly requires writes. Ask if unsure.
  3. Pick model. For research, summaries, file searches, and template writes, add --model sonnet to reduce cost. Use Opus (default) for architecture, client-facing copy, and multi-step reasoning.
  4. Pick LLM target. Default is Claude. Ask if the task warrants a different LLM:
TargetWhen to useHow it works
ClaudeCode tasks, file edits, multi-step workDirect claude -p execution
GeminiReviews, second opinions, long analysisclaude -p calls gemini-api.sh
ChatGPTAlternative perspective, copy feedbackclaude -p calls chatgpt-api.sh

For Gemini/ChatGPT: write the prompt to a temp file first, then pass it via the script. Use unrestricted Bash tier. See references/multi-llm-dispatch.md for script paths and model names.

  1. Set timeout. Timeout is the circuit breaker (--max-turns was removed in Claude Code 2.1):

    • Simple (research, summaries): 600s
    • Medium (file edits, multi-step): 1800s
    • Complex (builds, large refactors): 3600s

    Requires gtimeout (GNU coreutils). If missing: brew install coreutils.

  2. Build and run. Generate job ID and write the prompt to a temp file, then launch:
JOB_ID="job-$(date +%Y%m%d-%H%M%S)"
PROMPT_FILE="/tmp/${JOB_ID}-prompt.txt"

# Write full task prompt to file (include file paths, project context, done criteria)
cat > "$PROMPT_FILE" << 'PROMPT'
<the user's task prompt>
PROMPT

# Launch in background
(bash "${CLAUDE_PLUGIN_ROOT}/skills/dispatch/scripts/dispatch.sh" \
  "$JOB_ID" "$PROMPT_FILE" "<TOOLS>" <TIMEOUT_SECS> [MODEL] [ADD_DIR]) &

echo "Dispatched ${JOB_ID} (PID: $!)"

Run with run_in_background: false since the subshell backgrounds via & and returns immediately.

  1. Report back. Tell the user: job ID, what it's doing, timeout, how to check (/jobs).

Failure detection

The dispatch script writes a .meta file with these fields:

status: running|complete|failed|timed_out
task: <first 80 chars of prompt>
model: opus|sonnet|haiku
started: YYYY-MM-DD HH:MM:SS
completed: YYYY-MM-DD HH:MM:SS
output: /path/to/output.md
tools: <tool list>
exit_code: <integer>

Status logic:

  • exit_code = 0 AND output file exists: complete
  • exit_code = 124: timed_out (gtimeout killed the process)
  • exit_code != 0 OR no output file: failed

If a job shows failed, check ~/.claude/jobs/<JOB_ID>.log for the last 20 lines.

Why /tmp/ for output

~/.claude/ is a sensitive write path. Claude Code blocks the Write tool there even with --permission-mode bypassPermissions. The dispatch script writes to /tmp/ first, then copies to ~/.claude/jobs/ via shell after completion.

For tasks needing multiple output files, direct the spawned Claude to ~/Claude-Stuff/ or a project directory.

Rules

  • If the task involves a specific project directory, pass it as the ADD_DIR argument.
  • Never dispatch tasks that need user judgment mid-execution.
  • Never dispatch tasks that touch production systems, push code, or send external messages.
  • The background Claude has NO access to this conversation's context. Include everything it needs in the prompt.
  • Do NOT use --bare flag (breaks keychain auth and disables hooks/plugins/CLAUDE.md).
  • Tell spawned Claude to target /tmp/ or ~/Claude-Stuff/ for writes, never ~/.claude/.
  • For tasks that benefit from parallel sub-agents, use /spawn-agent-team instead of a single dispatch.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.