Measure your Claude Code session history for where your config costs output quality or efficiency, and write a local report of ranked proposals. In a repo that has opted in, open the best of them as pull requests.
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 Ccc Usage Review?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/edjchapman-ccc-usage-review)
---
name: ccc-usage-review
description: Measure your Claude Code session history for where your config costs output quality or efficiency, and write a local report of ranked proposals. In a repo that has opted in, open the best of them as pull requests.
argument-hint: "[--days <n>] [--until <YYYY-MM-DD>]"
disable-model-invocation: true
---
Run a **usage review**: measure this machine's session history across every project, then write a dated report of ranked **proposals** — one suggested config change each, carrying the evidence for it.
The review is **report-only** unless the repo it runs in has opted in. Its single output is then one file under `~/.claude/usage-review/`; every config file, branch and pull request stays as it was. In an **opted-in repo** the best proposals also become pull requests, under the rules in [Pull-request mode](#pull-request-mode).
## Aggregates only
The evidence is private: the transcripts span every project on the machine. Everything you write — the report and your reply — is built from **aggregates**: the counts, totals, and tool, hook and model names that `signals.py` prints. `signals.py` is the only reader of the transcripts, and what it prints is the whole vocabulary of the report. Describe a pattern by its row in the table ("the slowest Stop hook", "Bash calls denied by a permission rule"), which is always enough to state a proposal.
## Mode
Before step 1, run `python3 "${CLAUDE_SKILL_DIR}/proposals.py" marker`. It looks for a committed `.claude/usage-review` file in the current repo.
| Exit | Meaning | What to do |
| ---- | ---------------------------------------------------------------------- | -------------------------------------------------------------- |
| 3 | The repo has not opted in, or this is not a repo. | Run steps 1 to 6 and stop. |
| 0 | Opted in. It prints `root`, `evidence`, `validation` and `off_limits`. | Run every step, under [Pull-request mode](#pull-request-mode). |
| 1 | The marker is committed but cannot be read. | Tell the user the error, then run steps 1 to 6 and stop. |
When the marker's `evidence` is `this-repo`, add `--repo "<root>"` to every `signals.py` command in this skill, so the review rests on the sessions that ran in this repo. Otherwise run them as written.
## Pull-request mode
Only in an opted-in repo, and only steps 7 to 12. `proposals.py` decides what may be published and builds it; a refusal from it is final for this run, so record its reason and move on.
These rules hold whatever the marker says:
- **At most three pull requests per run**, one change each, each on its own branch off the default branch. Every other proposal stays in the report. Opening none is a valid result.
- **Aggregates only.** `proposals.py` names each branch and writes each pull-request body from the signal figures. The only words you publish are the title, which is also the whole commit message: it says what the change sets, adds or removes and nothing about the sessions behind it.
- **The change itself is published too.** A change that would name an MCP server or tool (an allow rule for one, say), or anything else known only from the session history, stays in the report: the diff would publish what the body leaves out.
- **One confirmation per run**, before anything is pushed.
- **Validation passes before a pull request opens.**
- **The clone keeps its branch.** All branch work happens in the worktree that `proposals.py worktree` creates, because in a global install `~/.claude` points at this clone and switching its branch changes the live config.
- **Never merge** a proposal and never turn on auto-merge. The repo's owner merges or closes it.
- **A rejection stands.** A closed, unmerged proposal is not made again unless its signal is at least 20% worse than the baseline that pull request recorded.
- **A merged proposal is judged once**, by the first run whose whole window falls after the merge. The verdict is a comment on that pull request, built by `proposals.py` from the signal figures. Only `worse` leads anywhere: to a revert proposal, which the owner merges or closes like any other.
- **Off-limits:** the marker, this skill, and every path the marker lists.
## Steps
1. **Measure.** Run `python3 "${CLAUDE_SKILL_DIR}/signals.py" measure $ARGUMENTS`. It prints the signal table for the window (30 days ending yesterday unless the arguments say otherwise). If the table shows zero sessions, say so and stop.
2. **Count corrections.** Run `python3 "${CLAUDE_SKILL_DIR}/signals.py" sample --out ~/.claude/usage-review/corrections-sample.jsonl $ARGUMENTS`. It writes up to 30 randomly drawn sessions, one per line, to a file only the user can read; each human turn is a `prompt` with `reply_before`, the end of the reply it answers. Dispatch a subagent to read that file and return two numbers and nothing else: sessions read, and sessions with at least one **correction** — a prompt that redirects work its `reply_before` got wrong (a rejection, a restated instruction, "no, I meant…"), as distinct from a new request or a refinement of work that was right. Then delete the file. The step is done when you hold the two numbers and the file is gone.
3. **Collect patterns.** Go through every section of the table, and the corrections count. A **pattern** is a figure showing a cost that a config change could reduce. For each one record its **signal**, its **baseline** (the figure itself, over the window), and the number of sessions behind it. The step is done when every section has been either mined or judged clean.
4. **Turn patterns into proposals.** A proposal is exactly one change to a config — a settings key, a permission rule, a hook, a skill, an instruction file, an enabled plugin or MCP server — that names the signal it expects to move. Apply these rules to every pattern:
- **Evidence bar.** The table states the bar. A pattern seen in fewer sessions than that is **listed, not proposed**.
- **Docs.** A proposal that sets a settings key, wires a hook event or uses a frontmatter field cites the current Claude Code reference page that confirms it (fetch it from `https://code.claude.com/docs/`). One you cannot confirm is listed as unconfirmed.
- **Ranking.** Order proposals by estimated effect on their signal, weighted by the share of the window's sessions affected. A tie goes to the smaller change.
5. **Write the report** to `~/.claude/usage-review/<today's date, YYYY-MM-DD>.md`, in the shape below. A second run on the same day replaces the file.
6. **Reply** with the ranked proposals and the report's path. This is the last step, except in pull-request mode: there, hold the reply until step 12 is done and add the verdicts and pull requests to it.
7. **Write the public report.** (Steps 7 to 12 are pull-request mode only.) Run `gh repo view --json nameWithOwner --jq .nameWithOwner` once: that is the repo this run reads and writes pull requests in, written `<repo>` below. Then run `python3 "${CLAUDE_SKILL_DIR}/signals.py" measure --public --format json $ARGUMENTS > ~/.claude/usage-review/public-report.json`. It holds the figures of step 1 in the form that may be published: every MCP tool is counted in one `mcp tools` row, and a hook is named by its event and matcher without its script, since those names can say which services the user connects or name another project's files. `proposals.py` accepts no other report. From here on a proposal's signal is the path of keys to one number in that file, each key passed as one quoted argument: `--signal efficiency tool_failures by_tool "mcp tools" failed`.
8. **Judge the merged proposals.** Run `gh pr list --repo "<repo>" --label proposal --label usage-review --state merged --limit 1000 --json number,mergedAt,body,comments,labels,mergeCommit | python3 "${CLAUDE_SKILL_DIR}/proposals.py" verdicts --report ~/.claude/usage-review/public-report.json --out ~/.claude/usage-review/verdicts`. It prints one entry per merged proposal. An entry with a `verdict` (`improved`, `no change`, `worse` or `inconclusive`) has a `comment_file`, the comment to post in step 12; an entry without one carries a `note` saying why it is not judged this run. Post nothing yet.
Each `worse` verdict becomes a **revert proposal**, ranked ahead of every other proposal in this run: its change is the revert of that entry's `merge_commit`, and its signal is that entry's `signal`. It takes one of the three places like any other proposal. A signal gets one proposal per run: when two `worse` verdicts name the same signal, only the later-merged change gets a revert proposal, and a signal with a revert proposal takes no other proposal. An entry whose `merge_commit` is null gets no revert proposal.
9. **Select up to three proposals**, taking them in rank order and stopping at three. A proposal is selected when all of these hold:
- **Its signal is a number in the public report.** Corrections are not measured by the script, so a proposal resting on them stays in the report.
- **Its file may be changed:** `python3 "${CLAUDE_SKILL_DIR}/proposals.py" target "<the file the change edits>"` exits 0 and prints the path to edit, relative to the repo. It refuses a file that is untracked, that resolves through a symlink to outside the repo, or that is off-limits. A revert proposal skips this test, because `check` in step 10 covers every file its commit touches.
- **It is not already decided:** `gh pr list --repo "<repo>" --label proposal --label usage-review --state all --limit 1000 --json number,state,mergedAt,body | python3 "${CLAUDE_SKILL_DIR}/proposals.py" status --report ~/.claude/usage-review/public-report.json --signal <path>` exits 0. It refuses a signal with an open proposal, a standing rejection, or too few sessions.
10. **Build each selected change in its own worktree.** The worktree is outside the session's working directory, so name it in every command (`git -C "<worktree>" …`, or `cd "<worktree>" && …` in the same command); a bare `git` or `gh` acts on the clone.
- Run `python3 "${CLAUDE_SKILL_DIR}/proposals.py" worktree --report ~/.claude/usage-review/public-report.json --signal <path>`. It prints two lines: the new worktree's path, then its new branch.
- Make the one change in the worktree, at the path step 9 printed. For a revert proposal, run `git -C "<worktree>" revert --no-commit <merge_commit>` instead, adding `-m 1` when git says the commit is a merge. A revert that does not apply cleanly is not opened: run `git -C "<worktree>" revert --abort` and discard it as below. Nor is one whose pull request was merged by rebase as several commits, because `merge_commit` is only the last of them.
- Run every `validation` command as `cd "<worktree>" && <command>`; each must exit 0. Fix a failure only inside the proposal's own change (regenerating a derived file counts).
- Commit everything: `git -C "<worktree>" add -A`, then `git -C "<worktree>" commit -m "<title>"`. The title follows the repo's commit convention and is the whole message.
- Run `python3 "${CLAUDE_SKILL_DIR}/proposals.py" check --worktree "<worktree>"`. It lists the branch and every path its commits change, and refuses the change if one is off-limits or anything is left uncommitted.
A change that cannot pass validation within its own scope is **failed validation**; one that `check` refuses is not opened either. Discard it with `git worktree remove --force "<worktree>"` and `git branch -D "<branch>"`, and leave the proposal in the report.
11. **Confirm once.** Show `<repo>`, the marker's `evidence`, every verdict about to be posted with the pull request it goes on, every pull request about to open — its title, the paths `check` listed, its signal and baseline — and every proposal that will not open, with the reason. Ask one question: post and open these in `<repo>`? Publish only what the user approves, and discard a declined change as in step 10.
12. **Post each approved verdict**, with `gh pr comment <number> --repo "<repo>" --body-file <comment_file>`. A verdict left unposted is judged again by the next run. Then **open each approved pull request:**
```bash
python3 "${CLAUDE_SKILL_DIR}/proposals.py" check --worktree "<worktree>" \
&& git -C "<worktree>" push origin "<branch>" \
&& python3 "${CLAUDE_SKILL_DIR}/proposals.py" body --report ~/.claude/usage-review/public-report.json --signal <path> > ~/.claude/usage-review/body.md \
&& gh pr create --repo "<repo>" --head "<branch>" --title "<title>" --body-file ~/.claude/usage-review/body.md --label proposal --label usage-review
```
If a label is missing, create it with `gh label create` and retry. If the second `check` or the push is refused, report its output and stop; never bypass a hook. Then run `git worktree remove "<worktree>"`, which leaves the branch for the pull request. When every pull request is open, delete `public-report.json`, `body.md` and the `verdicts` directory, and add the three sections below to the report.
## Signals
**Efficiency signals** measure cost directly; **quality proxies** stand in for output quality, which session history does not record.
| Signal | Kind | What a config can change |
| ---------------------------- | ---------- | ----------------------------------------------------------------------- |
| Context size per call | Efficiency | When compaction fires; what gets loaded mid-session |
| Compaction frequency | Efficiency | The compaction window, per model |
| Always-loaded context | Efficiency | Skill and agent listings, instruction files, enabled plugins, MCP tools |
| Permission prompts | Efficiency | Allow rules for what is approved every time |
| Hook latency | Efficiency | A slow hook's work, its matcher, or whether it runs at all |
| Failed or retried tool calls | Efficiency | An instruction or hook that prevents a recurring failure |
| Interruptions | Proxy | Behaviour the user keeps stopping |
| Corrections | Proxy | Instructions that are missing or being overridden |
| Denied tool calls | Proxy | Rules that block wanted work, or work that should not be attempted |
## Report shape
```markdown
# Usage review — <date>
<the signal table, verbatim>
## Corrections
<n> of <m> sampled sessions contained a correction.
## Proposals
### 1. <the change, in one line>
- **Change:** <what to set, add or remove, and in which config file>
- **Signal:** <one signal from the table above>
- **Baseline:** <the figure from the signal table>
- **Sessions:** <sessions behind the pattern> of <sessions in the window>
- **Expected effect:** <which way the signal should move, and roughly how far>
- **Docs:** <reference page URL, when the change sets a key, event or frontmatter field>
## Listed, not proposed
- <pattern> — <signal>, <baseline>, <n> sessions (<below the evidence bar | unconfirmed in the docs>)
```
In pull-request mode the report ends with three more sections:
```markdown
## Verdicts
- #<number> — <verdict> (<signal path>, baseline <figure>, now <figure>)
## Pull requests opened
- <title> — <URL> (<signal path>, baseline <figure>)
## Proposals not opened
- <the change, in one line> — <the reason: beyond the top three | failed validation | declined | what proposals.py printed>
```