Préparer un transfert de session

VérifiéSûr

Capture l'état actuel de l'implémentation dans un fichier HANDOFF.md pour une reprise transparente dans une nouvelle conversation. À utiliser lorsque les fenêtres de contexte s'allongent ou que le travail s'étend sur plusieurs sessions.

Spar Skills Guide Bot
ProductiviteIntermédiaire
24/07/2026
Claude Code
#session-handoff#context-management#git-state#workflow#task-tracking

Recommandé pour

Synthèse automatique

Rédige un brief de reprise (HANDOFF.md) qui capture l'état réel d'une implémentation en cours pour qu'une nouvelle session puisse continuer sans réexplorer le code.

Points forts

  • Écrit le fichier et ses sections dès le début, puis les remplit, afin qu'un handoff partiel existe déjà sur disque si le contexte se compacte
  • Réconcilie les cases cochées du document de tâche avec la réalité du dépôt (fichiers du diff, tests, modifications non rattachées à une étape)
  • Regroupe les commandes git indépendantes en appels parallèles et capture aussi blocages, décisions, problèmes différés et pièges
  • Structure de sortie imposée : état courant, fichiers à lire en premier, étape en cours, prochaines actions

Limites

  • Suppose une convention de projet précise (document de tech-decomposition et arborescence tasks/task-[name]/) qui n'existe pas partout
  • Le placeholder {{TEST_CMD}} doit être configuré, sinon l'état des tests n'est pas capturé correctement
  • Ne fait que produire le document : il ne vérifie pas que la session suivante reprend effectivement le travail
Quand l'utiliser

À utiliser quand la fenêtre de contexte s'allonge ou que le travail doit être mis en pause en pleine implémentation pour reprendre dans une nouvelle conversation.

Quand l'éviter

À éviter si la tâche est terminée et qu'il suffit de committer, ou si le projet n'a pas de document de tâche à réconcilier avec le code.

Analyse de sécurité

Sûr
Score qualité79/100

The skill instructs only read-only git inspection, local file reads, and writing a handoff markdown file plus a one-line note in an existing task document. Bash use is legitimate and non-destructive; there is no exfiltration, obfuscation, or privilege escalation. The only mild consideration is that the templated test command executes project code, which is expected behavior for a test-state capture step.

Points d'attention
  • •Bash is used for read-only git inspection (branch, log, status, diff, stash list, merge-base) — no mutations or network calls
  • •`{{TEST_CMD}}` is an unresolved placeholder; when filled it will execute the project's test command, which can run arbitrary project code, but that is inherent to running tests
  • •Write/Edit are scoped to producing `tasks/task-[name]/HANDOFF.md` and a small note in the task doc — no destructive file operations
  • •No secrets, credentials, or repository contents are sent anywhere; no curl|sh, base64 payloads, or safety-disabling instructions
Comment cette analyse est faite

Exemples

Handoff at end of session
I need to stop for today — prepare a session handoff for the current task so I can pick it up tomorrow in a fresh conversation.
Handoff a specific task directory
/ph tasks/task-auth-refactor — write the handoff doc, including any uncommitted changes that don't belong to a step yet.
Mid-step context limit
My context window is getting long and I'm in the middle of step 4. Save progress into HANDOFF.md and capture the failing tests and open blockers.

name: ph description: >- Prepare session handoff for continuation in a new conversation. Use when 'prepare handoff', 'save progress', 'session handoff', 'I need to stop', 'prepare for next session', 'hand off', 'write handoff', or when the user wants to pause mid-implementation and resume later in a fresh context window. argument-hint: [task-directory] allowed-tools:

  • Read
  • Write
  • Edit
  • Bash
  • Glob
  • Grep

Prepare Handover Command

Announcement: Begin with: "I'm using the ph skill to prepare a session handoff."

PRIMARY OBJECTIVE

Capture the current implementation state into a cold-start brief (HANDOFF.md) so a fresh Claude session can resume work without re-exploring the codebase. This is invoked when context windows run long or when work spans multiple sessions.

Write-first discipline

Context may compact while this skill runs. Create HANDOFF.md with section headers immediately after STEP 1, then fill each section as you complete STEPS 2–5. A partially-written handoff on disk is more useful than a fully-planned one that never gets saved. Produce every section through to the end — do not stop early due to token concerns.

WHY THIS EXISTS

/si Continue mode works well when the task document is perfectly up to date. In practice, handoffs happen mid-step when docs are stale — checkmarks don't reflect actual code state, recent decisions aren't documented, and the next session wastes tokens re-discovering what this session already knew.

HANDOFF.md solves this by capturing a point-in-time snapshot that the next session can load directly.


WORKFLOW

STEP 1: Resolve Task

  1. If $ARGUMENTS provided, locate the task directory
  2. Otherwise, detect from current branch or ask: "Which task to prepare handoff for?"
  3. Read the task document (tech-decomposition)

STEP 2: Capture Git State

