agentleFS
milanglaciermilanglacier/handoff-to-claude-code-skill/skills/handoff-to-claude-code/SKILL.md

handoff-to-claude-code

Skill4 starsChanged 4 months agoMITView on GitHub

Hand a task or a question to Claude Code (the `claude` CLI) and relay what it produces. Use ONLY when the user explicitly asks for it. Do not use it on your own judgment that a task looks hard, and do not use it if you are Claude Code yourself.

  • Reads credentials

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. aiatelie/ai-atelie★ 11same name
    2. stritar/skills★ 0same name

    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.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    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
  1. Distinctive:

    Do not summarize it, do not reformat it, do not merge it into your own prose, and do not append your own commentary.

    line 61
  2. Distinctive:

    If your harness has its own background-shell facility, use that - it gives the user better visibility.

    line 86

≈ “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.

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

Handoff to Claude Code

Delegates work to a local Claude Code session through claude -p. The user's Claude subscription pays for it, so only run it when the user asked you to.

SKILL_DIR below is the directory holding this SKILL.md; the wrapper is $SKILL_DIR/scripts/handoff.py. Run python3 $SKILL_DIR/scripts/handoff.py doctor once on a new machine to confirm the CLI is installed and logged in.

Pick a mode

chatagent
The deliverable isthe text Claude writesthe work Claude does on disk
Claude mayread, search, run commandseverything, including edits
You shouldrelay the text verbatimsummarize what happened

chat withholds Edit and Write, but it can still run shell commands - so it is the right mode when nothing should change, not a guarantee that nothing can.

python3 "$SKILL_DIR/scripts/handoff.py" chat  "Why does this crash on startup?"
python3 "$SKILL_DIR/scripts/handoff.py" agent "Port the auth module to the new API and run the tests"

Both commands print Claude's output, then a footer:

--- handoff metadata ---
session: 6b1c…   model: claude-opus-5   cost_usd: 0.12   duration_s: 41   dir: /path

The footer is for you, not the user. Never show it to them - except model:, which is the name to use in the attribution line below. It is the model that did the work, already disambiguated from the auxiliary model that permission checking runs in the background; take it as given rather than reasoning about token counts yourself.

For a long or multi-line prompt, pass - and pipe it in:

python3 "$SKILL_DIR/scripts/handoff.py" agent - <<'EOF'
Refactor the parser so that ...
EOF

Relaying chat output

Everything above the --- handoff metadata --- line is Claude's answer. Reproduce it in your final message verbatim - same words, same markdown, same order - preceded by exactly one attribution line:

— via Claude Code (claude-opus-5) —

Do not summarize it, do not reformat it, do not merge it into your own prose, and do not append your own commentary. The user asked for Claude's answer; your job is to carry it across intact.

Relaying agent output

Here the deliverable is on disk, not in the text. Read the output and tell the user, in your own words, what changed, what was verified, and what is still open. No verbatim relay needed.

Follow-up turns

The wrapper prints a session id. Keep it, and pass it back for every follow-up so Claude keeps its context:

python3 "$SKILL_DIR/scripts/handoff.py" chat --session 6b1c… "and what about the timeout path?"

Sessions are scoped to the directory the run happened in. Stay in the same directory (or pass the same --dir) for every turn of a thread, or the session will not be found. --continue picks up the most recent thread in the current directory when you no longer have the id.

Long runs

An agentic task can run for many minutes and outlast your shell tool's timeout.

  • If your harness has its own background-shell facility, use that - it gives the user better visibility. Just run the foreground command inside it.
  • Otherwise add --background, which returns a job id immediately:
python3 "$SKILL_DIR/scripts/handoff.py" agent --background "Migrate all call sites"
python3 "$SKILL_DIR/scripts/handoff.py" status <job-id>
python3 "$SKILL_DIR/scripts/handoff.py" tail   <job-id> -n 40
python3 "$SKILL_DIR/scripts/handoff.py" wait   <job-id> --timeout 600
python3 "$SKILL_DIR/scripts/handoff.py" kill   <job-id>

kill stops the run and everything it spawned. Use it if the user changes their mind, or if a job is stuck - a job left running keeps spending the user's subscription. status reports died for a job that vanished without finishing.

Other options

  • --model <name> - override the model. Without it Claude Code uses the user's configured default, which is usually what they want.
  • --yolo - run with bypassPermissions instead of the default auto mode. Only when the user asks for it or an ordinary run was blocked by permissions.
  • --dir <path> - run somewhere other than the current directory.
  • --no-auth-check - by default the wrapper strips ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN from the environment so the run bills the user's subscription rather than their API key. Pass this flag only if the user explicitly wants API-key or gateway billing.
  • -- <args> - anything after -- (and before the prompt) goes straight to claude.

When something fails

The wrapper prints [handoff] ERROR: … for failures that are not worth retrying - an expired login, an exhausted usage limit, a billing block. Report those to the user instead of retrying; they need a human to fix them. Other failures surface Claude's own stderr and exit status.

See reference.md in this directory for the full flag table, the permission model, and troubleshooting.

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.