关于 handoff
handoff 是用于记录会话状态、供后续运行继续工作的 Agent 技能。它整理目标、进度、决策、文件和已探索的无效路径,并将交接文档写入 `.llmtmp/handoff.md`。
主要功能
- 01总结目标和已完成工作
- 02记录待办事项与阻塞
- 03整理决策、文件和错误
- 04记录已探索的无效路径
- 05写入 `.llmtmp/handoff.md`
适用场景
- 01在后续 Agent 运行中继续工作
- 02向另一会话传递任务背景
- 03结束会话前记录后续步骤
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ jimweller/ clanker-skills --skill handoff安装后在 Claude Code 中输入/handoff确认已加载。
详细介绍
STARTER_CHARACTER = 🪃
交接:捕获会话状态以便继续
捕获会话状态,以便后续运行能够继续。
流程
1. 分析当前会话
回顾本次对话中的所有内容:
- 最初的目标或任务是什么?
- 目前已完成哪些工作?
- 还有哪些工作正在进行或受阻?
- 做出了哪些关键决策?为什么?
- 读取、创建或修改了哪些文件?
- 遇到了哪些错误?如何解决?
- 尝试过哪些行不通的方向(避免后续运行重复尝试)?
2. 收集当前状态
git status
git diff --stat HEAD
git log --oneline -5
git branch --show-current
```text
### 3. Write the Handoff Document
Save to: `.llmtmp/handoff.md` in the current working directory (or the worktree root if in a worktree).
**Use this exact structure:**
```markdown
# Handoff: [Brief Task Description]
**Date:** [current date]
**Branch:** [current branch name]
**Last Commit:** [hash + message, or "uncommitted changes"]
## Goal
[1-2 sentences: what we're trying to accomplish. Include the original user request or plan reference.]
## Completed
- [x] [Task 1 — brief description of what was done]
- [x] [Task 2 — brief description]
- [Sub-detail if non-obvious]
## In Progress / Next Steps
- [ ] [Task 3 — what needs to happen next, with enough detail to act on]
- [ ] [Task 4 — include file paths and specific areas to focus on]
- [ ] [Task 5 — any blocked items with explanation of the blocker]
## Key Decisions
Document WHY choices were made, not just what was chosen:
- **[Decision]**: [What was chosen] — [Why, including alternatives rejected]
- **[Decision]**: [What was chosen] — [Why]
## Dead Ends (Don't Repeat These)
- [Approach that was tried and didn't work] — [Why it failed]
- [Investigation path that turned out to be irrelevant] — [What we found instead]
## Files Changed
- `path/to/file.ts` — [what changed and why, 1 line]
- `path/to/new-file.ts` — [NEW: what this file does]
- `path/to/deleted-file.ts` — [DELETED: why it was removed]
## Current State
- **Tests:** [passing/failing — which specific tests and why]
- **Type-check:** [clean/N errors — what kind]
- **Lint:** [clean/N warnings — what kind]
- **Build:** [working/broken]
- **Manual verification:** [what was tested manually, results]
## Handoff Context
[2-4 sentences: the MOST IMPORTANT thing the next agent needs to know. What's the current situation? What's the biggest risk? What should they do first?]
**Recommended first action:** [Exact command or step to take first]
```text
### 4. Confirm and Advise
After writing the handoff:
1. Confirm the file was written with its full path
2. Suggest this resume command:
```text
Read .llmtmp/handoff.md and continue from where the previous session left off.
-
如果存在未提交的更改,建议先提交:
/commit
质量标准
优秀的交接文档应当:
- 让新的 Agent 无需询问任何澄清问题即可继续工作
- 少于 100 行(简洁而非面面俱到;引用文件,而不是重复其中的内容)
- 提供充分的“为什么”背景信息,以便下一个 Agent 做出相同的决策
- 明确列出行不通的方向,避免浪费时间
- 给出具体的“第一步”建议
反模式
- 不要包含完整的文件内容——请引用文件路径
- 不要包含对话历史或调试记录——请总结结论
- 不要含糊其辞(“修复这个 Bug”)——请具体说明(“在
packages/web/src/hooks/useSSE.ts中修复 SSE 重连,在onclose处理程序后添加指数退避”) - 不要省略“行不通的方向”部分——这有助于避免最常见的无效尝试
- 不要忘记“关键决策”部分——否则,下一个 Agent 可能会推翻你的决策
评论
支持 Markdown