handoff
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSession Handoff Skill
Session Handoff 技能
Create structured documents that enable seamless continuity across Claude
sessions.
创建结构化文档,实现Claude会话间的无缝衔接。
When to Use
使用场景
- Ending a work session for the day
- Before taking a break mid-task
- Switching to a different project temporarily
- When you want to capture state for a future session
- Before a context reset you know is coming
- 结束当日工作会话时
- 任务中途休息前
- 临时切换到其他项目时
- 需要为后续会话记录当前状态时
- 已知即将发生上下文重置前
Handoff Process
交接流程
Step 1: Assess Session State
步骤1:评估会话状态
Quickly assess:
- What phase are we in? (exploration, planning, implementation, debugging, review)
- What's the active task? (what we're trying to accomplish)
- How far along are we? (just started, mid-way, almost done)
快速评估以下内容:
- 当前处于哪个阶段?(探索、规划、实施、调试、评审)
- 当前活跃任务是什么?(我们要完成的目标)
- 任务进度如何?(刚启动、进行中、接近完成)
Step 2: Ask What Matters
步骤2:询问关键信息
Ask the user:
"I'll create a handoff document. Is there anything specific you want to make sure I capture? (Key decisions, code snippets, context about the problem, things you'll forget, etc.)"
向用户询问:
"我将创建一份交接文档。您是否有需要特别记录的内容?(如关键决策、代码片段、问题背景、容易遗忘的信息等)"
Step 3: Generate Handoff Document
步骤3:生成交接文档
Create a structured document:
markdown
undefined创建结构化文档:
markdown
undefinedSession Handoff: [Brief Description]
Session Handoff: [Brief Description]
Date: [YYYY-MM-DD] Project: [project name/path] Session Duration:
[approximate]
Date: [YYYY-MM-DD] Project: [project name/path] Session Duration:
[approximate]
Current State
当前状态
Task: [What we're working on] Phase:
[exploration/planning/implementation/debugging/review] Progress: [where we
are - percentage or milestone]
Task: [正在处理的任务] Phase:
[exploration/planning/implementation/debugging/review] Progress: [当前进度 - 百分比或里程碑]
What We Did
已完成工作
[2-3 sentence summary of the session's work]
[2-3句话总结本次会话的工作内容]
Decisions Made
已做出的决策
- [Decision] — [Rationale]
- [Decision] — [Rationale]
- [决策内容] — [决策依据]
- [决策内容] — [决策依据]
Code Changes
代码变更
Files modified:
- — [what and why]
path/to/file.ts - — [what and why]
path/to/other.ts
Key code context: [Critical snippets or patterns to remember]
修改的文件:
- — [变更内容及意图]
path/to/file.ts - — [变更内容及意图]
path/to/other.ts
关键代码上下文: [需要记住的重要代码片段或模式]
Open Questions
未解决问题
- [Question needing resolution]
- [Question needing resolution]
- [需要解决的问题]
- [需要解决的问题]
Blockers / Issues
阻塞点 / 问题
- [Issue] — [current status]
- [问题内容] — [当前状态]
Context to Remember
需要记住的上下文
[Important background, constraints, user preferences, domain knowledge - things
that would take time to re-establish]
[重要背景、约束条件、用户偏好、领域知识 - 这些信息重新建立需要花费时间]
Next Steps
后续步骤
- [First thing to do next session]
- [Second thing]
- [Third thing]
- [下次会话首先要做的事]
- [第二件事]
- [第三件事]
Files to Review on Resume
恢复工作时需要查看的文件
- — [why it matters]
path/to/key/file.ts
undefined- — [重要性说明]
path/to/key/file.ts
undefinedStep 4: Write the File
步骤4:保存文档
Write to:
.claude/handoffs/[YYYY-MM-DD]-[brief-description].mdConfirm location with user:
"I'll save this to. Want a different location?".claude/handoffs/[filename].md
保存路径:
.claude/handoffs/[YYYY-MM-DD]-[brief-description].md与用户确认保存位置:
"我将把文档保存到。是否需要更换保存位置?".claude/handoffs/[filename].md
What to Capture
需要记录的内容
Always Include
必须包含的内容
- Decisions with reasoning — The "why" is often more valuable than the "what"
- Code changes — File paths, what changed, the intent
- Current progress — Where in the task we stopped
- Next steps — Clear, actionable items to resume with
- User context — Constraints, preferences, domain knowledge they shared
- 带决策依据的结论 — 决策的“原因”往往比“内容”更重要
- 代码变更 — 文件路径、变更内容及意图
- 当前进度 — 任务中断时的节点
- 后续步骤 — 清晰、可执行的恢复任务项
- 用户上下文 — 用户分享的约束条件、偏好和领域知识
Include When Relevant
相关时需包含的内容
- Errors encountered — And how they were (or weren't) resolved
- Dead ends — Approaches tried that didn't work (saves re-exploration)
- Key files — Files to read to get back up to speed
- External dependencies — APIs, services, tools involved
- 遇到的错误 — 以及解决(或未解决)的方式
- 失败尝试 — 试过但无效的方法(避免重复探索)
- 关键文件 — 重新上手时需要阅读的文件
- 外部依赖 — 涉及的API、服务和工具
Skip
无需记录的内容
- Verbose tool output (file listings, grep results)
- Intermediate reasoning that reached conclusions
- Repeated similar operations
- Information that's obvious from the code
- 冗长的工具输出(文件列表、grep结果)
- 已得出结论的中间推理过程
- 重复的相似操作
- 从代码中可直接获取的明显信息
Format Guidelines
格式规范
- Bullet points — Scannable over narrative
- File paths — not "that function"
src/foo.ts:42 - Checkboxes for actions — for next steps and open questions
- [ ] - Specifics — "Added retry logic to fetchUser()" not "made improvements"
- 项目符号 — 比叙述性文本更易快速浏览
- 文件路径 — 使用而非“那个函数”
src/foo.ts:42 - 操作项使用复选框 — 后续步骤和未解决问题使用
- [ ] - 具体描述 — 写“为fetchUser()添加重试逻辑”而非“进行了优化”
Quality Check
质量检查
Before saving, verify:
- Could a fresh Claude pick up from this? — Enough context to continue?
- Are decisions traceable? — Clear why things were decided?
- Are next steps actionable? — Know exactly what to do first?
- Is code work clear? — Know which files matter?
保存前需验证:
- 新的Claude能否基于此继续工作? — 上下文信息是否足够?
- 决策是否可追溯? — 决策原因是否清晰?
- 后续步骤是否可执行? — 是否明确知道首先要做什么?
- 代码工作是否清晰? — 是否明确哪些文件重要?
Using a Handoff Document
如何使用交接文档
When starting a new session, the user can:
- Share the handoff file at session start
- Say "Resume from this handoff: [paste or path]"
- Reference it with @ mention if supported
The handoff should let you hit the ground running without lengthy
re-explanation.
启动新会话时,用户可以:
- 在会话开始时分享交接文档
- 说明“从此交接文档恢复:[粘贴内容或路径]”
- 如果支持,使用@提及该文档
交接文档应让你无需冗长的重新说明即可快速上手。
Example Handoff
交接示例
markdown
undefinedmarkdown
undefinedSession Handoff: Auth System Implementation
Session Handoff: 认证系统实现
Date: 2025-01-15 Project: /Users/robert/projects/my-api Session
Duration: ~2 hours
Date: 2025-01-15 Project: /Users/robert/projects/my-api Session
Duration: ~2小时
Current State
当前状态
Task: Implementing user authentication for the API Phase: Implementation
Progress: ~60% - basic flow works, need refresh tokens
Task: 为API实现用户认证 Phase: 实施阶段 Progress: ~60% - 基础流程可用,需实现刷新令牌
What We Did
已完成工作
Built the core JWT authentication flow including token generation, validation
middleware, and login/logout endpoints. Hit an issue with key rotation that we
resolved by moving to config-based key paths.
构建了核心JWT认证流程,包括令牌生成、验证中间件以及登录/登出端点。遇到了密钥轮换问题,通过将密钥路径移至配置文件解决。
Decisions Made
已做出的决策
- JWT with RS256 — Stateless auth, works with distributed setup
- Redis for refresh tokens — Need revocation capability
- 15-min access token expiry — Balance security/UX for mobile app
- 使用RS256算法的JWT — 无状态认证,适用于分布式架构
- Redis存储刷新令牌 — 需要支持令牌吊销功能
- 15分钟访问令牌过期时间 — 为移动应用平衡安全性与用户体验
Code Changes
代码变更
Files modified:
- — Token generation and validation logic
src/auth/jwt.ts - — Request authentication middleware
src/middleware/auth.ts - — Login/logout endpoints
src/routes/auth.ts - — RSA key pair storage
config/keys/
Key code context: Token validation uses RS256. Keys loaded from
based on NODE_ENV.
config/keys/修改的文件:
- — 令牌生成与验证逻辑
src/auth/jwt.ts - — 请求认证中间件
src/middleware/auth.ts - — 登录/登出端点
src/routes/auth.ts - — RSA密钥对存储目录
config/keys/
关键代码上下文: 令牌验证使用RS256算法。根据NODE_ENV从加载密钥。
config/keys/Open Questions
未解决问题
- Automatic vs opt-in refresh token rotation?
- Rate limit for login attempts? (User mentioned 10k DAU)
- 自动刷新令牌还是手动选择?
- 登录尝试是否需要限流?(用户提到日活10k)
Context to Remember
需要记住的上下文
- Client is a mobile app - tokens need offline capability
- User has 10k daily active users - scale matters
- Using PostgreSQL for user storage
- User prefers explicit error messages over generic ones
- 客户端是移动应用 - 令牌需要支持离线使用
- 用户日活10k - 扩展性很重要
- 使用PostgreSQL存储用户数据
- 用户偏好明确的错误信息而非通用信息
Next Steps
后续步骤
- Implement endpoint
/auth/refresh - Add rate limiting to
/auth/login - Write tests for token expiry edge cases
- Update API docs with auth flow
- 实现端点
/auth/refresh - 为添加限流
/auth/login - 为令牌过期边缘情况编写测试
- 更新API文档中的认证流程
Files to Review on Resume
恢复工作时需要查看的文件
- — Core token logic
src/auth/jwt.ts - — Current endpoint implementation
src/routes/auth.ts
undefined- — 核心令牌逻辑
src/auth/jwt.ts - — 当前端点实现
src/routes/auth.ts
undefinedKey Reminders
关键提醒
- Ask what matters to the user before generating
- Decisions need reasoning — capture the "why"
- File paths anchor the work — always include them
- Next steps should be immediately actionable
- Better slightly longer and useful than short and vague
- 生成前询问用户的重点需求
- 决策需记录依据 — 抓住“为什么”
- 文件路径是工作的锚点 — 务必包含
- 后续步骤应可立即执行
- 宁可是稍长但有用的内容,也不要简短却模糊的信息