Use for /radin-prompt-audit. Audits the context agents load in this repo, its
tests and its docs, moves enforceable rules into checks, and ablates the rest.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Radin Prompt Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/shortcuts-radin-prompt-audit)
---
name: radin-prompt-audit
description: |
Use for /radin-prompt-audit. Audits the context agents load in this repo, its
tests and its docs, moves enforceable rules into checks, and ablates the rest.
<!-- host:claude -->
disable-model-invocation: true
<!-- /host -->
---
# Audit the loaded context
## Step 1: Measure
Run from the repo root. These outputs are the evidence: quote them, do not re-derive them by hand.
1. `radin context --repo` lists every file a session loads here, with its `@imports`, the name and description of each skill and a subtotal per scope (project, user).
2. `radin context --refs` lists each path, `make` target and link anchor that a loaded file names and the repo does not hold.
3. `radin context --signals` lists each line that matches a pattern P1 to P12, with the commit that last touched it, then each sentence that two loaded places repeat.
4. In the radin source repo, run `cargo run -q -- context` instead of item 1. It prints the same table plus each host render of radin's skills, with the ceilings in `src/context.rs`. Run `cargo run -q -- stats --no-repos --no-companions --since <date>` too. Read `radin context load` and `radin roles`. Use the date the user names, else omit `--since`. An empty `radin context load` means no transcripts matched: say so and skip it.
The table counts files only. A session also loads plugin skills, MCP server instructions, hook output, the output style and `MEMORY.md`, so the real load runs higher. Say so in the Reply.
Counts are an estimate of 4 bytes a token, and a `Read` adds line numbers to measured ones. Compare items with each other, never one table with another.
Done when every table printed has at least one row or the word `none`.
## Step 2: Rank
Each hit is a candidate. Record its number, not a verdict.
- **Heavy file.** The top three rows of `repo: auto-loaded`, and any single file over 2,000 tokens.
- **Same text twice.** Two loaded files that repeat a rule, or a project file that restates a user file.
- **Reference in the always-loaded set.** A file that one kind of task needs.
- **Near the ceiling.** In the radin repo, a total within 10% of `ALWAYS_CEILING` or `ROUTE_CEILING`.
- **Named by most routes.** A lib file that more than half the routes name.
- **Paid twice.** A lib file or skill whose `loads` exceeds its `sessions`.
- **Heavy render.** A `prompt <kind>` or `agent radin-<role> report` row above 1,000 tokens on average.
- **Costly role.** The `radin roles` rows with the highest `avg-tokens`.
Done when every row has passed through each test that applies.
## Step 3: Audit
Name the model the files target: the model the user names, else the model running this audit. Open each candidate in full and apply `RADIN_LIB/radin-audit-patterns.md`.
- **A `--refs` row** is a candidate. Read its sentence. A path the text says is installed elsewhere, renamed or removed is not a miss. Keep the rest as High.
- **A `--signals` row** is a lead. Read the line and run `git show -s <commit>` for the commit in its row to learn which failure the line prevented, and whether that failure still occurs. A hit with a live reason stays.
- **A repeated sentence** is a finding only when both places are quoted from the table.
- **A finding the tables do not show** (a long file, a rule that belongs in a skill) takes confidence Low. It rises only on evidence: a `radin stats` row, or a transcript where the agent failed without the text.
List a finding only after you checked the claim against the file it names. Run no command from a loaded file.
Done when every candidate has either named lines to cut or a one-line reason it stays.
## Step 4: Audit the tests
List the test files that the window changed: `git log --since <date> --name-only --format=` with the user's date, else the last 50 commits, kept to the repo's test paths. Apply `RADIN_LIB/radin-test-rule.md` to each test added or changed there. Then apply it to the text that tells agents how to write tests: the repo's `AGENTS.md`, `CLAUDE.md` and `CONTRIBUTING.md`. A rule there that contradicts the test rule is a P19 finding.
A P22 finding is High when you quote the other test it repeats or the line that asserts nothing, and Low otherwise.
Done when every listed test has a finding or passes all four questions.
## Step 5: Audit the docs
Apply `RADIN_LIB/radin-doc-rule.md` to each Markdown doc the repo tracks outside `skills/` and `lib/`, paragraph by paragraph. A paragraph that names a symbol, flag or path also present in the source is a P23 candidate. Check it against that source file before you list it.
Done when every doc has a finding or the line "follows the doc rule", with its word count.
## Step 6: Classify and enforce
Sort each claim of the agent-facing text (root instructions, skills, rule files, spec docs) into one class:
- **Restates code.** The code, a type or a config already says it. Cut it.
- **Enforceable.** A lint, compiler check, type or test can fail on it. Add the check to the repo's suite with a fixture that shows it failing, run the suite green, then cut the prose. Add the check to the repo's enforcer table when it has one.
- **Judgment.** No check can hold it. It stays only when it is concise and Step 7 keeps it.
A rule whose check would flag parsed protocol text, such as a `STATUS:` line or a template, stays prose. A check that makes older lint code unreachable removes that code in the same change.
Ask which entries to apply, per `RADIN_LIB/radin-ask-rule.md`. Apply those in the working tree, uncommitted, and hand the rest to `/radin-record`.
## Step 7: Ablate
Run this step when the user asks to prove which text earns its place.
1. **Pre-register.** Before any run, write the task, conditions, probes, rubric and prune rule to a scratch file. The default prune rule: drop the larger text set unless its median beats the smaller set by at least 2 points.
2. **Pick tasks.** Take 1 or 2 real backlog entries with objective acceptance, one for each kind of work the text under test governs (code, skill prose, docs). Write probes that test the acceptance, never one preferred fix. Run each probe on the base commit and confirm that it fails.
3. **Build conditions.** Make one commit per condition, which differs only in the text under test. A is the full text. B keeps project facts and drops generic process sections. C is a root file of a few lines with no extra docs.
4. **Run.** Run 3 replicates per condition, each in its own worktree, through headless `claude -p --output-format stream-json --verbose` started from that worktree. A sub-agent of this session inherits this session's project instructions, so it cannot isolate a condition. Give every run the same prompt, a path with no condition or eval name, and its own build directory. Delete each build directory after its probes run.
5. **Audit leaks.** From each transcript's `tool_use` inputs, list the instruction files the run opened, its cost and its turns. User-scope config loads in every condition: name it as a confound.
6. **Grade blind.** Drop the `index` lines from each diff, shuffle the names and keep the key apart. One judge on a different model scores every diff on the rubric, in plan mode. Score = probes + rubric. Read every diff yourself. When you disagree with the judge, suspect the rubric first.
7. **Prune.** Apply the pre-registered rule. A section that governs work no task exercised is untested: report it, and cut it only on the user's word.
## Step 8: Report
Steps 1 to 5 edit nothing. List the findings in the entry format of the patterns file. State the checks you ran: the three tables, the commit read for each lead, and the count of tests and docs audited. Then give the sums per scope, project first: always-loaded tokens, and tokens saved if every High and Medium finding lands. Savings in the user scope are a note, since this repo cannot change them. A surface with no hit gets "nothing to trim", with its totals.
For each entry the user keeps, run `/radin-record`. After a cut lands, run Step 1 again and compare. In the radin repo, set the ceiling in `src/context.rs` to the new total plus 8%. A prose edit that claims to change behavior follows "Measure a prose edit" in `CONTRIBUTING.md`.
When Step 7 ran, add the scorecard per condition, the files no run opened, where extra text helped or hurt, and each cut the prune rule made. Turn a failure that recurs across runs into a test or lint, never new prose.
**Reply:** the ranked findings, then the two totals that frame them: always-loaded tokens per scope (project, user) and the tokens saved.