Plan Mode do Claude Code, conferido com o código: a skill plan-check

Dmitriy Solodukha, desenvolvedor do Caprock · Publicado em

Testado em no Claude Code e no Codex

O Plan Mode do Claude Code impede edições até sua aprovação. A skill plan-check define o conteúdo do plano e confere cada linha com o código antes.

O Plan Mode do Claude Code impede o agente de editar até você aprovar um plano; a skill plan-check define o conteúdo desse plano e o confere com o código antes da primeira edição. O agente escreve os arquivos, etapas, como vai verificar, riscos e o que não fará, depois confirma cada linha com uma chamada de ferramenta, corrige o que estava errado e só então altera o código. Em um agente sem Plan Mode, a etapa de parar ou prosseguir da skill é a barreira.

Instale a skill plan-check

Um comando por agente. A skill é um único SKILL.md; nada é executado na instalação.

Todas as nove skills como plugin. Digite isto dentro do Claude Code:

Ou apenas esta skill, em um terminal na pasta do seu projeto:

Adicione -g para instalar em todos os projetos.

Prompts que usam a skill plan-check

O agente escolhe a skill quando suas palavras correspondem à descrição dela; citar seu nome garante isso. Clique em um prompt para copiá-lo.

O que plan-check acrescenta ao Plan Mode do Claude Code

O Plan Mode no Claude Code impõe “nenhuma edição ainda”: o agente lê e explora, escreve um plano e espera sua aprovação. Ele não define o conteúdo de um bom plano nem o verifica. A skill faz isso:

  • Leia antes de planejar: os arquivos a alterar, seus chamadores, os testes e como o projeto os executa, as instruções do projeto para agentes e as decisões anteriores.
  • Um plano em cinco seções: Files (caminhos reais), Steps (cada etapa pequena o suficiente para verificar), Verify (comandos que existem neste projeto), Risks e Not doing, que nunca fica vazio.
  • Uma verificação, linha por linha: cada arquivo existe, cada nome está escrito como no código, todos os chamadores estão cobertos, o comando de verificação roda, as regras e decisões do projeto são respeitadas. Cada linha termina como OK, FIXED ou OPEN.
  • Pare ou continue: uma pergunta OPEN, uma decisão revertida ou dados excluídos fazem com que pare e pergunte a você. Caso contrário, executa o plano e relata.

No Plan Mode, use ambos: peça o plano no formato da plan-check e sua verificação antes de aprovar.

O que executamos e o que os agentes fizeram

Cada skill foi executada em 29 de novembro de 2026 em um repositório descartável criado para ela, com a skill instalada como skill de projeto. Um pequeno repositório Python: format_price em src/prices.py, chamado por cart_total e receipt_line, com testes executados por 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.

Duas execuções. Ambas invocaram plan-check, leram os arquivos e seus chamadores, chamaram current_decisions do Caprock (uma execução teve a permissão negada e informou isso) e depois adicionaram currency="USD" com um ValueError para códigos desconhecidos e um novo tests/test_prices.py. make test passou, 7 de 7. O relatório final listou o que não alterou: cart_total e receipt_line ainda exibem dólares, e os valores negativos já eram formatados incorretamente (-5 resultava em $-1.95) e não foram alterados.

Codex (0.163.0, codex exec)

The same prompt.

Leu .agents/skills/plan-check/SKILL.md, escreveu o plano nas cinco seções da skill (sua chamada de current_decisions falhou), conferiu com o código (ambos os chamadores dependem do padrão USD; make -n test confirmou o comando de verificação) e depois editou. Seu relatório (sem as linhas em branco e a última frase):

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.

Agentes em que foi testada

  • Claude Code: testado em 29 de novembro de 2026 com claude -p --model sonnet, com a skill instalada como skill de projeto em .claude/skills/.
  • Codex: testado em 29 de novembro de 2026 com Codex 0.163.0 (codex exec), a skill em .agents/skills/.
  • OpenCode e Cursor: não testado. A skill contém instruções simples no formato aberto Agent Skills, mas nenhuma execução em qualquer um dos dois a verificou.

Limites

  • Em um agente sem Plan Mode, nada impõe “nenhuma edição ainda”: a etapa de parar ou continuar da skill é uma instrução, não uma opção de configuração.
  • A verificação depende da qualidade das buscas do agente: um chamador acessado por reflexão ou por uma string pode passar despercebido.
  • Para uma correção de uma linha, ela diz que não é necessário um plano e pula a própria execução.

Com e sem Caprock

Quando o servidor MCP do Caprock está conectado, a skill chama current_decisions para encontrar decisões anteriores que a mudança deve respeitar. Sem ele, busca registros de decisões e mensagens de commits recentes nos mesmos arquivos. Caprock é o app gratuito e open source que registra cada sessão de agente de programação no seu computador; nada mais na skill precisa dele.

Obtenha o Caprock →

O SKILL.md completo

O arquivo como está em dspv/skills na revisão dfce799. Para instalá-lo manualmente, salve como .claude/skills/plan-check/SKILL.md para Claude Code ou .agents/skills/plan-check/SKILL.md para Codex, no seu projeto.

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.

Perguntas sobre a skill plan-check

Como ativo o Plan Mode do Claude Code?
Pressione `Shift+Tab` até a barra de status mostrar Plan Mode, use o prefixo `/plan` em um prompt ou inicie com `claude --permission-mode plan`. Para torná-lo o padrão, defina `"permissions": { "defaultMode": "plan" }` em `.claude/settings.json`.
O que a skill plan-check acrescenta ao Plan Mode?
O conteúdo e a verificação: um plano em cinco seções fixas, depois cada linha confirmada no código com uma chamada de ferramenta antes da sua aprovação, com as linhas erradas corrigidas e as perguntas em aberto feitas.
Uma skill de verificação de plano funciona no Codex?
Sim. A etapa de parar ou continuar da skill é a condição para prosseguir. O Codex 0.163.0 a seguiu no teste de 29 de novembro de 2026: planejar, conferir e depois editar.
Ela vai planejar a correção de um erro de digitação?
Não. Para uma correção de uma linha que você já localizou, um erro de digitação ou uma pergunta, ela diz em uma linha que não é necessário um plano e explica o motivo.

Fontes

O app em si está em inglês.