claude-trim
Health Warn
- No license — Repository has no license file
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Pass
- Code scan — Scanned 4 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
This is a static analyzer for your local Claude Code setup. It scans your system to calculate token usage and identify conflicts between installed skills and MCP servers, helping you reduce context window bloat and save money.
Security Assessment
Overall Risk: Low
The code scan found no dangerous patterns, no hardcoded secrets, and the tool requests no elevated system permissions. The utility operates entirely offline and explicitly states that no API keys are required. Its primary function is reading local configuration files from the `~/.claude/` directory rather than executing arbitrary shell commands or transmitting data over the network. However, it is worth noting that the installation instructions pipe downloaded files directly into `tar` and move them to system directories, which is common practice but requires standard caution.
Quality Assessment
The project is actively maintained, with its most recent push occurring today. The automated scan flags a missing license, but this contradicts the README, which clearly displays an MIT license badge linking to a standard LICENSE file. As a very new and niche utility, it currently has low community visibility with only 6 GitHub stars. The documentation is excellent, providing clear use cases, straightforward installation options, and well-defined outputs for both interactive use and scripting.
Verdict
Safe to use — a straightforward, offline local tool with no dangerous code patterns, clear documentation, and strong privacy characteristics.
Audit your Claude Code token usage — see which skills eat your context budget and find conflicts before they cost you
claude-trim
Find out what Claude Code loads before you type a single word.
claude-trim is a static analyzer for Claude Code. It scans your ~/.claude/ directory, counts how many tokens every skill and MCP server costs at startup, flags skills that conflict with each other, and tells you exactly what to remove — and how much money that saves.

Why this exists
Every Claude Code session starts with a hidden tax. Before you write a single prompt, Claude loads the description of every skill you have installed. With a typical plugin setup that's 20–30k tokens per session — paid silently, every time.
Most of those tokens don't help you. Duplicate skills cover the same ground. Skills you installed months ago and forgot about run on every session. And when two skills give Claude contradictory instructions, neither works well.
With 55 skills installed:
Startup cost: 23,751 tokens (paid every session)
Peak cost: 140,391 tokens (if every skill body loads)
At Sonnet pricing ($3/M), 5 sessions/day, 22 working days:
→ ~$7.84/month in skill overhead alone
claude-trim makes this visible in 10 seconds, offline, no API key required.
Install
go install (recommended)
go install github.com/d0d012/claude-trim/cmd/claude-trim@latest
Make sure $GOPATH/bin (usually ~/go/bin) is on your $PATH:
export PATH="$HOME/go/bin:$PATH"
Download binary
Grab the binary for your platform from GitHub Releases:
# macOS (Apple Silicon)
curl -L https://github.com/d0d012/claude-trim/releases/latest/download/claude-trim_darwin_arm64.tar.gz | tar xz
mv claude-trim /usr/local/bin/
# macOS (Intel)
curl -L https://github.com/d0d012/claude-trim/releases/latest/download/claude-trim_darwin_amd64.tar.gz | tar xz
mv claude-trim /usr/local/bin/
# Linux (amd64)
curl -L https://github.com/d0d012/claude-trim/releases/latest/download/claude-trim_linux_amd64.tar.gz | tar xz
mv claude-trim /usr/local/bin/
Build from source
git clone https://github.com/d0d012/claude-trim.git
cd claude-trim
go build -o claude-trim ./cmd/claude-trim
Quick start
claude-trim scan
That's it. The interactive TUI opens immediately.
Press Tab to switch between the flamegraph and the conflict table. Use ↑/↓ or j/k to scroll. Press q to quit.
JSON output (for scripting)
claude-trim scan --json
{
"token_report": {
"system_base": 20000,
"total": 23751,
"peak_total": 140391,
"skills": [
{
"name": "skill-creator",
"tokens": 59,
"body_tokens": 7068,
"pct": 0.25
}
]
},
"conflict_report": {
"conflicts": []
},
"suggestions": [
"Remove 'skill-creator' to save ~7068 tokens when invoked (~$0.03/month if used daily)"
]
}
Scan a different directory
claude-trim scan --dir /path/to/other/.claude
Show low-severity conflicts too
claude-trim scan --verbose
What the numbers mean
The flamegraph shows two numbers per skill: startup / on-demand
| Column | What it is | When you pay it |
|---|---|---|
| startup | Description tokens | Every session, always |
| on-demand | Full body tokens | Only when the skill is invoked |
| peak% | Share of worst-case total | Reference — not a daily cost |
Claude Code loads only the description of each skill into the system prompt at startup. The full skill body is loaded on-demand when Claude calls the Skill tool. MCP server configs are always loaded.
This means the startup cost is what you pay guaranteed. The on-demand cost is what you pay if a skill actually runs.
Features
| Feature | Detail |
|---|---|
| Token flamegraph | Horizontal bar chart sorted by on-demand cost. Bars scaled relative to largest skill. Color = share of peak (red ≥10%, amber ≥5%, green <5%) |
| Conflict detection | Jaccard similarity on skill descriptions. High ≥60%, Medium ≥35%, Low ≥15% |
| False positive filtering | Skills from the same plugin are never flagged as conflicting — they're designed to work together |
| Accurate counting | Startup cost uses description tokens only. On-demand cost uses full body. MCP configs counted separately |
| JSON output | --json flag for piping into jq, dashboards, or CI |
| Fully offline | Uses tiktoken-go (cl100k_base approximation). No API calls, no keys |
| Fast | Single binary, scans 55+ skills in under a second |
How conflict detection works
- Extract keywords from each skill's
descriptionfield (lowercase, stopwords removed) - For each pair of skills from different plugins: compute Jaccard similarity
- Flag pairs above the threshold
Jaccard(A, B) = |keywords_A ∩ keywords_B| / |keywords_A ∪ keywords_B|
≥ 0.60 → High (likely redundant, remove one)
≥ 0.35 → Medium (significant overlap, worth reviewing)
≥ 0.15 → Low (minor overlap, shown with --verbose only)
Skills in the same plugin directory are skipped — they're intentionally related.
Note: Token counts are approximations. Claude uses a proprietary tokenizer;
claude-trimusescl100k_baseviatiktoken-go. Real counts may differ by a few percent.
What this tool does NOT do
- No session history analysis — use
ccusagefor that - No file modifications — read-only in this version
- No network calls — fully offline
- No support for Cursor, Codex, or other tools — Claude Code only
Contributing
git clone https://github.com/d0d012/claude-trim.git
cd claude-trim
go test ./...
Tests use fixture files in testdata/ — no real ~/.claude/ directory needed.
Conventional commits please: feat:, fix:, docs:, test:, chore:. Releases are cut automatically on v* tags via goreleaser.
Open an issue before a large PR. Small fixes welcome directly.
License
MIT © 2026 d0d012
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found