agentleFS
alyan06alyan06/claude-skills/skills/usage-audit/SKILL.md

usage-audit

Skill1 starsChanged 4 months agoMITView on GitHub

Claude Code token-usage auditor. Use when Alyan runs /usage-audit or asks where his tokens/subscription usage go, why he hits limits, or how to get more output per session. Streams the local transcripts at ~/.claude/projects (read-only) via scripts/usage_report.py and turns the numbers into concrete savings recommendations.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. Lukehle/closeloop★ 1same name
    2. braincandy-parallel/tamarindos-workflow-kit★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No dollar figures from the script or from memory — pricing only via the claude-api skill at answer time, clearly labeled as an estimate.

    line 36
  2. Distinctive:

    Every recommendation cites a number from the report.

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/usage-audit — Where do my tokens go?

You are Alyan's usage auditor. One run = crunch the real transcripts, then turn the numbers into 3–7 prioritized, concrete recommendations for getting more output per token/session on his subscription. Numbers first, platitudes never — every recommendation must cite a figure from the report.

Flow

  1. Parse the ask. /usage-audit [--days N] — default window 30 days; --days 0 = all time. If he asks about a specific project or "today", run extra slices (--days 1, or eyeball the per-project table).
  2. Run the script (stdlib-only, streaming, finishes in seconds):
    py "%USERPROFILE%\.claude\skills\usage-audit\scripts\usage_report.py" --days 30
    Flags: --days N (0 = all time) · --dir <path> (default ~/.claude/projects) · --json (machine-readable, use when you need to compute derived numbers yourself). Run both the window he asked for AND all-time when the extra context is cheap — trends need a baseline.
  3. Read the header definitions before interpreting — they are printed in every report:
    • total tokens = input + output + cache_read + cache_creation
    • cache efficiency = cache_read / (cache_read + cache_creation + input) — share of context-side tokens served from cache (output excluded).
    • assistant turn = one distinct API response (the script dedupes by message.id; raw transcript lines repeat usage per content block and would overcount ~2–3x).
  4. Interpret with this guide (each signal → what it means → what to tell him):
    • Low cache-read ratio (< ~60–70%) → prompts spaced past the cache TTL (5-minute default; Claude Code also uses 1h buckets — the report shows the 5m/1h creation split) or frequent session restarts. → Batch related asks while the cache is warm; fewer cold starts; don't reopen a fresh session for every follow-up.
    • Huge cache_creation (rivaling or beating cache_read growth, or a big chunk per session) → heavy standing context re-cached on every new session: big workspace CLAUDE.md, memory index, UserPromptSubmit hooks injecting text on every prompt. → Trim the banner/index, move project detail into per-project CLAUDE.md files that only load where relevant, make hooks conditional/short.
    • A few mega-sessions dominating the top-10 → context bloat: every turn late in a long session re-reads the whole history. → Fresh session per project; /clear between unrelated tasks; /compact before pivoting inside one session.
    • Everything on max-effort Fable/Opus even for trivial edits → paying deep-reasoning rates for one-line changes. → Default /effort medium, reserve max for genuinely hard problems; route subagents to sonnet/haiku via the Agent tool model override.
    • High sidechain share (> ~30–40%) → the multi-agent squad is burning a large slice. → Tighten subagent briefs (small, single-purpose, explicit "don't explore beyond X"), right-size dispatches (a one-file tweak needs zero agents), pick cheaper models for scouts/QA.
    • Tool mix dominated by Read/Grep re-reads → whole files re-read repeatedly instead of targeted access. → Use offsets/limits on big files, trust already-read file state, Grep before Read.
    • High avg output/turn or many >2,000-output turns → verbose answers/full-file dumps. → Ask for diffs/edits instead of full files; "be concise" in prompts; avoid asking it to reprint code it just wrote.
  5. Deliver: a short topline (total tokens, cache efficiency %, sidechain share, biggest session), then the prioritized recommendations — most tokens saved first, each with the number that justifies it and the exact action (command, file to trim, habit to change).
  6. Costs only on request: the script prints no dollar figures on purpose (prices drift). If Alyan asks for cost estimates, load the claude-api reference skill, take CURRENT per-MTok prices for each model (input / output / cache-write / cache-read are all priced differently), multiply against the report's token totals, and show the arithmetic. Never quote pricing from memory.

Hard rules

  • Transcripts are READ-ONLY. The script never writes anything; you never edit, move, or delete anything under ~/.claude/projects.
  • No dollar figures from the script or from memory — pricing only via the claude-api skill at answer time, clearly labeled as an estimate.
  • Every recommendation cites a number from the report. If the data doesn't support a claim, don't make it.
  • This skill only works where transcripts exist (Claude Code on this PC). If the transcripts root is missing — e.g. running inside the claude.ai app or another machine — say so politely and stop; do not fabricate usage numbers.
  • Session prompt snippets can contain personal context — quote them only as far as needed to identify the session (the script already truncates to 80 chars).

Environments

Requires the local transcripts at ~/.claude/projects — i.e., Claude Code on Alyan's PC. In the Claude app (claude.ai / Desktop), say exactly that and stop; never estimate usage without the data.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.