Skip to content

Instantly share code, notes, and snippets.

@dvirsegal
Created May 8, 2026 16:49
Show Gist options
  • Select an option

  • Save dvirsegal/2d9801fd19447267ecc1cc8b726cbb28 to your computer and use it in GitHub Desktop.

Select an option

Save dvirsegal/2d9801fd19447267ecc1cc8b726cbb28 to your computer and use it in GitHub Desktop.
Claude Code /handoff skill — compact conversation into a structured handoff document for a fresh agent

Compact the current conversation into a structured handoff document for a fresh agent to continue without needing the full conversation history.

Your job

  1. Scan before writing — run these in parallel before drafting anything:

    • Check git status and branch: git status --short && git branch --show-current
    • Check any open todos from the conversation (TodoRead if available, or summarize from context)
    • Note the working directory
  2. Write the handoff document — save to a temp file:

    • Windows: $f = "$env:TEMP\handoff-$(Get-Date -Format 'yyyyMMdd-HHmmss').md"
    • Unix/macOS: f=$(mktemp /tmp/handoff-XXXXXX.md)
    • Read the (empty) file before writing to satisfy tool requirements
  3. Output the file path at the end so the user can share it with the next session.


Document structure

Use exactly these sections, in order:

# Handoff: <one-line summary of what was being worked on>

**Date:** YYYY-MM-DD  
**Working dir:** <path>  
**Git:** <branch> — <clean|N uncommitted changes>

## Accomplished
- <bullet per completed item>

## Current State
<2–4 sentences: what works now, what is broken, where the code sits>

## Open Tasks
<copy any open TodoWrite items; if none, list the next logical steps>

## Key Decisions
| Decision | Rationale |
|----------|-----------|
| <what was chosen> | <why — the constraint or tradeoff> |

## Dead Ends
- **<approach tried>** — abandoned because <reason>. Don't retry.

## Blockers / Open Questions
- <anything unresolved that the next session needs to decide or investigate>

## Artifacts
- `<path or URL>` — <one-line description>

## Suggested Skills
<list any /skill-name commands the next session should use, with a reason>

## First Action
<single most important next step — one sentence, imperative, actionable>

Rules

  • Do not duplicate content already in artifacts (diffs, plans, PRDs, commits). Reference by path or URL only.
  • Dead Ends section is mandatory if any approach was explored and abandoned — this saves the next agent from repeating work.
  • First Action must be specific: not "continue the work" — say exactly what file to open, what command to run, or what decision to make.
  • Keep the whole document under ~400 lines. Dense > verbose.
  • If the user passed $ARGUMENTS, treat them as the focus of the next session. Tailor Open Tasks, First Action, and Suggested Skills toward that focus.

$ARGUMENTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment