Skip to content
Back to skills

Cost Audit

ASecurity

Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions

  • 10 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added June 1, 2026
ai-agentsgobashnode

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill cost-audit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cost Audit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cost Audit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-cost-audit/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-cost-audit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cost-audit
description: Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions
user-invocable: true
allowed-tools: Bash(claude*), Read, Grep
effort: low
---

## Goal

Make it visible where the tokens in this session actually went. Not guesses — evidence. Output: "do these 3 things next time and you save ~X%."

## Step 1 — Capture current cost

```bash
/cost
```

Note the output: total tokens, input/output split, cache hit rate, total $.

## Step 2 — Find the leaks

Scan the transcript for these signals:

| Signal | How to detect it | Why it wastes tokens |
|---|---|---|
| Unnecessary file reads | `Read` calls touching `node_modules/`, `dist/`, `*.lock`, `coverage/` | Missing `.claudeignore` |
| Re-reading the same file | Same path appears in multiple `Read` calls | Context lost — `/compact` should have happened earlier |
| Reading entire large files | `Read` without `limit` on files >500 lines | Should have used `offset`/`limit` or `Grep` |
| Bash + grep/cat/find | `Bash` calls to `grep`, `cat`, `find`, `ls -R` | Dedicated tools (`Grep`/`Glob`/`Read`) are cheaper and more precise |
| Vague prompt → many tool calls | Single-word asks ("improve", "fix", "look") followed by 5+ tool calls | Prompt wasn't specific |
| Repeated onboarding research | Same concept re-discovered across sessions | Belongs in `CLAUDE.md` |

## Step 3 — Report

Give the user a report in this shape:

```
## Session summary
- Total: <tokens> (<$>)
- Cache hit: <%>

## Top 3 leaks
1. [Evidence]: X files under src/components/ were read in full; ~Y tokens combined
   Fix: add to .claudeignore → <lines>
   Estimated savings: ~Z%

2. ...

3. ...

## Action list
- [ ] Create .claudeignore with <lines>
- [ ] Add a "<topic>" section to CLAUDE.md
- [ ] Use `/compact <hint>` earlier in long sessions
```

## Step 4 — Optional auto-fixes

If the user approves:
- Create `.claudeignore` if missing, add the detected paths
- Create a `CLAUDE.md` scaffold if missing, seed it with the repeated-research topics
- Suggest a specific `/compact` hint phrase for this project

## Rules

- **No guessing** — only report what's in the transcript
- **Always a number** — not "a lot", but "12,400 tokens"
- **Action-oriented** — every finding ends with a concrete command or edit
- **Keep it short** — 3 top leaks is plenty; skip the long tail

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…