一键导入
create
Compact the current conversation into a structured handoff document so a fresh agent (or human) can continue the work with zero prior context.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compact the current conversation into a structured handoff document so a fresh agent (or human) can continue the work with zero prior context.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user asks to "check clean code", "review code cleanliness", "find code smells", "is this function too long", "are these names clear", "review my error handling", "check my tests", or "clean up this code". Also triggers when the user mentions Clean Code, Uncle Bob, Robert Martin, meaningful names, function length, comment rot, F.I.R.S.T. tests, or names a dimension directly ("naming", "boundaries", "concurrency"). Supports auditing all nine dimensions at once or focusing on a single dimension.
Scan Claude Code chat session logs for recurring agent anti-patterns (hedging, stalling, skipping, false completions, preference-asking, dismissing, cosmetic, caveats, flagging) and produce a ranked report with frequency counts, example excerpts, and suggested guardrail rules. Use when user asks to "analyze sessions for anti-patterns", "find bad patterns in logs", "what anti-patterns am I seeing", "agent-guardrails analyze", or wants data-driven guardrail recommendations.
Install agent behavioral guardrail rules into a project's .claude/ directory. Generates a Stop hook bash script and configures settings.local.json. Includes nine battle-tested rules (no-guessing, no-stalling, no-preference-asking, no-false-completion, no-skipping, no-dismissing, no-cosmetic, no-caveats, no-flagging). Use when user asks to "install guardrails", "set up agent guardrails", "add behavioral hooks", "agent-guardrails install", or wants to enforce assistant discipline.
Test installed agent guardrail hooks by sending trigger phrases through the stop hook script. Checks hook installation first, then runs two test phrases per rule. Use when user asks to "test guardrails", "verify hooks", "check guardrail patterns", "agent-guardrails test", or wants to confirm hooks are working.
Re-analyze Claude Code session logs against existing agent guardrail rules to measure effectiveness, catch false positives, identify missed anti-patterns, and refine regex patterns. Use when user asks to "update guardrails", "refine guardrail rules", "check guardrail effectiveness", "agent-guardrails update", "tune guardrails", or wants to improve existing behavioral rules based on real usage data.
Use when the user wants to write a "product spec" or "product specification", frame a "product bet", or define a falsifiable hypothesis before building. Also triggers on "replace the PRD", "retire the PRD", "the PRD is too long / too vague", "tighten this spec for an engineer or agent", "what's the bet", "what problem are we solving", "acceptance criteria", "success criteria", "kill / scale / graduate thresholds", "measurement plan", or when scoping a feature's problem, bet, success behaviors, and evaluation before any behavioral spec. Part of the spec-dd workflow; precedes /spec-dd:spec.
| name | create |
| description | Compact the current conversation into a structured handoff document so a fresh agent (or human) can continue the work with zero prior context. |
| argument-hint | What will the next session focus on? (optional) |
| disable-model-invocation | true |
Write a structured handoff document and save it to ./docs/handoffs/
(create the directory if it doesn't exist: mkdir -p ./docs/handoffs/).
Use a path produced by mktemp ./docs/handoffs/handoff-XXXXXX.md.
The goal is task continuity: the next agent should act with the same intent and respect the same constraints from turn one.
All file and URL references in Tier 1 and Tier 2 MUST use this format:
`path-or-url` — *what it is.* **When:** <trigger>. **Why:** <what it
constrains>. **Read:** <scope and stance>.
Tier 3 references use a one-line description.
If you cannot fill in When or Why for a Tier 1 or Tier 2 reference, omit the file.
Sections marked [infer] are usually implicit in the conversation. Infer them from what the user pushed back on, accepted quickly, called "good enough", or rejected as "missing the point". Verify inferred sections with the user before saving (see Verification step).
# Handoff: <short topic>
## Next agent: start here
1. First concrete action: <the specific move the next agent should make>.
Valid forms include "make change X to file Y", "draft section Z",
"present options A/B/C to the user and let them choose". If the
session ended mid-deliberation, name the deliberation honestly — do
not fabricate a decisive next action.
2. Read these first (Tier 1 — required before acting):
- `path` — *what it is.* **Why now:** <reason>. **Read:** <scope>.
3. If this handoff is part of a chain, also read the prior handoff
(linked in Metadata) as Tier 1.
4. Then summarise your understanding of goal, intent, and next action
back to the user and wait for confirmation before doing anything else.
## Goal
The deliverable. One or two sentences.
## Intent [infer]
- **Optimizing for:** 1–2 dominant priorities (speed, correctness,
learning, defensibility, reversibility, clarity-for-X).
- **Not optimizing for:** what to deprioritize so the next agent doesn't
gold-plate.
- **Beyond the deliverable:** what success enables.
- **Non-negotiables:** hard constraints.
- **Preferences:** soft constraints.
## Stance & ways of working [infer]
- **Stance:** the role to take in this task (e.g., "pair-programming
partner who pushes back on premature optimization", "Socratic teacher",
"ghostwriter matching the user's voice").
- **Behavioural rules:** task-specific operational rules (e.g., "show
plan before executing", "scoped edits not rewrites", "ask before
adding dependencies").
- **Tonal calibration:** stylistic preferences specific to this task and
this user — tone, formatting, pet peeves, things the user has pushed
back on.
## Status
- Done: …
- In progress: …
- Next: …
- Blocked: …
Relabel if a different vocabulary fits the task better (e.g., for
writing: "drafted / current section / remaining sections / unresolved
decisions").
## Read when relevant (Tier 2 — conditional)
Files and URLs that matter only under specific conditions.
- `path-or-url` — *what it is.* **When:** <trigger condition>.
**Why:** <what it constrains>. **Read:** <scope and stance>.
## Reference index (Tier 3 — on-demand)
Files and URLs the next agent probably won't need but should know exist.
- `path-or-url` — <one-sentence description>.
## Decisions & rationale
What was chosen and why. Bullet format, each decision under ~3 lines.
Push detailed rationale into linked ADRs or drafts.
## Tried and rejected
Dead-ends, with the reason they failed. If you cannot remember earlier
dead-ends with confidence, say so — do not fabricate.
## Open questions
Things only the user can answer.
## Suggested resources
Skills, prompts, or tools the next agent should consult first. One line
each on why.
## Metadata
- Timestamp: <ISO 8601>.
- Mode: software / conversational / planning / mixed.
- Branch + last commit: <if applicable, else "(n/a)">.
- Prior handoff: <path or "(none)">.
- Verification: interactive / non-interactive.
Interactive mode (default). Before writing the file, show the drafted Intent and Stance & ways of working sections to the user and ask:
"Does this capture what you're actually trying to achieve, and how you want me to work? Anything to correct or add?"
Revise based on their answer, then save.
Non-interactive mode (fallback). If verification with the user is not possible (auto-trigger on context-full, scripted invocation, etc.):
If the user passes arguments to the skill (e.g., via $ARGUMENTS in
Claude Code, or as inline text in other systems), treat them as the
next session's focus and weight Status > Next, First concrete
action, and Tier 1 files accordingly.
After producing the draft, run this review and iterate until no objection survives. Save only when the document passes all ten checks.
For each section:
For the document as a whole: