会话交接文档生成
create_handoff
编写交接文档,将当前会话的上下文精简后交给另一个智能体使用。当会话结束但仍有未完成工作、在执行 /clear 之前,或上下文已满时使用。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- description
- Write a handoff document that compacts the current session's context for another agent. Use when ending a session with unfinished work, before /clear, or when context is full.
- disable-model-invocation
- true
03 SKILL.md 正文
Create Handoff
You are tasked with writing a handoff document to hand off your work to another agent in a new session. You will create a handoff document that is thorough, but also concise. The goal is to compact and summarize your context without losing any of the key details of what you're working on.
Process
1. Filepath & Metadata
Use the following information to understand how to create your document:
First, determine the session name from the active ledger:
ls thoughts/ledgers/CONTINUITY_CLAUDE-*.md 2>/dev/null | head -1 | sed 's/.*CONTINUITY_CLAUDE-\(.*\)\.md/\1/'
This returns the active work stream name (e.g., open-source-release). Use this as the handoff folder name.
If no ledger exists, use general as the folder name.
Create your file under: thoughts/shared/handoffs/{session-name}/YYYY-MM-DD_HH-MM-SS_description.md, where:
{session-name}is from the ledger (e.g.,open-source-release) orgeneralif no ledgerYYYY-MM-DDis today's dateHH-MM-SSis the current time in 24-hour formatdescriptionis a brief kebab-case description
Gather the metadata you need by hand (date/time, git commit, branch, repository name):
date "+%Y-%m-%d %H:%M:%S %z" # date/time + timezone
git rev-parse HEAD # current commit
git branch --show-current # current branch
Examples:
- With ledger
open-source-release:thoughts/shared/handoffs/open-source-release/2025-01-08_13-55-22_create-context-compaction.md - No ledger (general):
thoughts/shared/handoffs/general/2025-01-08_13-55-22_create-context-compaction.md
2. Handoff writing.
using the above conventions, write your document. use the defined filepath, and the following YAML frontmatter pattern. Use the metadata gathered in step 1, Structure the document with YAML frontmatter followed by content:
Use the following template structure:
---
date: [Current date and time with timezone in ISO format]
session_name: [From ledger, e.g., "open-source-release" - see step 1]
researcher: [Git user name — run: git config user.name]
git_commit: [Current commit hash]
branch: [Current branch name]
repository: [Repository name]
topic: "[Short title of what this handoff covers]"
tags: [relevant-component-names, keywords]
status: complete
last_updated: [Current date in YYYY-MM-DD format]
last_updated_by: [Researcher name]
type: handoff
---
# Handoff: {very concise description}
## Task(s)
{description of the task(s) that you were working on, along with the status of each (completed, work in progress, planned/discussed). If you are working on an implementation plan, make sure to call out which phase you are on. Make sure to reference the plan document and/or research document(s) you are working from that were provided to you at the beginning of the session, if applicable.}
## Critical References
{List any critical specification documents, architectural decisions, or design docs that must be followed. Include only 2-3 most important file paths. Leave blank if none.}
## Recent changes
{describe recent changes made to the codebase that you made in line:file syntax}
## Learnings
{describe important things that you learned - e.g. patterns, root causes of bugs, or other important pieces of information someone that is picking up your work after you should know. consider listing explicit file paths.}
## Post-Mortem
### What Worked
{Describe successful approaches, patterns that helped, tools that worked well. Be specific - these get indexed for future sessions.}
- Approach 1: [what and why it worked]
- Pattern: [pattern name] was effective because [reason]
### What Failed
{Describe attempted approaches that didn't work, errors encountered, dead ends. This helps future sessions avoid the same mistakes.}
- Tried: [approach] → Failed because: [reason]
- Error: [error type] when [action] → Fixed by: [solution]
### Key Decisions
{Document important choices made during this task and WHY they were made. Future sessions will reference these.}
- Decision: [choice made]
- Alternatives considered: [other options]
- Reason: [why this choice]
## Artifacts
{ an exhaustive list of artifacts you produced or updated as filepaths and/or file:line references - e.g. paths to feature documents, implementation plans, etc that should be read in order to resume your work.}
## Action Items & Next Steps
{ a list of action items and next steps for the next agent to accomplish based on your tasks and their statuses}
## Other Notes
{ other notes, references, or useful information - e.g. where relevant sections of the codebase are, where relevant documents are, or other important things you leanrned that you want to pass on but that don't fall into the above categories}
3. Record Session Outcome (optional)
If useful, note in the handoff body how the session went so the next agent knows the starting state. Pick one label and add a short reason:
SUCCEEDED: Task completed successfullyPARTIAL_PLUS: Mostly done, minor issues remainPARTIAL_MINUS: Some progress, major issues remainFAILED: Task abandoned or blocked
This is a manual note in the document (e.g. under ## Task(s) or ## Action Items).
There is no outcome-tracking database in this project — skip if not helpful.
4. Confirm completion
Respond to the user:
Handoff created at thoughts/shared/handoffs/{session-name}/...
Resume in a new session with:
/resume_handoff path/to/handoff.md
Additional Notes & Instructions
- more information, not less. This is a guideline that defines the minimum of what a handoff should be. Always feel free to include more information if necessary.
- be thorough and precise. include both top-level objectives, and lower-level details as necessary.
- avoid excessive code snippets. While a brief snippet to describe some key change is important, avoid large code blocks or diffs; do not include one unless it's necessary (e.g. pertains to an error you're debugging). Prefer using
/path/to/file.ext:linereferences that an agent can follow later when it's ready, e.g.v2/backend/apps/core/services/availability_service.py:12-24
04 同仓库更多 Skills
技术文档写作规范
writing-standards
遵循 AS v2 技术写作规范(清晰、简洁、主动语态、Python/Django 惯例)。适用于撰写 README、文档字符串(PEP 257)、提交信息、PR 描述、错误信息或任何技术文档。
成果验证关卡
verification-gate
在宣称成功之前先进行验证。适用于准备表示某功能可用/已完成、实现功能后、修复缺陷后,或推送代码前——先运行验证命令并确认输出。
测试驱动开发
test-driven-development
在 AS v2(pytest + Django/DRF)中先编写失败的测试,再进行实现。适用于实现功能或修复缺陷时,在编写任何生产代码之前使用。
子智能体编排开发
subagent-development
在 AS v2 中编排子智能体——将任务拆解为相互独立的领域,并行处理并进行两阶段审查。适用于委派探索、实现或跨文件验证,以加快工作进度并节省主上下文。
自动化安全扫描
security-scan
为 AS v2 提供自动化安全扫描。在提交前或审查变更中的漏洞时使用。执行依赖审计(pip-audit、npm audit)、密钥检测(grep 模式)和代码模式扫描(SQL 注入、XSS、eval、pickle、硬编码密钥)。与项目 hooks 系统集成。
交接文档恢复工作
resume-handoff
从保存的交接文档恢复工作,在继续之前先根据当前代码库验证其状态。适用于上下文清空后或在新会话中(通过路径、会话名称或 GitHub issue)从保存的交接文档恢复工作。