When you need to switch context (start a new conversation / are about to /compact / continue on another machine / pick it up again the next day), this skill scans the current state and conversation context and produces aself-contained handoff prompt—pasting it into any new context allows seamless handoff, with no need to verbally explain the background again.
Example trigger phrases: "Give me the prompt needed for a new context in full" "I'm about to compact, give me a prompt that can be used after compacting" "Help me organize a handoff" "I'm switching machines to continue, give me a prompt for handoff".
Differences from other skills:
- Session snapshot tools (such as ECC's save-session, which saves an entire JSON and requires a paired load) are bound to a specific environment; this skill only outputsplain-text prompt, which is environment-agnostic
- Compact-timing tools (such as ECC's strategic-compact) solvewhento compact; this skill solves how to hand off compact afterafterward
/updatedepositlong-term knowledge base; this skill is ashort-term handoff bridge
Step 1: Detect current state (fact layer)
Collect a snapshot of the current environment in parallel (to avoid the handoff recipient misjudging):
git rev-parse --abbrev-ref HEAD # 當前 branch
git status --short # 未 commit 變更
git log --oneline -10 # 近期 commit
git stash list # stash 狀態
pwd # 工作目錄
Additional scans (executed conditionally based on the current situation):
- Whether in a worktree: check whether
.gitis a file or a directory - Whether there is an in-progress plan:
ls plans/active/*.md 2>/dev/null - Whether there is a background process: any in this conversation that has not yet ended
Bash run_in_background
Paths, branches, commit hashes, and filenames must all be recorded as absolute values—the handoff recipient has no memory of the current conversation, and vague references ("that file," "the branch from earlier") will be completely useless. Judge item by item whether the detected environment items (stashes, in-progress plans, other untracked files) are relevant to this task; irrelevant items must be explicitly marked in the Step 3 environment snapshot as "not relevant to this task," otherwise the handoff recipient may misjudge them as task leftovers (for example, trying to pop an irrelevant stash) and pollute the working directory.
Step 2: Conversation context extraction
Review this conversation and organize the following seven sections item by item, as the basis for the completeness verification in Step 5:
- Task goal — What requirement did the user initially raise?
- Current progress — Which steps have been completed? Which commands have already been run?
- Decision context — Why choose X instead of Y? Which options have been abandoned?
- Environment snapshot — branch / worktree / modified files / in-progress plan
- Important context — implicit information that will not be reflected in git diff (external discussions, performance data, ticket numbers, community consensus/opposing opinions)
- To-do items — things not yet done, arranged by priority
- Immediately executable next step — What should the handoff recipient's first prompt be? (Must be specific down to the file path and action)
Extraction principles:
- Only recordwhat was truly discussed/doneinterpretation, speculation or filling in blanks is prohibited
- If a section is not applicable, clearly mark
N/Aand provide a reason (e.g., "N/A — no abandoned options in this instance") - When quoting the user's original wording, preserve the original text and do not rewrite it arbitrarily
Step 3: Produce the Handoff Prompt
Output according to the following template; all sections must correspond to the seven items in Step 2:
# Handoff Prompt(產出時間:{{YYYY-MM-DD HH:MM}})
> **給接手 Claude:** 先讀完整個 prompt,再從「立即可執行的下一步」開始。
> 動手前先 `git status` 與 `git rev-parse --abbrev-ref HEAD` 確認與下方環境快照一致。
## 1. 任務目標
{{使用者原始需求,盡量保留原句}}
## 2. 當前進度
- **已完成:**
1. ...
2. ...
- **進行中:** ...
- **被擋住的事項:** {{若無則 N/A}}
## 3. 決策脈絡
- **採用:** 選 X 不選 Y,因為 ...(含依據:RFC/業界實踐/效能數據/社群共識)
- **已放棄:** 試過 A,因 B 放棄
- **反面意見/已知陷阱:** ...
## 4. 環境快照
- 工作目錄:`{{absolute path}}`
- Branch:`{{branch}}`
- Worktree:{{是 — 主 repo 在 X / 否}}
- 未 commit 變更(**本任務相關**):
```
{{僅列出本次工作產生的變更}}
```
- 未 commit 變更(**不相關**):{{若有與其他任務交雜的變更,列在此處避免接手者誤動,或 N/A}}
- 進行中 plan:`{{plans/active/<slug>.md}}` 或 N/A
- 進行中 plan(不相關):{{列出與本任務無關的 active plans 提醒接手者忽略,或 N/A}}
- Stash:{{若與本任務相關列出,否則明確標註「不相關 — stash@{0}: ...」或 N/A}}
- Background process:{{列出未結束的,或 N/A}}
## 5. 重要 context(不會反映在 diff)
- Ticket:{{TICKET-XXXX / Notion URL / N/A}}
- 外部依據:{{引用過的 RFC/文件/社群討論連結}}
- 隱含知識:{{調查數據、效能比較、業界慣例}}
## 6. 待辦項目(依優先順序)
1. ...
2. ...
## 7. 立即可執行的下一步
> **直接複製以下作為第一個 prompt:**
```
{{1–2 句具體指令,含完整檔案路徑與要做的動作。
範例:「打開 /abs/path/to/file.ts 第 42 行,把 X 改成 Y,然後跑 npm test」}}
```
Step 4: Output method (HITL)
Use AskUserQuestion to confirm the output method:
- Display directly — print in the conversation for you to copy
- Write to file — save to
.claude/handoff/handoff-{{YYYY-MM-DD-HHMM}}.md - Both — display + save to file (recommended: use this option before compact; if the prompt is not retained after compact, the file can still save it)
If option 2 or 3 is selected, automatically create the directory:mkdir -p .claude/handoff
Step 5: Completeness verification
After output, compare item by item against the seven sections in Step 2, and mark each one as ✅ (covered) / ⚠️ (missing, with an explanation of the suggested direction for supplementation) / N/A.
Completeness rate = (✅ + N/A) / 7:
- 100%: deliver directly
- < 100%: warn the user which sections are missing
- < 70%:Block output — the conversation information is insufficient; ask the user to supplement it and rerun