Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add mthines/agent-skills --skill optimize-claude-mdgit clone --depth 1 https://github.com/mthines/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/mthines/agent-skills/optimize-claude-md)<a href="https://agentmods.dev/skills/mthines/agent-skills/optimize-claude-md"><img src="https://agentmods.dev/badge/skills/mthines/agent-skills/optimize-claude-md.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 4 findings, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium Prompt Injection · line 102 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
- medium Prompt Injection · line 104 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
- medium Prompt Injection · line 105 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
- medium Prompt Injection · line 109 Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.Fix: Remove the large whitespace padding (blank-line blocks or long space runs) and review any content hidden below or to the right of it. Keep skill files compact and reviewable so no instructions can be
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00239 | $0.02229 |
| Opus 5 | $0.00120 | $0.01115 |
| Sonnet 5 | $0.00048 | $0.00446 |
| Haiku 4.5 | $0.00024 | $0.00223 |
Grade A, and why
optimize-claude-md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Optimize CLAUDE.md
Reduces the recurring token cost of CLAUDE.md (and its nested + linked
siblings) by identifying paragraph-length entries, redundant content, and
hot-path bloat — then trimming or extracting them while preserving the
canonical source.
This
SKILL.mdis a thin index. Detailed rules live inrules/*.mdand load on demand. Worked examples live inreferences/*.md. Reading them all up-front would burn tokens you do not need yet.
When to run
Run when any of these hold:
- Claude Code prints
Large CLAUDE.md will impact performance (Xk chars > 40.0k)at session start. - The user asks "shrink", "optimize", "reduce", or "trim" CLAUDE.md.
- A paragraph in CLAUDE.md exceeds 6 lines and is not a code block.
- An inventory section duplicates content already loaded by the harness
(e.g. skill
descriptionfrontmatter, which is preloaded automatically). - A nested package
CLAUDE.mdrepeats content from the root.
Refuse if the target file is < 10k chars — see rules/hard-rules.md.
Mode Detection
Parse $ARGUMENTS and detect the mode. First positional is mode; second is
optional path (default ./CLAUDE.md).
| Mode | Default | Trigger |
|---|---|---|
audit |
yes | Default. Or audit, "review", "report", no mode argument. |
trim |
trim, "shorten", "condense", "make entries one-liners". |
|
extract |
extract, "move to file", "split out", "externalize inventory". |
State the detected mode and target file in one line before continuing:
Mode: audit
Target: /abs/path/to/CLAUDE.md (43,012 chars / ~10,750 tokens)
Workflow
| Phase | Name | Rule file | Gate |
|---|---|---|---|
| 0 | Preflight | rules/hard-rules.md |
File exists, ≥ 10k chars, readable, in a project root or .claude/. |
| 1 | Measure | rules/measurement.md |
Chars, approx tokens, line counts per section captured. |
| 2 | Classify content | rules/classification.md |
Every section labelled hot-path / cold-path / borderline. |
| 2.5 | Invocation review | rules/invocation-review.md |
Slash-conversion candidates (if any) listed with baseline-savings estimate. Skipped if the repo doesn't own skills/. |
| 3 | Mode-specific run | audit-mode.md, trim-mode.md, extract-mode.md |
Report emitted or diff applied with user approval. |
| 4 | Verify | rules/hard-rules.md |
Before/after metrics shown; no content lost in trim or extract. |
What ships with it
8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 175 lines · 239 tokens per session scan A 4af9ae5eecae
optimize-claude-md is a skill published in the GitHub repository mthines/agent-skills (13 stars, last pushed yesterday), licensed MIT. It adds 239 tokens to every session and 2,229 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
ego-browser
Skill "ego-browser" from citrolabs/ego-lite, covering ego-browser, quick start, common helpers, task spaces and control handoff.
temporal-developer
Develop, debug, and manage Temporal applications across Python, TypeScript, Go, Java, .NET, Ruby, and Rust. Use when the user is building workflows, activities, or workers with a Temporal SDK, debugging issues like non-determinism errors, stuck workflows, or activity retries, using Temporal CLI, Temporal Server, or…
geekx-gate
A review framework for deciding whether an engineering idea or technical commitment is necessary, too broad, or premature. It examines the real problem, complexity, evidence, non-goals, and ease of reversal.
geekx-engineering
A set of engineering instructions for making substantial changes in an existing codebase. It emphasizes understanding the affected system, keeping a persistent plan, and recording decisions and evidence.
x-algorithm
Write X (Twitter) posts that the For You algorithm actually rewards. Grounded in the open-sourced X recommendation system — the Grok-based transformer ranker, Phoenix retrieval, Thunder in-network store, and Grox content-understanding pipeline. Use when the user wants to write a post, thread, reply, or quote; plan a…
opencode-memory
Browse local OpenCode history: sessions, messages, plans, prompt history, and prior decisions. Use when the user says history, previous session, last time, remember, recall, plans, prior work, or when resuming/debugging repeated work where earlier OpenCode context may help. Do not use for fresh tasks or when current…