By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A developer asks for one field rename. Claude Code returns 1,140 changed lines across 61 files. The test suite passes. The reviewer has eleven meetings that day and approves the pull request in four minutes.
Two weeks later a partner integration breaks. The renamed field was public. Nothing in the repository said so. The conventions lived in the team's heads, the task was asked in a chat instead of a plan, and nobody compared the 61 files with the three the task meant.
This is scenario 2 of the six published scenarios. Production goal: a repository where Claude Code produces the change a team can review, using CLAUDE.md for standing rules, a slash command for a repeated procedure, and plan mode before a broad change. Hard constraint: every change is small enough to review and follows conventions that exist in the repository.
Two terms first. CLAUDE.md is a file Claude Code loads as standing instructions, with one file per directory level. Plan mode is a read-only mode in which the model proposes a plan and changes nothing until you approve it.
The same repository serves three kinds of request, and each one takes a different path. The mode follows the size and the ambiguity of the change, not the seniority of the person asking.
Now walk the rename that started this lesson.
The developer types the request into a planning session, not a chat: rename invoice_total to total_cents across billing.
Plan mode reads the repository and returns a list of 19 files, with the three public ones marked.
The reviewer deletes 16 files from the list, because this change is internal, and approves the remaining three.
Execution edits the three approved files. The diff is 41 lines.
The reviewer runs git diff --name-only, compares it with the approved list, reads the hunks, and runs the suite.
Compare that with the four-minute review. The work is not slower. The expensive step, reading 61 files, never happened.
A rule that is always true for a folder belongs in the CLAUDE.md for that folder. It loads without anyone asking, and it is the reason the model knows that amount_cents is an integer.
# billing/CLAUDE.md
## Commands
- Run `pytest -q tests/billing` before you report a change as done.
- Run `make lint` for the style gate.
## Rules
- `amount_cents` is an integer. It is never a float and never a string.
- A public field name is an API contract. Rename one only with a migration and a release note.
- Money movement goes through `billing/ledger.py`. Do not write to the ledger tables directly.
## Never
- Edit anything under `migrations/` by hand.
- Change a pinned dependency version.A rule that describes a sequence belongs in a slash command. A slash command is a markdown file in .claude/commands/ that you invoke by name, and its frontmatter carries its tool limit.
---
description: Rename one field across the repository and report every touched file
argument-hint: [old_name] [new_name]
allowed-tools: Read, Grep, Glob, Edit
---
Rename `$1` to `$2` across this repository.
1. Grep for `$1` and list every matching path. Edit nothing yet.
2. Report that list and stop. Wait for approval.
3. Edit only the files in the approved list.
4. Run `pytest -q` and report the exit code.
5. Return the changed paths, one per line.
Do not rename anything in `migrations/`.| A rule about | Where it belongs | Why there |
|---|---|---|
| A command to run before a change is done | The nearest CLAUDE.md | Always loaded, and it costs nothing at the moment of use |
| A procedure with a fixed shape | A slash command | Invoked on purpose, with its own tool limit |
| A decision that needs judgement | Plan mode | A person approves before anything is written |
| A fact that applies to every request | The root CLAUDE.md | Loaded everywhere, so keep it short |
| The decision | The best answer | What it costs you |
|---|---|---|
| Plan mode or direct execution for a broad change | Plan mode, because a rejected plan is cheap and read-only | One extra approval round, and the plan is a snapshot that can go stale |
| Where the standing convention lives | The narrowest CLAUDE.md that always covers those files | A root file grows and competes for attention on every turn |
The second decision is where teams drift. A 400-line root CLAUDE.md feels thorough and behaves like background noise. A 12-line billing/CLAUDE.md loads only when billing work begins, so every line of it is read closely.
The agent finishes the rename and also reformats two unrelated modules, because they looked inconsistent. The suite passes. The reviewer sees 400 changed lines instead of 41 and approves them as part of the same job.
The control is the scope check, and it must be mechanical: git diff --name-only compared with the approved list. Any file outside the list comes out of the change, and the request is re-asked with the boundary stated.
git diff --name-only with the files you expected. If they differ, write the boundary sentence you should have put in the request.Key takeaways
Size and ambiguity choose the mode; seniority does not.
Plan mode is cheap because a rejected plan changes nothing on disk.
Put standing conventions in the nearest CLAUDE.md and procedures in a slash command.
A scope check compares changed files with the intended set and fails closed.
A passing test suite says the code runs, not that the change was requested.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.