AIHero
    Loading
    18 / 27AI Skills for Real Engineers · Updated Aug 24, 2026

    /handoff 技能

    把一次长会话整理成文档,让另一个智能体能接续。

    Matt Pocock
    Matt Pocock
    源代码下一页

    安装此技能

    npx skills@latest add mattpocock/skills --skill=handoff

    然后输入 /handoff 来调用它。

    本页内容

    它的作用

    handoff 把你所在的对话压缩成 交接文档: one markdown file, written to your OS's temporary directory rather than into the workspace, that a fresh agent 能够阅读并接手工作。

    What it gives you is portability, not compression, so the skill is narrower than it sounds. You need a file only when the work has to travel: to a new 运行框架, a new directory, a colleague, or a side task you want to fork off. If nothing is travelling, you do not need a handoff. Staying in the 会话, /clear,一个 子智能体 and /compact 覆盖阶段结束的常见情况,而 /compact 覆盖它的频率比这个技能更高。

    何时使用

    你通过输入 /handoff; the agent won't reach for it on its own. Pass a note about what the next session is for, and the skill writes the document for that purpose.

    There are four triggers, and only four:

    情境为什么是文件
    Swapping harness (Claude → Codex)新运行框架看不到旧的 context
    移动到不同的目录或仓库原型目录是常见情况
    把工作发送给同事他们需要可阅读的东西
    分叉出阶段中途发现的支线任务你继续工作;第二个智能体接过分支

    For anything else (same harness, same directory, you are done 追问审视 and moving to implementation), use /compact. ask-matt has the ordered tree over all five options at a phase boundary.

    分支是人们跳过的用法

    The skill's description reads like session resumption: write a summary, end here, resume there. Read that way, it looks like a worse /compact, so people skip it. The fork case is the one worth knowing. You 留在你的会话中 并把累积上下文的副本交给并行工作的第二个智能体。

    这正是绕道 prototype uses. You are deep in a design conversation, you hit a question that only running code will settle, and you do not want to spend the thread you built on finding out. Hand off to a prototype session, get the answer, hand the answer back, and reference it from the original thread. The work crosses over twice, your original conversation stays live, and you re-explain nothing.

    阶段边界的五个选项中有三个保留不同的东西: /compact 保留你的意图, /clear 什么都不保留, /handoff 保留工作移动的能力。

    什么随行,什么不随行

    The document carries the live thread (what's in flight, why, and what's next) plus a 建议技能 section naming what the next agent should reach for. The skill redacts secrets before it writes the file.

    It deliberately does not carry anything already written down. The document references specs, plans, ADRs, issues, commits and diffs by path or URL, and never copies them. That keeps the file small, and it keeps the settled detail in one place instead of two copies that drift apart.

    常见问题

    交接还是压缩? /compact unless something is travelling. Staying on the same task is a compact, not a handoff. When the harness and directory stay the same and you need to stay in the loop, the phase-boundary tree ends at /compact most days. /handoff does not summarise better. Its advantage is that the result is a file you can carry somewhere /compact 够不到。

    那么 compact、clear 和 handoff 之间实际的区别是什么? Each one preserves something different. /compact compresses this context and continues in a fresh window, so your intent survives. /clear empties the window and starts from nothing. That is correct when everything behind you is disposable, and you cannot undo it if it isn't. /handoff writes a portable file, so the work survives the move to somewhere else. All three turn a 第一手资料 (按原样发生的对话)变成 二手资料 (a summary of it). Continuing is the only option that doesn't, which is why you rule it out first.

    我的交接文件去哪了? It goes to the temp directory, which is the most-reported problem with the skill. The skill resolves it as $TMPDIR, else /tmp (%TEMP% on Windows), but the paths are long. Ask for the path back and keep it before you move on. Temp is deliberate, because a handoff is a document in transit, not an artifact you maintain. Temp is also not durable, as the next question explains.

    我的交接文件在会话之间消失了。 Some environments clear temp between sessions (Codex is the reported case), and a reboot empties /private/tmp. If the next session isn't starting within the hour, or is starting under a different harness, copy the file somewhere durable yourself as soon as it's written. The same applies to anything the document 指向: if a dispatch references other files in temp, the next agent can't follow it.

    到底怎么把它交给下一个智能体? Open the fresh session and point it at the path: read this file, then continue. Point at the file rather than pasting the summary into a shell command. The shell mangles a summary that contains backticks or $(...) when you interpolate it into claude "<summary>". The usual result is silent truncation rather than an error, so the new agent starts with an incomplete brief and nothing tells you.

    这和 /branch, --fork-session,或内置的 /handoff? They are similar, not identical. /branch isn't a shipped skill here; /handoff 是标准名称。fork 继承上下文的精确副本;这个技能产出的是 targeted compression aimed at a stated next task, in a file. Where a fork will do (same machine, same harness, same directory), a fork is less work. The file is the better choice when the destination is somewhere the fork can't go.

    什么时候某物该放进 CLAUDE.md 代替? 下个月再问它是否仍然成立。 CLAUDE.md is standing context about the project, loaded into every session whether it's relevant or not. A handoff is about one piece of work in flight and is useless once that work lands. If you keep re-explaining a fact, it belongs in CLAUDE.md. A half-finished task belongs in a handoff.

    它记录「做了什么」,而不是「为什么」。 This is a fair criticism, and people raise it often. Two things help. Pass the argument (tell it what the next session is for), so the skill keeps the reasoning that bears on that rather than flattening it. And watch for confident claims the session never verified, such as "X isn't built" or "Y is done". The next agent trusts the document and does not re-check it, so a belief written as a fact becomes a false premise for everything that follows. Read the document before you hand it over, and downgrade anything you only assumed.

    为什么它是一个技能而不是斜杠命令? Both work; they suit different situations. As a skill, it ships and updates through the same install path as everything else here, which makes it shareable. Its frontmatter, not the mechanism, is what stops the agent from firing it on its own.

    做到以下就算成功

    • 文档只是对话的一小部分,规格说明、issue 和 diff 以路径和 URL 出现,而不是复制的文本。
    • 你可以冷读它,无需打开原会话,就知道下一步做什么。
    • 全新智能体直接开始工作,而不是让你重新解释配置。
    • In the fork case, your original session is unchanged when you come back to it.
    • 建议技能部分点名的技能,正是你自己会去用的那个。
    • 其中没有任何密钥、Token 或密码。

    在流程中的位置

    handoff 是一个 随时可调用的独立技能. It works between sessions rather than inside a build chain. It is a narrow one, and you'll use it less often than the other four options at a phase boundary. Its closest neighbour is prototype, because a prototype lives in its own directory and the round trip out and back is the move this skill is for. When you're at a boundary and unsure whether to continue, clear, hand off, delegate or compact, ask-matt has the tree that orders those five, and routes you across the rest of the set.

    技能操作

    安装技能

    Live Skills.sh install count
    npx skills@latest add mattpocock/skills

    安装整套技能,然后在智能体中输入 /handoff 来调用它。

    用以下命令更新: npx skills updateSkills.sh