Le Plan Mode de Claude Code, vérifié par rapport au code : la skill plan-check

Dmitriy Solodukha, développeur de Caprock · Publié le

Testé le sur Claude Code et Codex

Claude Code Plan Mode bloque les modifications avant votre accord. La skill plan-check définit le plan et vérifie chaque ligne dans le code.

Le Plan Mode de Claude Code empêche l'agent de modifier le code tant que vous n'avez pas approuvé un plan ; la skill plan-check définit le contenu de ce plan et le vérifie par rapport au code avant la première modification. L'agent consigne les fichiers, les étapes, la méthode de vérification, les risques et ce qu'il ne fera pas, puis confirme chaque ligne par un appel d'outil, corrige ce qui était erroné et modifie le code seulement ensuite. Dans un agent sans mode de planification, c'est l'étape d'arrêt ou de poursuite de la skill qui conditionne le passage à l'action.

Installer la skill plan-check

Une commande par agent. La skill se résume à un seul SKILL.md ; rien ne s'exécute à l'installation.

Les neuf skills dans un plugin. Saisissez ces commandes dans Claude Code :

Ou cette skill seule, depuis le dossier de votre projet dans un terminal :

Ajoutez -g pour l'installer pour tous les projets.

Prompts utilisant la skill plan-check

L'agent choisit la skill lorsque vos mots correspondent à sa description ; la nommer permet de s'en assurer. Cliquez sur un prompt pour le copier.

Ce que plan-check ajoute à Plan Mode dans Claude Code

Plan Mode dans Claude Code impose de ne rien modifier pour le moment : l'agent lit et explore, rédige un plan et attend votre approbation. Il ne précise pas ce qu'un bon plan doit contenir et ne le vérifie pas. La skill s'en charge :

  • Lire avant de planifier : les fichiers à modifier, leurs appelants, les tests et la façon dont le projet les exécute, les instructions du projet pour les agents et les décisions antérieures.
  • Un plan en cinq sections : Files (chemins réels), Steps (étapes assez petites pour être vérifiées), Verify (commandes qui existent dans ce projet), Risks et Not doing, qui n'est jamais vide.
  • Une vérification, ligne par ligne : chaque fichier existe, chaque nom est orthographié comme dans le code, tous les appelants sont couverts, la commande de vérification s'exécute, les règles et décisions du projet sont respectées. Chaque ligne se termine par OK, FIXED ou OPEN.
  • Arrêter ou continuer : une question OPEN, une décision annulée ou des données supprimées l'arrêtent et déclenchent une demande à votre attention. Sinon, la skill exécute le plan et fait son rapport.

En Plan Mode, utilisez les deux : demandez le plan au format de plan-check et sa vérification avant de l'approuver.

Ce que nous avons exécuté et ce que les agents ont fait

Chaque skill a été exécutée le 29 novembre 2026 dans un dépôt jetable créé pour elle, avec la skill installée au niveau du projet. Un petit dépôt Python : format_price dans src/prices.py, appelé par cart_total et receipt_line, avec des tests exécutés par make test.

Claude Code (claude -p --model sonnet)

Plan first, then do it: format_price should take a currency code (USD default, EUR uses the euro sign after the number). Do not touch anything until the plan is checked.

