From context-handoff
Use when an auto-compaction system reminder appears, when the user explicitly invokes /handoff or asks to "write a handoff" / "save state", or when the user signals they're near the context limit specifically ("running low on context", "almost out of context", "context is getting full"). Do NOT fire on general session-ending phrases like "wrap up" or "let's stop for today" unless they're tied to context exhaustion.
How this skill is triggered — by the user, by Claude, or both
Slash command
/context-handoff:writing-handoffThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Save the current session's state to a Markdown file so a future session (or another person) can pick up cleanly. This skill is intentionally conservative about triggering: it fires on explicit invocation or real context-pressure signals, never on generic "let's wrap up" phrasing.
Save the current session's state to a Markdown file so a future session (or another person) can pick up cleanly. This skill is intentionally conservative about triggering: it fires on explicit invocation or real context-pressure signals, never on generic "let's wrap up" phrasing.
Fire this skill when ANY of:
/handoff (with or without a label argument).Do NOT fire on:
If unsure, ASK the user before writing — a one-line confirmation is cheaper than a wrong handoff.
Resolve the output directory:
HANDOFF_DIR is set, use it../.handoffs/ relative to the current working directory.mkdir -p <dir>.Collect context (run these in parallel where possible):
basename "$(pwd)"date -u +"%Y-%m-%dT%H:%M:%SZ"date +"%Y-%m-%d-%H%M".git exists in cwd or any parent:
git rev-parse --abbrev-ref HEADgit status --shortgit log -5 --onelinen/a.Build the filename:
<filename-timestamp>.md (e.g., 2026-05-12-1430.md)/handoff <label> or the user's phrasing), slugify it and append. Use this exact one-liner to get deterministic results across sessions:
SLUG=$(printf '%s' "$LABEL" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g; s/-\{2,\}/-/g; s/^-//; s/-$//' | cut -c1-40)
This produces ASCII lowercase, hyphens for any non-alphanumeric (including Unicode), collapsed dashes, no leading/trailing dashes, max 40 characters. If the result is empty (e.g. label was --!--), drop the label and use only the timestamp filename. Example: label Before refactor — auth! → before-refactor-auth → filename 2026-05-12-1430-before-refactor-auth.md.Write the file using the template below, populated from the actual conversation so far. Be specific — the next reader has no access to this conversation.
Confirm to the user using exactly this two-line format:
✓ Wrote <absolute-path-to-handoff-file>
Captured: <N files changed>, <N commits>, <N next steps>
The summary line should count concrete items from the handoff body. If a category has zero items, write 0 files changed, 0 commits, etc. — don't omit.
# Handoff — <project> — <ISO timestamp>
**Working directory:** <cwd>
**Git branch:** <branch or "n/a">
**Session label:** <label or "—">
## Current task
The "you are here" pointer — what we were doing and where we stopped.
## Completed this session
- Decisions made
- Files changed (with paths)
- Commits (hashes + subjects)
## In progress
- Uncommitted changes (file paths + brief description)
- Half-written code, partial implementations
## Next steps
Immediate TODOs, in priority order.
## Blockers / open questions
Things waiting on user input or external decisions.
## Key context
- Relevant file paths and what's in them
- Important function/symbol names
- Conventions or patterns learned this session
- Surprises or gotchas worth remembering
| Thought | Reality |
|---|---|
| "User said 'let's wrap up' so I'll write a handoff" | Generic session-ending ≠ context exhaustion. Ask first. |
| "I'll fill in the template with example values" | Examples are not state. Use real conversation content. |
| "I don't have git info, I'll skip the git section" | Mark it n/a, don't silently drop it. |
| "I'll write to /tmp" | No. Use HANDOFF_DIR or ./.handoffs/. |
| "I'll skip the filename label" | If the user gave one, include it. Slugify, don't drop. |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub se4thvin/context-handoff --plugin context-handoff