prompt-audit
Skill0 starsChanged 7 months agoMITView on GitHub
Audit and optimize Claude Code system prompt overhead. Scans skills, CLAUDE.md files, memory files, MCP servers, and context store to identify token bloat, weak memory pointers, stale entries, and conflicting instructions. Runs a 3-phase guided workflow: token audit, memory quality audit, and prioritized recommendations. Always presents findings before fixing anything. Use when the user says "audit system prompt", "prompt audit", "check system prompt", "why is claude slow", "audit memory", "memory quality check", "optimize claude code", or asks about system prompt size or overhead.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- fedecaccia/prompt-audittheir own version, first seen Nov 8, 2026
- ejoliet/claude-skillstheir own version, first seen Oct 11, 2026
- Megaprompting/torque-looptheir own version, first seen Jul 3, 2026
- PatriotAgenticLLC/better_claude_skillztheir own version, first seen Jul 1, 2026
- JWhiteUX/ClaudeSkills-Librarytheir own version, first seen Apr 2, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- Megaprompting/torque-loop★ 10same name
- JWhiteUX/ClaudeSkills-Library★ 4same name
- PatriotAgenticLLC/better_claude_skillz★ 3same name
- fedecaccia/prompt-audit★ 2same name
- ejoliet/claude-skills★ 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 repositoryOne other file it gives its agents.
- skill-routerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 12 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
12
Distinctive
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
- Distinctive: line 31
Classify, don't lecture: Use the standard taxonomy (SELF-CONTAINED, GOOD POINTER, WEAK POINTER, STALE, CONFLICTING) consistently so …
- Distinctive: line 35
Never delete files, never rewrite CLAUDE.md sections without confirmation.
- Distinctive: line 41
Run the audit script from the skill's vault directory:
- Distinctive: line 126
After all tables, print a summary count:
- Distinctive: line 190
Ask: "Apply this rewrite? (yes / skip / edit)"
- Distinctive: line 193
Never rewrite multiple entries in one Edit call -- one entry per confirmation.
- Distinctive: line 199
Ask: "Archive this entry, keep it, or update the status?"
- Distinctive: line 208
Ask: "Which version is correct?
- Distinctive: line 216
Never auto-fix without showing the user what will change and getting explicit approval.
- Distinctive: line 218
Use the SELF-CONTAINED / GOOD POINTER / WEAK POINTER / STALE / CONFLICTING taxonomy only.
- Distinctive: line 219
Do not invent new rating labels.
- Distinctive: line 221
Never delete memory files or CLAUDE.md sections -- only rewrite inline or comment out.
- Very specific: line 223
If missing, say: "audit.py is missing from the vault directory.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
prompt-audit
Version: 1.0 | Created: 2026-04-13 Changelog: See Changelog at end of file. Dependency:
audit.pymust live alongside this SKILL.md in the same vault directory.
Philosophy
System prompt bloat is a performance and quality problem. Every token loaded into context on every turn competes with the user's actual work. This skill makes the overhead visible, classifies its quality, and offers targeted fixes -- without auto-applying anything the user hasn't approved.
Core principles:
- Review, don't fix. Present findings first. Offer to fix. Never auto-apply.
- Show the math. Token counts, percentages, and verdicts make the cost concrete.
- Classify, don't lecture. Use the standard taxonomy (SELF-CONTAINED, GOOD POINTER, WEAK POINTER, STALE, CONFLICTING) consistently so findings are scannable.
- Batch the asks. Present all recommendations at once, let the user pick which to apply.
- Memory one-liners only. Auto-apply only applies to WEAK POINTER rewrites. Never delete files, never rewrite CLAUDE.md sections without confirmation.
Phase 1 -- Token Audit
Run the audit script from the skill's vault directory:
python3 ~/.claude/skill-vault/prompt-audit/audit.pyThe script scans and reports tokens for each component:
| Component | What it scans |
| Skills (active) | ~/.claude/skills/ -- each loaded SKILL.md description block |
| Skill Router | Checks if skill-router is installed; estimates savings if not |
| CLAUDE.md (global) | ~/.claude/CLAUDE.md -- full token count |
| CLAUDE.md (project) | ~/.claude/projects/*/CLAUDE.md -- per-project files |
| Memory files | All ~/.claude/projects/*/memory/MEMORY.md files |
| MCP servers | Parsed from settings.json and settings.local.json |
| Context store | ~/.claude/context/ -- on-demand reference, not always loaded |
Verdict thresholds:
| Tokens | Verdict |
| < 5,000 | Healthy |
| 5,001 -- 10,000 | Moderate |
| 10,001 -- 15,000 | Heavy |
| > 15,000 | Critical |
Display the full breakdown table with per-component token counts and percentages, then print the verdict with a one-line interpretation. Stop and present Phase 1 results before starting Phase 2.
Phase 2 -- Memory Quality Audit
For each MEMORY.md found during Phase 1, scan every bullet-point entry and classify it using the taxonomy below. Use the entry text to determine the rating -- do not read linked files unless necessary to disambiguate.
Memory Entry Taxonomy
SELF-CONTAINED
The bullet IS the full instruction. Claude can act on it without reading any file.
Example: No em dashes -- Never use em dashes in outreach drafts.
No action needed.
GOOD POINTER
The bullet links to or references a file AND includes a clear trigger that tells
Claude when to load it.
Pattern: [Title](file.md) -- READ before/when [specific trigger].
Example: [GTM Pipeline](gtm-pipeline.md) -- READ before drafting any outreach sequence.
No action needed.
WEAK POINTER
The bullet references a file but lacks a trigger. Claude cannot tell when to read it.
The description alone does not tell Claude when the file is relevant.
Example: [API Migration](project_api_migration.md) - Backend rewrite from Python to Node.js...
Action: Add "READ before/when [trigger]" prefix.
STALE Contains a date that is more than 30 days old (relative to today's date) AND a status word suggesting unfinished work: "pending", "needed", "planned", "to do", "in progress", "draft", "wip", "tbd". Action: Flag for review or archive.
CONFLICTING The same topic appears in multiple MEMORY.md files (across different projects) with different values or contradictory instructions. Action: Flag both entries; ask user which to keep.
Phase 2 Output Format
Present a table for each MEMORY.md file found:
File: ~/.claude/projects/<project>/memory/MEMORY.md
---
| Entry (truncated to 80 chars) | Rating | Suggested Fix |
|-------------------------------|--------|---------------|
| No em dashes -- Never use... | SELF-CONTAINED | -- |
| [GTM Pipeline](gtm-pipeline.md) -- READ before... | GOOD POINTER | -- |
| [API Migration](proj...) -- Backend rewrite from Python to Node.js | WEAK POINTER | Add: "READ before working on API migration or backend architecture" |
| [East Coast trip -- pending hotel bookings] (2025-12-01) | STALE | Review or archive -- status word "pending" with date >30 days old |After all tables, print a summary count:
- X SELF-CONTAINED entries
- X GOOD POINTER entries
- X WEAK POINTER entries (need trigger rewrites)
- X STALE entries (need review)
- X CONFLICTING entries (need resolution)
Phase 3 -- Recommendations
Generate a prioritized numbered list based on Phase 1 and Phase 2 findings. Present ALL recommendations before asking anything.
Recommendation priority order:
- Skill-router not installed (if detected)
- State the estimated savings (skill descriptions loaded per-turn without router vs. loaded on-demand with router).
- Recommend running
migrate.shfrom the skill-router repo.
- Memory files are >50% of total overhead
- Recommend running
memory-router.shto compact MEMORY.md files. - Show estimated before/after token savings using the script's own estimates (~400 tokens per linked file, ~15 tokens per compacted entry).
- Recommend running
- WEAK POINTER rewrites (one per finding, show before/after)
Before: [East & West Coast Trip](project_east_west_coast_trip.md) - 19-contact trip plan... After: [East & West Coast Trip](project_east_west_coast_trip.md) -- READ before planning travel, scheduling Bay Area / Boston / NYC meetings, or discussing the April 2026 trip. - STALE entries to review -- list each with its date and status word.
- CONFLICTING entries to resolve -- list both entries and their locations.
- CLAUDE.md is >3,000 tokens
- Suggest splitting global CLAUDE.md: move project-specific rules to project-level
CLAUDE.mdfiles so they only load in that project's context.
- Suggest splitting global CLAUDE.md: move project-specific rules to project-level
- MCP servers >5
- List all connected servers by name.
- Suggest disconnecting any not used in the past 30 days.
After Presenting Recommendations
Ask:
"Which of these would you like me to apply? I can:
- (A) Rewrite all WEAK POINTER entries (shows before/after for each, applies on approval)
- (B) Walk through STALE entries one by one
- (C) Show CONFLICTING entries side-by-side for resolution
- (D) Show the memory-router.sh command to run
- Or tell me a specific number from the list above."
Applying Fixes
Memory WEAK POINTER rewrites
For each WEAK POINTER the user approves:
- Show the exact before/after diff for the entry line.
- Ask: "Apply this rewrite? (yes / skip / edit)"
- On yes: use Edit tool to make the change in-place.
- On edit: accept the user's revised trigger text, show the new after, then apply.
- Never rewrite multiple entries in one Edit call -- one entry per confirmation.
Stale entry review
For each STALE entry:
- Show the full entry text and the file it lives in.
- Ask: "Archive this entry, keep it, or update the status?"
- On archive: comment it out (prefix with
<!-- ARCHIVED: -->) rather than deleting. - On keep: leave as-is.
- On update: accept new text from user and apply with Edit.
Conflicting entry resolution
For each CONFLICTING pair:
- Show both entries side-by-side with their file paths.
- Ask: "Which version is correct? Or provide the text you want to keep."
- On choice: update the winning file (or both if the user provides new text),
then comment out the losing entry with
<!-- SUPERSEDED BY: [file] -->.
Rules
- Never auto-fix without showing the user what will change and getting explicit approval.
- Present all findings first, then offer fixes -- never interleave discovery and patching.
- Use the SELF-CONTAINED / GOOD POINTER / WEAK POINTER / STALE / CONFLICTING taxonomy only. Do not invent new rating labels.
- For memory one-liner rewrites: show before/after for every entry before applying any of them.
- Never delete memory files or CLAUDE.md sections -- only rewrite inline or comment out.
- The audit.py script must exist at
~/.claude/skill-vault/prompt-audit/audit.py. If missing, say: "audit.py is missing from the vault directory. Copy it from ~/claude-token-optimizer/audit.py first, then re-run the skill." - Token counts are estimates (1 token ~ 4 chars). Treat them as directional, not exact.
- Dates for STALE detection are relative to today's date (available via system-reminder).
Changelog
1.0 -- 2026-04-13
- Initial version: 3-phase audit workflow (token audit, memory quality, recommendations)
- Taxonomy: SELF-CONTAINED, GOOD POINTER, WEAK POINTER, STALE, CONFLICTING
- Supports audit.py for token scanning and memory-router.sh for bulk compaction
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
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.

