rightsize is a Claude Code skill I built to audit the context Claude loads: CLAUDE.md, AGENTS.md, rules, skills and subagents. It asks one question of every line: what concrete mistake would Claude make in this repo without this line?
Most instruction files still carry habits from older models: ALWAYS and NEVER in capitals, pasted code, deploy runbooks, the same rule in three places. Claude reads all of it on every turn. This post follows one real run, line by line.
The run
The repository's test fixture is acme-shop: a 125-line CLAUDE.md for a Laravel API, two rules files, a review skill and a subagent. On 17 November 2026 rightsize 0.1.3 ran on a copy of it in Claude Code, step by step as its skill says: scan, read every file and the code, classify each line, propose a diff, apply it, compare.
One thing was not like a normal run. Normally nothing changes until you say which groups of the diff to apply. Here there was no one to ask, so every group was applied as recommended, the way the README's example and the test for applying changes do it.
The scanner's before-and-after:
Before → after (snapshot taken 2026-11-16T19:29:10+00:00)
every session ~1,366 → ~520 tokens (-62%)
on demand ~223 → ~438 tokens (+96%)
findings 22 warn, 11 info → 0 warn, 4 info
CLAUDE.md itself went from 125 lines to 10, and from about 1,224 tokens to about 297.
The tokens are estimates: characters divided by 2.7, calibrated on 54 plugin skills against claude plugin details.
The on-demand number went up on purpose. The deploy runbook and the review checklist now load only when they are used.
Deleted: what Claude can read or does anyway
Most lines went because the question had no answer.
- The persona and "Think step by step." Scaffolding written for older models; current models do this unprompted.
- The tech stack.
composer.jsonandpackage.jsonalready say it. MySQL 8, which no manifest shows, stayed in the overview line. - The directory tree. Claude can list the repo itself. This tree also listed
app/Services/androutes/web.php, which do not exist. - Style rules the code already follows. camelCase and PascalCase, and "Follow PSR-12". "ALWAYS use Form Requests
for validation" went too: the controller and
app/Http/Requestsshow it, and the review skill checks it. - "Double-check your work" and "Be thorough and careful."
- The useful commands. Two are in the manifests. The other two,
composer run analyseandnpm run lint, have no script. - The architecture pointer.
docs/architecture.mdandapp/Services/PaymentService.phpdo not exist. - The dated notes. One of them, that the queue driver is now Redis, stayed as a fact in the overview line.
"IMPORTANT: ALWAYS write tests for every change." was there twice. It now lives once, in .claude/rules/testing.md, as
"Add or update a Pest test with every behavior change."
A stale path is worse than a long one. As the scanner puts it, a line that names a missing file sends Claude looking for it.
Moved: long things used sometimes
- The ten-step deploy runbook became a manual-only skill,
.claude/skills/deploy/SKILL.md, withdisable-model-invocation: true, so only/deploystarts it. - The twelve-item review checklist merged into the existing review skill. The items it lacked joined its steps, and "You MUST follow every step below. NEVER skip a step." was dropped. The skill's description, "Review code", now says what it checks and when to use it.
- The pasted example controller, 28 lines, became one: "New controllers follow
app/Http/Controllers/ProductController.php." The pasted copy had already drifted. The real controller returnsProductResource; the example returnedresponse()->json().
Enforced: rules that must always hold
Three lines were about things that must never happen. Instead of louder prose, they became settings, each with one plain line in CLAUDE.md saying why:
migrate:freshagainst production is blocked by a hook,.claude/hooks/block-destructive.py, which refusesmigrate:fresh,migrate:resetanddb:wipeunless--env=testing. It was tested before it was offered: it blocksphp artisan migrate:freshandphp artisan db:wipe --force, and lets through agrepformigrate:fresh,migrate:fresh --env=testing,migrate --forceand a commit message that mentions it..envhas deny rules,Read(./.env)andRead(./.env.*).config/has ask rules,Edit(./config/**)andWrite(./config/**).
Kept, and rewritten
The money line stayed as it was written: "Prices are stored as integers in cents in the amount column; never use
floats for money, because rounding errors break invoice totals." It names a mistake Claude could make here and what
it would cost.
One pair of lines contradicted each other. CLAUDE.md said "NEVER add comments to code." The testing rules said "Add comments to explain non-obvious test setup." Both were scoped instead of one winning: "Match the comment density of the surrounding code; most files here have none." and "In tests, a one-line comment on non-obvious setup is welcome."
This is the whole CLAUDE.md after the run:
# Acme Shop API
Acme Shop is the backend for our online store. It serves a JSON API to the Flutter app and the admin panel. It runs on MySQL 8, and the queue driver is Redis.
- Prices are stored as integers in cents in the `amount` column; never use floats for money, because rounding errors break invoice totals.
- Match the comment density of the surrounding code; most files here have none.
- New controllers follow `app/Http/Controllers/ProductController.php`.
- `php artisan migrate:fresh`, `migrate:reset` and `db:wipe` are blocked by a hook, because they drop every table; reset the test database with `--env=testing`.
- `.env` holds secrets and Claude can't read it (a deny rule); ask the user for any value you need from it.
- Edits to `config/` ask for the user's OK first (an ask rule).
What a person still has to answer
The run ended with questions the repo could not answer. Why does config/ need asking? The ask rule holds either way,
but a reason would let the line say why. Is PHPStan used at all, since larastan is installed and there is no analyse
script? And ProductController uses App\Http\Resources\ProductResource, which does not exist in the repo.
The skill also suggests running one or two real tasks with claude -p against the old and the new context. That check
was offered and not run, so the 62% is a measure of size, not of behaviour. For live numbers, /context in Claude Code
is the source.
The question did the work
Every cut here came from the same question. A line stays when it prevents a mistake Claude would make in this repo, and says why. A rule that must always hold becomes a hook or a permission rule. Everything else is either somewhere Claude can read it, or nowhere it needs to be.
rightsize's code is public at github.com/mrramdn/rightsize. The project page is mrramdn.com/en/rightsize.