agentleFS
kwana117kwana117/claude-skills/handoff/SKILL.md

handoff

Skill0 starsChanged 5 months agoMITView on GitHub

Generates a handoff.md file at the project root — a session transition document that replaces /compact when the session has accumulated bad assumptions, failed attempts, or messy debugging. Fills 6 fixed sections (Goal, Current State, Files in Flight, Changed, Failed Attempts, Next Step) from the current conversation context. Use this skill whenever the user types /handoff, "write handoff", "create handoff", "pass this to a fresh session", "handoff before leaving", or wants to hand off the current Claude Code session to a fresh agent without dragging context forward.

191 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use decision-mapping, setup-ts-deep-modules 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.
  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 8 projects that use this

  • liufeng1976Skill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 42 projects that use this

  • AWSSkill

    to-questionnaire

    Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

    Also in 93 projects that use this

  • GoogleSkill

    ask-matt

    Ask which skill or flow fits your situation. A router over the skills in this repo.

    Also in 87 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 51 projects that use this

  • LesaniSkill

    writing-beats

    Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.

    Also in 54 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 172 edited versions we read keep these.

  • 6

    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. Very specific:

    If the result is ~/ or /, stop and ask the user which project this is — do not write handoff to system directories

    line 28
  2. Distinctive:

    Don't stop — replacing is the expected behavior (one handoff per project, always the most recent).

    line 41
  3. Distinctive:

    If the session had no failures, write literally:

    line 64
  4. Distinctive:

    If not obvious, ask directly: "What's the reason for the handoff?

    line 81
  5. Very specific:

    Use Write to $PROJECT_ROOT/handoff.md with this exact format:

    line 85
  6. Distinctive:

    Do not auto-commit — the user decides whether to version it.

    line 132
  7. Very specific:

    Canonical path: always <project_root>/handoff.md, never nested in .claude/, docs/, etc.

    line 136
  8. Distinctive:

    Next Step must be atomic: if your answer has "and then" or multiple bullets, it's not atomic yet — pick the first one.

    line 139
  9. Very specific:

    If pwd is ~/, ~/Downloads, or a folder with no project indicators (no .git, no package.json/pyproject.toml/Cargo.toml/etc.), ask: "I can't …

    line 146
  10. Distinctive:

    If the current conversation has fewer than 5 significant turns, warn: "This session is too short for a useful handoff.

    line 149

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

Handoff — Claude Code Session Transition

Replaces /compact when the current session has accumulated cruft (bad assumptions, failed attempts, debugging loops). Instead of compacting and propagating the shape of the problem, writes handoff.md at the project root. In the next session (after /clear or a new claude), the first prompt is "read handoff.md and continue from the Next Step" — fresh agent, highest-performing tokens.

Pattern derived from the Maven reel "Handoff your Claude Code session" (2026-05).

When to run

  • User typed /handoff or a variation (see description)
  • The current session has in-progress work (not finished) that needs to continue in another session
  • Critical distinction vs session-end commands:
    • Session-end skills = close the day, log completed session
    • /handoff = pass in-progress work to the next session (does not log anywhere, only writes the file)
    • Both can be combined: handoff first, then session-end.

Steps

1. Detect the current project

Determine the project root:

  1. git rev-parse --show-toplevel 2>/dev/null — if cwd is inside a git repo, that's the root
  2. Otherwise, use the current cwd (pwd)
  3. If the result is ~/ or /, stop and ask the user which project this is — do not write handoff to system directories

Save as $PROJECT_ROOT.

2. Check for existing handoff

test -f "$PROJECT_ROOT/handoff.md" && echo EXISTS

If it exists:

  • Read the file
  • Warn the user: "There's already a handoff.md for this project (session from YYYY-MM-DD HH:MM). I'll replace it."
  • Don't stop — replacing is the expected behavior (one handoff per project, always the most recent).

3. Extract context from the current conversation

Re-read the session conversation and mentally fill the 6 sections before writing:

  1. Goal — What was the declared or inferred objective of this session? 1–3 sentences. If the session started with a clear user request, paraphrase it. Include the "why" if relevant.
  2. Current State — What's done now vs at the start of the session. Be specific. Point to files + state. Not "I'm in the middle of X" — say "X implemented and passing; Y is missing".
  3. Files in Flight — Each file touched in this session (Edit/Write), with a short status:
    - path/to/file.ts — function X rewritten, not yet tested
    - tests/foo.test.ts — 2 new tests, 1 failing
    Exclude files only read for context. Exclude handoff.md itself.
  4. Changed — High-level summary of what changed (1 sentence per area touched). Don't duplicate Files in Flight — this is narrative, that's inventory.
  5. Failed Attempts — The most important section. Every attempt that failed this session. Format:
    - Tried <X> → failed because <concrete reason with evidence>
    If the session had no failures, write literally:
    - Nothing failed this session (record this anyway so the next agent knows).
    Never leave blank.
  6. Next Step — ONE atomic, imperative, specific action. If there are multiple next steps, pick the most immediate. The others will come in the next handoff.

4. Determine handoff_reason

Infer from the conversation context. Pick one:

  • step-away — user will be away for a few hours
  • stuck-in-loop — session keeps trying the same thing without success (long Failed Attempts)
  • context-full — long session, context window nearly full
  • end-of-day — end of normal day but with work in progress
  • task-switch — switching to another project/feature

If not obvious, ask directly: "What's the reason for the handoff? (step-away / stuck-in-loop / context-full / end-of-day / task-switch)"

5. Write handoff.md

Use Write to $PROJECT_ROOT/handoff.md with this exact format:

---
project: <project name inferred from folder or project config>
session_started: <YYYY-MM-DD HH:MM> # estimate from the first turn of this session; omit if uncertain
session_ended: <YYYY-MM-DD HH:MM>   # current time (date +"%Y-%m-%d %H:%M")
handoff_reason: <reason from Step 4>
---

# Handoff — <short 1-line title summarizing the session>

## 1. Goal
<1–3 sentences>

## 2. Current State
<specific, with paths>

## 3. Files in Flight
- `<path>` — <short status>
- `<path>` — <short status>

## 4. Changed
<1 sentence per area touched>

## 5. Failed Attempts
- <attempt> → failed because <reason>
<or "Nothing failed this session.">

## 6. Next Step
<ONE imperative sentence>

6. Confirm to the user

Short response:

✓ handoff.md written to <$PROJECT_ROOT/handoff.md>
Reason: <handoff_reason>
Next Step: <the Next Step sentence>

Next session:
  /clear
  Read handoff.md and continue from the Next Step.

Do not auto-commit — the user decides whether to version it.

Rules

  • Canonical path: always <project_root>/handoff.md, never nested in .claude/, docs/, etc.
  • Replacing is OK: one project = one handoff. If it already exists, replace it.
  • Failed Attempts never empty: even "nothing failed" is useful information for the next agent.
  • Next Step must be atomic: if your answer has "and then" or multiple bullets, it's not atomic yet — pick the first one.
  • No chat-style prose: bullets and telegraphic style. The next agent wants facts, not narrative.
  • Do NOT auto-commit: the user decides. They may explicitly ask to commit — only then do it.

Edge Cases

cwd is not a code project

If pwd is ~/, ~/Downloads, or a folder with no project indicators (no .git, no package.json/pyproject.toml/Cargo.toml/etc.), ask: "I can't detect a project in this directory. What's the project root?" — don't create handoff in generic directories.

Session just started

If the current conversation has fewer than 5 significant turns, warn: "This session is too short for a useful handoff. Are you sure? (Handoff makes more sense after 1h+ of work)" — wait for confirmation.

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.