Created
August 14, 2026 12:43
-
-
Save fnnzzz/b4e47bdc7dbc3b6be9ef88dcf18fb780 to your computer and use it in GitHub Desktop.
handoff skill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Зроби це як звичайний локальний Codex skill, без будь-яких додаткових інтеграцій. | |
| Структура: | |
| ```text | |
| ~/.codex/skills/handoff/SKILL.md | |
| ``` | |
| Створення: | |
| ```bash | |
| mkdir -p ~/.codex/skills/handoff | |
| nano ~/.codex/skills/handoff/SKILL.md | |
| ``` | |
| Встав у `~/.codex/skills/handoff/SKILL.md` ось це: | |
| ```md | |
| --- | |
| name: handoff | |
| description: Write or refresh the task state file at .claude/handoffs/<slug>-state.md so the thread is safe to clear. Use when the user says handoff, /handoff, "запиши стан", "зроби хендофф", "збережи контекст"; when a phase boundary is reached (exploration finished, decision made, slice merged); or before ending, clearing, or compacting a thread. | |
| allowed-tools: Bash(git:*), Read, Write, Edit, Glob, Grep | |
| --- | |
| # Handoff | |
| Externalize the working state of the current task into one small file on disk, so | |
| the conversation can be cleared without losing anything that matters. The file — | |
| not the transcript — is the durable record. | |
| ## Resolve the path | |
| 1. Repo root — **the main checkout, never the worktree**: | |
| ```bash | |
| cd "$(git rev-parse --git-common-dir)/.." && pwd | |
| ``` | |
| `--show-toplevel` is wrong here: inside a worktree it returns the worktree, | |
| and merged worktrees are deleted automatically, which would take the handoff | |
| with them. `--git-common-dir` resolves to the main checkout from any worktree. | |
| Outside a repo, use the cwd. | |
| 2. Slug: the argument if given; otherwise the current branch with its `claude/` | |
| or `codex/` prefix stripped; otherwise a short kebab-case name for the task. | |
| 3. Canonical path: `<root>/.claude/handoffs/<slug>-state.md`. Create the | |
| directory if missing. | |
| 4. Make sure it is ignored — `git check-ignore -q .claude/handoffs` — and if it is | |
| not, append `**/.claude/handoffs/` and `**/.claude/artifacts/` to | |
| `.git/info/exclude`. Never add these to a tracked `.gitignore`; they are | |
| per-developer working files. | |
| 5. Tmp mirror path — **always write here too**, in addition to the canonical | |
| path, so the handoff survives even if the whole main checkout is later | |
| moved, re-cloned, or removed (not just a worktree being deleted): | |
| ```bash | |
| repo_key="$(printf '%s' "<root>" | tr '/' '-')" | |
| tmp_dir="${TMPDIR:-/tmp}/claude-handoffs${repo_key}" | |
| mkdir -p "$tmp_dir" | |
| ``` | |
| Tmp path: `$tmp_dir/<slug>-state.md`. It is deterministic from `<root>` | |
| alone, so any future session on the same repo (from any worktree) derives | |
| the same path without needing to be told it. | |
| If either file already exists, **rewrite it in place**. Do not append a new | |
| dated block each time — a handoff is current state, not a log. Keep the | |
| canonical path and the tmp mirror byte-identical; write the content once and | |
| copy it to the second path rather than composing it twice. | |
| ## Template | |
| Use these exact headings. Drop a section only if it is genuinely empty; keep the | |
| heading with `none` rather than inventing content. | |
| ```markdown | |
| # <task title> | |
| ## Goal | |
| One or two sentences. What counts as done. | |
| ## Accepted requirements and constraints | |
| Bullets. Include constraints the user stated, especially the ones a fresh | |
| session would otherwise violate. | |
| ## Decisions and rationale | |
| Each decision with its reason, and what was rejected. This is the part that is | |
| most expensive to rediscover. | |
| ## Relevant files and symbols | |
| `path/to/file.ts:120` — `functionName()`, why it matters. Paths and symbols only. | |
| ## Files changed | |
| Path — intent of the change. Note committed vs uncommitted. | |
| ## Latest test status | |
| The exact command and its actual last result. If it was never run, write | |
| `not run` — never guess or carry forward a stale pass. | |
| ## Open problems | |
| Unresolved errors, failed hypotheses and why they failed, blocking questions. | |
| ## Next three actions | |
| 1. | |
| 2. | |
| 3. | |
| ``` | |
| ## Rules | |
| - Write only what this conversation actually established. If something was never | |
| verified, say so — a handoff that overstates certainty is worse than a short one. | |
| - No raw file contents, no logs, no command transcripts. Bulk output belongs in | |
| `.claude/artifacts/<slug>/`; reference the path instead of pasting. | |
| - Reference code as `path:line` so the next session rereads two files, not the | |
| whole architecture. | |
| - Keep it under roughly 120 lines. If it grows past that, the task is too big for | |
| one handoff — split it. | |
| - Do not put task state into `CLAUDE.md`, `AGENTS.md`, or memory. Those load into | |
| every session; this file loads only when named. | |
| ## Finish | |
| Report both paths (canonical and tmp mirror) in one line each, and state | |
| whether the thread is now safe to clear. Do not clear it yourself. | |
| ## Resuming from a handoff | |
| Starting a fresh session on this task means reading exactly that one file. Do not | |
| scan `.claude/handoffs/` for related files unless asked — the point of the | |
| handoff is a small, named working set. If the canonical path is missing — | |
| the main checkout was moved, re-cloned, or deleted — recompute the tmp | |
| mirror path from the current repo root the same way (step 5 above) and read | |
| that instead before concluding no handoff exists. | |
| ``` | |
| Потім перезапусти Codex. | |
| Як користуватись: | |
| - напиши в чаті `handoff` | |
| - або `зроби хендофф` | |
| - або `запиши стан` | |
| - або `збережи контекст` | |
| Якщо хочеш повністю без слова `.claude` всередині файлу, я можу одразу дати тобі другу версію цього `SKILL.md`, де все буде переписано на `.codex/handoffs/...`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment