home / skills / petekp / claude-code-setup / session-handoff

session-handoff skill

/skills/session-handoff

This skill generates a clipboard-ready bootstrap prompt to seamlessly continue a conversation in a new session, preserving essential context while minimizing

npx playbooks add skill petekp/claude-code-setup --skill session-handoff

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
3.7 KB
---
name: session-handoff
description: >
  Generate a smart bootstrap prompt to continue the current conversation in a fresh session.
  Use when (1) approaching context limits, (2) user says "handoff", "bootstrap", "continue later",
  "save session", or similar, (3) before closing a session with unfinished work, (4) user wants
  to resume in a different environment. Outputs a clipboard-ready prompt capturing essential
  context while minimizing tokens.
---

# Session Handoff

Generate a bootstrap prompt that enables seamless conversation continuity in a new session.

## Process

### 1. Analyze Current Session

Identify and categorize:

- **Goal state**: What is the user trying to accomplish? What's the end state?
- **Current progress**: What's been done? What's working?
- **Blockers/open questions**: What's unresolved? What decisions are pending?
- **Key artifacts**: Files modified, commands run, errors encountered
- **Critical context**: Domain knowledge, constraints, or preferences established

### 2. Apply Token Efficiency Heuristics

**Include:**
- Specific file paths, function names, error messages (hard to rediscover)
- Decisions made and their rationale (prevents re-discussion)
- Current hypothesis or approach being tested
- Exact reproduction steps for bugs

**Exclude:**
- General knowledge Claude already has
- Verbose explanations of standard concepts
- Full file contents (use paths + line numbers instead)
- Conversation pleasantries or meta-discussion

**Compress:**
- Use bullet points over prose
- Reference files by path, not content
- Summarize long error traces to key lines
- Use "established: X" for agreed-upon decisions

### 3. Structure the Bootstrap Prompt

```markdown
## Context
[1-2 sentence goal statement]

## Progress
- [Completed item with outcome]
- [Completed item with outcome]

## Current State
[What's happening right now - the exact point to resume from]

## Key Files
- `path/to/file.ext` - [role/status]

## Open Items
- [ ] [Next immediate action]
- [ ] [Subsequent action]

## Constraints/Decisions
- [Established constraint or decision]
```

### 4. Output

**Always do both:**

1. **Display the full prompt** in a fenced code block so the user can see and manually copy it
2. **Copy to clipboard** using `pbcopy`:

```bash
echo "PROMPT_CONTENT" | pbcopy  # macOS
```

Confirm with: "Bootstrap prompt copied to clipboard (and displayed above in case you need it later)."

## Adaptive Sizing

**Simple tasks** (bug fix, small feature): 100-200 tokens
- Goal, current file, error/behavior, next step

**Medium tasks** (feature implementation, refactor): 200-400 tokens
- Goal, progress list, current state, key files, next steps

**Complex tasks** (architecture, multi-system): 400-800 tokens
- Full structure above, plus constraints and decision rationale

## Example Output

```markdown
## Context
Adding OAuth login to the Express app, Google provider first.

## Progress
- Installed passport, passport-google-oauth20
- Created `src/auth/google.ts` with strategy config
- Added `/auth/google` and `/auth/google/callback` routes

## Current State
Callback route returns "Failed to serialize user into session" - need to implement serializeUser/deserializeUser in passport config.

## Key Files
- `src/auth/google.ts` - strategy setup (working)
- `src/routes/auth.ts:45` - callback handler (error here)
- `src/app.ts` - passport.initialize() added, missing session serialize

## Open Items
- [ ] Add serialize/deserialize to passport config
- [ ] Test full OAuth flow
- [ ] Add session persistence (currently memory store)

## Constraints
- Using express-session with default memory store for now
- Google OAuth credentials in .env (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)
```

Overview

This skill generates a compact, clipboard-ready bootstrap prompt to continue the current conversation in a fresh session. It captures goal, progress, critical files, blockers, and next steps while minimizing tokens. Use it when approaching context limits or when a handoff to another environment or agent is needed.

How this skill works

The skill analyzes the live session to extract goal state, completed work, current blocking issues, key artifacts (file paths, errors, commands) and established decisions. It then applies token-efficiency heuristics to include only hard-to-recover details, compress verbose traces, and format the result into a structured bootstrap prompt. It outputs the prompt for immediate copy and provides a shell snippet to place the content on the macOS clipboard.

When to use it

  • Approaching model context limits and you need a concise resume point
  • User says “handoff”, “bootstrap”, “continue later”, or “save session”
  • Before closing a session with unfinished work to preserve momentum
  • When moving the work to a different environment or agent
  • To hand off a debugging or implementation task to a teammate or another chat model

Best practices

  • State the single goal in 1–2 sentences at the top
  • List explicit progress items with outcomes, not long explanations
  • Reference files by path and line ranges instead of pasting full contents
  • Highlight exact error messages or reproduction steps that are hard to rediscover
  • Keep open items concrete and actionable (next immediate action first)
  • Choose prompt size by task complexity: 100–200 tokens (simple) to 400–800 tokens (complex)

Example use cases

  • Saving a mid-debug session with a failing test and stack snippet for later resumption
  • Handing off feature work to another developer or a different chat model with file paths and decisions
  • Switching from an interactive chat to an IDE-based workflow and resuming progress there
  • Preparing a concise summary before closing a session so you can pick up exactly where you left off tomorrow
  • Resuming work in a restricted-context agent by providing a minimal, high-value bootstrap prompt

FAQ

How long should the bootstrap prompt be?

Match length to task complexity: 100–200 tokens for small fixes, 200–400 for medium tasks, 400–800 for complex multi-system work.

What should I avoid including?

Exclude general background, long tutorials, full file contents, and pleasantries. Focus on unique, hard-to-recreate details like file paths, exact errors, and decisions.