Deux exécutions. Les deux ont invoqué plan-check, lu les fichiers et le code qui les appelle, appelé current_decisions de Caprock (une exécution s'est vu refuser l'autorisation et l'a signalé), puis ajouté currency="USD" avec un ValueError pour les codes inconnus et un nouveau tests/test_prices.py. make test a réussi, 7 sur 7. Le rapport final précisait ce qui n'avait pas été modifié : cart_total et receipt_line affichent toujours des dollars, et les montants négatifs étaient déjà mal formatés (-5 donnait $-1.95) et n'ont pas été modifiés.

Codex (0.163.0, codex exec)

The same prompt.

A lu .agents/skills/plan-check/SKILL.md, rédigé le plan selon les cinq sections de la skill (son appel à current_decisions a échoué), l'a vérifié dans le code (les deux appelants reposent sur la valeur USD par défaut ; make -n test a confirmé la commande de vérification), puis a effectué les modifications. Son rapport (lignes vides et dernière phrase omises) :

Implemented after checking the plan.
- `format_price(150)` → `$1.50`
- `format_price(150, "EUR")` → `1.50€`
- Unsupported codes raise `ValueError`.
All 6 tests pass; `git diff --check` passes. No deviations from the plan.

Agents sur lesquels elle a été testée

  • Claude Code : testé le 29 novembre 2026 avec claude -p --model sonnet, la skill étant installée comme skill de projet dans .claude/skills/.
  • Codex : testé le 29 novembre 2026 avec Codex 0.163.0 (codex exec), la skill étant dans .agents/skills/.
  • OpenCode et Cursor : non testés. La skill est constituée de simples instructions au format ouvert Agent Skills, mais aucune exécution sur l'un ou l'autre ne l'a vérifiée.

Limites

  • Dans un agent sans mode de planification, rien n'impose « aucune modification pour l'instant » : l'étape d'arrêt ou de poursuite de la skill est une instruction, pas un mécanisme de blocage.
  • La vérification dépend de la qualité des recherches de l'agent : un appelant atteint par réflexion ou via une chaîne de caractères peut lui échapper.
  • Pour une correction d'une ligne, elle indique qu'aucun plan n'est nécessaire et saute cette étape.

Avec et sans Caprock

Quand le serveur MCP de Caprock est connecté, la skill appelle current_decisions pour trouver les décisions antérieures que la modification doit respecter. Sans ce serveur, elle recherche des documents de décision et des messages de commit récents sur les mêmes fichiers. Caprock est l'application gratuite et open source qui enregistre chaque session d'agent de code sur votre ordinateur ; rien d'autre dans la skill n'en a besoin.

Obtenir Caprock →

Le SKILL.md complet

Le fichier tel qu'il figure dans dspv/skills à la révision dfce799. Pour l'installer manuellement, enregistrez-le dans votre projet sous le nom .claude/skills/plan-check/SKILL.md pour Claude Code ou .agents/skills/plan-check/SKILL.md pour Codex.

skills/plan-check/SKILL.md
---
name: plan-check
description: >
  Write a short plan before changing code (files to touch, steps, how the change will be verified,
  risks, what will not be done), then check every line of that plan against the actual code before
  the first edit. Use when the user says "plan first", "make a plan before you code", "plan mode",
  "claude code plan mode", "think before editing", "don't touch anything yet", or asks for a change
  that spans several files, a refactor, a migration, or anything hard to undo. Works in any coding
  agent; in Claude Code, plan mode is the built-in equivalent.
license: Apache-2.0
---

# Plan, check, then change

A plan written from memory of the code is a guess. This skill makes the agent write the plan down,
check it against the files as they are, fix what the check finds, and only then edit.

## When to use it, and when not

Use it before any change that touches more than one file, changes a public interface, moves data,
or is hard to undo, and whenever the user asks for a plan first.

Skip it for a one-line fix the user has already located, a typo, or a question that needs no edit.
Say in one line that no plan is needed and why.

## Step 1: Read before you plan

Read the code the change will touch before writing a word of the plan:

- the files you expect to edit, and their callers (search for each function, type, route or
  config key you will change);
- the tests that cover them, and how the project runs its tests (README, Makefile,
  package.json scripts, CI config);
- the project's agent instructions (CLAUDE.md, AGENTS.md or similar) for rules the change must keep.

**Earlier decisions.** If the Caprock MCP tool `current_decisions` is available, call it (it takes an
optional `project`, the repository folder's name, and `limit`) and keep the decisions that touch this
change. Without it, look for decision records in the repository (ADRs, a `docs/` decisions file,
recent commit messages on the same files with `git log --oneline -- <path>`). A plan that reverses an
earlier decision says so in Risks and asks the user. Caprock (https://caprock.dev, free, open source,
runs locally) provides that tool; nothing else here needs it.

## Step 2: Write the plan

Keep it short: a reviewer should read it in under a minute. Use exactly these sections.

```markdown
## Plan: <one-line goal>

**Files**
- `path/to/file.ext`: what changes (new function, edited block, deleted)
- `path/to/new_file.ext` (new): what it holds

**Steps**
1. <smallest step that leaves the code working>
2. ...

**Verify**
- `<exact command>`: what passing looks like
- <manual check, if a command cannot show it>

**Risks**
- <what could break, who calls it, what data it touches>

**Not doing**
- <tempting work left out of scope: refactors, renames, upgrades, unrelated fixes>
```

Rules for the plan:

- Every file is a real path. Every function, flag or command is named exactly as it appears in code.
- Each step is small enough to verify on its own; order steps so the code builds after each.
- Verify names commands that exist in this project, not generic ones.
- Not doing is never empty: name at least one thing you will deliberately leave alone.

## Step 3: Check the plan against the code

Go through the plan line by line and confirm each claim with a tool call (read, search, run), not
from memory:

| Check           | How                                                                |
| --------------- | ------------------------------------------------------------------ |
| Files exist     | List or read each path; a "(new)" path must not exist yet          |
| Names are right | Search each function, type, key; note its exact signature          |
| Callers covered | Search every use of what changes; each caller is in Files or Risks |
| Verify runs     | The test or build command exists (script, target, binary)          |
| Rules kept      | Compare steps with the project's agent instructions                |
| Decisions kept  | Compare with the decisions found in Step 1                         |

Then add a short block under the plan:

```markdown
**Check**
- OK: <claim confirmed, with the file or command that showed it>
- FIXED: <claim that was wrong, and what the plan says now>
- OPEN: <question only the user can answer>
```

If a check fails, fix the plan and re-check that line. Do not start editing with a FIXED line you
have not re-checked.

## Step 4: Stop or go

- **Stop and ask** when there is an OPEN line, when the plan reverses an earlier decision, when it
  deletes data or files the user did not mention, or when the check found the task is much larger
  than the user described. Show the plan and the Check block, ask the open questions, and wait.
- **Go** when every line is OK or a re-checked FIXED, and the user asked you to do the work (not
  only to plan). If the user asked only for a plan, stop after the Check block.

## Step 5: Carry out the plan

- Follow the steps in order. Run the Verify commands at the end, and after any step that names its own
  check.
- If the code turns out different from the plan (a caller you missed, a test that does not exist),
  stop editing, update the plan and the Check block, and decide stop or go again. Do not drift.
- Touch nothing listed under Not doing.

## Step 6: Report

Always end with this report, in this shape, even when the change is small: it is how the user
sees whether the plan held.

```markdown
**Done**: <goal>
- Changed: `path` (what), ...
- Verify: `<command>`: <result, pasted or summarized>
- Differed from plan: <what and why, or "nothing">
- Left out: <the Not doing list, and anything found along the way>
```

## Plan mode in Claude Code

Claude Code has a built-in plan mode: Claude reads files and runs commands to explore, writes a plan,
and makes no edits until you approve it (Claude Code docs, permission modes page, read 2026-11-29).
Ways in:

- press `Shift+Tab` until the status bar shows plan mode on, or prefix a single prompt with `/plan`;
- start the session with `claude --permission-mode plan`;
- make it the project default with `"permissions": { "defaultMode": "plan" }` in `.claude/settings.json`.

At the approval prompt you can approve, keep planning, or press `Ctrl+G` to edit the plan in your
editor. Plan mode enforces "no edits yet"; this skill adds what to put in the plan and the check
against the code. Use both: in plan mode, write the plan in Step 2's format and run Step 3 before
asking for approval. In an agent without a plan mode, the skill's Stop or go step is the gate.

Questions sur la skill plan-check

Comment activer le Plan Mode de Claude Code ?
Appuyez sur `Shift+Tab` jusqu'à ce que la barre d'état affiche Plan Mode, ajoutez `/plan` au début d'un prompt ou démarrez avec `claude --permission-mode plan`. Pour en faire le mode par défaut, définissez `"permissions": { "defaultMode": "plan" }` dans `.claude/settings.json`.
Qu'ajoute la skill plan-check à Plan Mode ?
Le contenu et la vérification : un plan en cinq sections fixes, puis chaque ligne vérifiée dans le code par un appel d'outil avant votre approbation, avec correction des lignes erronées et formulation des questions en suspens.
Une skill de vérification de plan fonctionne-t-elle dans Codex ?
Oui. L'étape d'arrêt ou de poursuite de la skill sert de point de contrôle. Codex 0.163.0 l'a suivie lors du test du 29 novembre 2026 : planifier, vérifier, puis modifier.
Va-t-elle planifier la correction d'une faute de frappe ?
Non. Pour une correction d'une ligne que vous avez déjà localisée, une faute de frappe ou une question, elle indique en une ligne qu'aucun plan n'est nécessaire et pourquoi.

Sources

L'application elle-même est en anglais.