Run all of the following bash calls in the same turn — they are independent. Batch them into a single response with parallel tool calls rather than issuing them one at a time.

# Branch and last commit
git branch --show-current
git log --oneline -5

# Working tree state
git status --short

# Uncommitted changes summary
git diff --stat
git diff --cached --stat

# Stash list
git stash list

STEP 3: Capture Implementation State

  1. Identify current step: Read task doc checkmarks — find the last checked step and the first unchecked step
  2. Reconcile with reality: Compare task doc claims against actual code. Check every file in the diff, not only the files named in steps:
    • Do files mentioned in checked steps exist?
    • Do tests for checked steps pass?
    • Are there files modified but not mentioned in any step? (exploratory changes, debug code, temp scaffolding — all go under "Gotchas")
    • Is there uncommitted work that belongs to no step at all? Document it.
  3. Identify recently modified files:
    git diff --name-only $(git merge-base HEAD main)..HEAD
    
  4. Capture test state:
    {{TEST_CMD}} 2>&1 | tail -20
    

The git diff --name-only call above can run in the same turn as the test command and the STEP 2 git calls — batch them with parallel tool calls.

STEP 4: Capture Context

  1. Blockers: Any known issues, failing tests, unresolved errors
  2. Key decisions: Implementation choices made during this session that aren't in the task doc
  3. Deferred issues: Pre-existing problems discovered but intentionally not fixed
  4. Gotchas: Surprising behaviors, workarounds applied, things the next session should know

STEP 5: Write HANDOFF.md

Write to tasks/task-[name]/HANDOFF.md:

# Session Handoff

**Date**: YYYY-MM-DD
**Branch**: [branch-name]
**Last Commit**: [sha] [message]

---

## Current State

**Step in progress**: Step [N]: [description]
**Completed steps**: [list of checked steps with brief notes]
**Overall progress**: [X of Y steps complete]

## Files to Read First

Load these files to rebuild context (ordered by importance):

1. `[path/to/most-critical-file]` — [why: e.g., "main implementation file for this step"]
2. `[path/to/test-file]` — [why: e.g., "failing test that needs GREEN implementation"]
3. `[path/to/related-module]` — [why: e.g., "dependency modified in Step 2"]
4. `[path/to/task-doc]` — [why: "source of truth for requirements"]
5. `[path/to/context-file]` — [why: e.g., "database schema with new model"]

## Working Tree State

[git status output]


**Uncommitted changes**: [description of what's in progress but not committed]
**Stashes**: [any stashed work and what it contains]

## Test State

[test output summary — passing/failing counts]


**Failing tests**: [list with file:line if applicable]
**Reason**: [why they fail — e.g., "RED phase, implementation not written yet"]

## Key Decisions Made This Session

| # | Decision | Rationale |
|---|----------|-----------|
| 1 | [what was decided] | [why] |

## Blockers & Gotchas

- [any known issues the next session should be aware of]

## Deferred Issues

- [pre-existing problems not in scope, logged here for awareness]

## Next Actions

1. [Immediate next thing to do — be specific]
2. [Then this]
3. [Then this]

STEP 6: Update Task Document

  1. Ensure all checked/unchecked steps accurately reflect code state
  2. Add a note in the task doc: **Handoff prepared**: See HANDOFF.md for session context

HOW /si CONTINUE MODE USES HANDOFF.md

When /si detects Continue mode, it checks for HANDOFF.md in the task directory:

  • If HANDOFF.md exists: Load it first, read the "Files to Read First" section, then reconcile with task doc. This is faster and more accurate than re-exploring.
  • If HANDOFF.md is absent: Fall back to the current behavior (scan task doc checkmarks, run tests, read recent commits).

After /si Continue mode successfully resumes:

  • Rename HANDOFF.md to HANDOFF-[date].md (archive, don't delete — useful for debugging session boundaries)

CONSTRAINTS

  • HANDOFF.md stays uncommitted — it's a transient artifact consumed by the next session. Leave it in the working tree, not in git history.
  • This skill only captures state — If you notice a quick fix while reviewing, log it under "Next Actions" and let the next session decide. Fixing mid-handoff corrupts the snapshot you are about to save.
  • Be honest about state — if tests are failing, say so. If a step is partially done, say so. The next session needs truth, not optimism.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/prepare-handover-mryiqfl3/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/prepare-handover-mryiqfl3' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/prepare-handover-mryiqfl3/download' --output '.skill-downloads/prepare-handover-mryiqfl3/SKILL.md.part' && mv '.skill-downloads/prepare-handover-mryiqfl3/SKILL.md.part' '.skill-downloads/prepare-handover-mryiqfl3/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/prepare-handover-mryiqfl3/SKILL.md' && test -s '.skill-downloads/prepare-handover-mryiqfl3/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/ph' && cp -R '.skill-downloads/prepare-handover-mryiqfl3' '.claude/skills/ph'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/prepare-handover-mryiqfl3'

openskills read 'prepare-handover-mryiqfl3'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/prepare-handover-mryiqfl3/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires