Claude Code plan mode, checked against the code: the plan-check skill

Dmitriy Solodukha, Caprock's developer · Published

Tested on Claude Code and Codex

Claude Code plan mode stops edits until you approve. The plan-check skill adds what goes in the plan and checks every line against the code first.

Claude Code plan mode keeps the agent from editing until you approve a plan; the plan-check skill decides what that plan holds and checks it against the code before the first edit. The agent writes files, steps, how it will verify, risks and what it will not do, then confirms each line with a tool call, fixes what was wrong, and only then changes code. In an agent without a plan mode, the skill's stop-or-go step is the gate.

Install the plan-check skill

One command per agent. The skill is a single SKILL.md; nothing runs on install.

All nine skills as a plugin. Type these inside Claude Code:

Or this skill alone, from your project's folder in a terminal:

Add -g to install it for every project.

Prompts that use the plan-check skill

The agent picks the skill when your words match its description; naming it makes sure. Click a prompt to copy it.

What plan-check adds to Claude Code plan mode

Plan mode in Claude Code enforces "no edits yet": the agent reads and explores, writes a plan, and waits for your approval. It does not say what a good plan contains or check it. The skill does:

  • Read before planning: the files to change, their callers, the tests and how the project runs them, the project's agent instructions, and earlier decisions.
  • A plan in five sections: Files (real paths), Steps (each small enough to verify), Verify (commands that exist in this project), Risks, and Not doing, which is never empty.
  • A check, line by line: each file exists, each name is spelled as in the code, every caller is covered, the verify command runs, the project's rules and decisions hold. Each line ends as OK, FIXED or OPEN.
  • Stop or go: an OPEN question, a reversed decision or deleted data stops it and asks you. Otherwise it carries out the plan and reports.

In plan mode, use both: ask for the plan in plan-check's format and its check before you approve.

What we ran, and what the agents did

Each skill was run on 2026-11-29 in a throwaway repository made for it, with the skill installed as a project skill. A small Python repository: format_price in src/prices.py, called by cart_total and receipt_line, with tests run by 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.

Two runs. Both invoked plan-check, read the files and their callers, called Caprock's current_decisions (one run was refused the permission and said so), then added currency="USD" with a ValueError for unknown codes and a new tests/test_prices.py. make test passed, 7 of 7. The final report listed what it left alone: cart_total and receipt_line still print dollars, and negative amounts were already formatted wrongly (-5 gave $-1.95) and were not changed.

Codex (0.163.0, codex exec)

The same prompt.

Read .agents/skills/plan-check/SKILL.md, wrote the plan in the skill's five sections (its current_decisions call failed), checked it against the code (both callers rely on the USD default; make -n test confirmed the verify command), then edited. Its report (blank lines and the last sentence left out):

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 it was tested on

  • Claude Code: tested on 2026-11-29 with claude -p --model sonnet, the skill installed as a project skill in .claude/skills/.
  • Codex: tested on 2026-11-29 with Codex 0.163.0 (codex exec), the skill in .agents/skills/.
  • OpenCode and Cursor: not tested. The skill is plain instructions in the open Agent Skills format, but no run on either has checked it.

Limits

  • In an agent without a plan mode, nothing enforces "no edits yet": the skill's stop-or-go step is an instruction, not a switch.
  • The check is as good as the agent's searches: a caller reached through reflection or a string may be missed.
  • For a one-line fix it says no plan is needed and skips itself.

With Caprock, and without it

When the Caprock MCP server is connected, the skill calls current_decisions to find earlier decisions the change must respect. Without it, it looks for decision records and recent commit messages on the same files. Caprock is the free, open-source app that records every coding-agent session on your computer; nothing else in the skill needs it.

Get Caprock →

The full SKILL.md

The file as it is in dspv/skills at revision dfce799. To install it by hand, save it as .claude/skills/plan-check/SKILL.md for Claude Code or .agents/skills/plan-check/SKILL.md for Codex, in your project.

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 about the plan-check skill

How do I turn on Claude Code plan mode?
Press `Shift+Tab` until the status bar shows plan mode, prefix one prompt with `/plan`, or start with `claude --permission-mode plan`. To make it the default, set `"permissions": { "defaultMode": "plan" }` in `.claude/settings.json`.
What does the plan-check skill add to plan mode?
The content and the check: a plan in five fixed sections, then every line confirmed against the code with a tool call before you approve, with wrong lines fixed and open questions asked.
Does a plan check skill work in Codex?
Yes. The skill's stop-or-go step is the gate. Codex 0.163.0 followed it in the test of 2026-11-29: plan, check, then edit.
Will it plan a typo fix?
No. For a one-line fix you have already located, a typo or a question, it says in one line that no plan is needed and why.

Sources