kit/plugins/claude-md-optimizer/skills/claude-md-optimizer/SKILL.md
Use when the user asks to audit, optimize, review, clean up, or improve a CLAUDE.md file. Also use when Claude is ignoring instructions, behaving inconsistently, or the CLAUDE.md appears bloated or overloaded. Does not cover SKILL.md files, plugin commands, or other markdown files.
npx skillsauth add shawn-sandy/agentics md-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit and optimize a CLAUDE.md file against Claude Code best practices.
Freedom level: Rigid — Execute all six steps in the order listed. Do not skip, combine, or reorder them.
Determine which CLAUDE.md to audit using this priority order:
CLAUDE.md in the current working directory (primary project location).claude/CLAUDE.md in the current working directory (alternate, checked if primary absent)~/.claude/CLAUDE.md (global user-level)Tell the user which file will be audited before continuing. If none of the four locations has a file and no argument was given, stop and ask the user to provide a path.
If a path was given but the file does not exist, stop and report the error clearly.
Read the target file in full, then collect these metrics:
**Always**, **Never**). Acknowledge a ±30–50 variance in your estimate.## heading presentsk-, ghp_, AKIA, xoxb-, -----BEGIN, or a label followed by a long alphanumeric string (e.g., TOKEN=abc123...). Report matches verbatim so the user can verify.@path/to/file references in the file. List each one found. Note that imported content counts toward effective instruction load but is not visible in the raw line count.Report all five metrics before proceeding to Step 3.
Score each dimension 0, 1, or 2. Maximum score: 12.
Full dimension definitions, scoring tables, and example audit output are in
references/audit-steps.md. Load that file before scoring.
Output a structured report in this format:
## CLAUDE.md Audit Report
**File:** [path audited]
**Lines:** [n] | **Estimated instructions:** [n ± 30–50]
### Scores
| Dimension | Score | Max |
|------------------------|-------|-----|
| Instruction Budget | [n] | 2 |
| Section Quality | [n] | 2 |
| 80% Rule Compliance | [n] | 2 |
| Progressive Disclosure | [n] | 2 |
| Safety & Hygiene | [n] | 2 |
| Structure | [n] | 2 |
| **Total** | **[n]** | **12** |
**Grade:** [see scale below]
Grade scale:
| Total | Grade | |-------|--------------| | 10–12 | Optimized | | 7–9 | Functional | | 4–6 | Needs work | | 0–3 | Rewrite |
After the table:
When Progressive Disclosure scores 0 or 1, include as a Top 3 item: "Use Step 5's rule-file generation to break path-specific content into
.claude/rules/files."
Ask the user: "Would you like me to generate an optimized version of this file in the chat?"
If the user says yes, generate the optimized content in a code block in the chat (do not write to disk yet). Apply these transformations:
[REDACTED - move to .env]).claude/rules/ files below, not embedded in the CLAUDE.md outputOffer to generate .claude/rules/ files:
For each section removed as an 80%-rule violation or path-specific content:
paths: frontmatter:---
paths:
- "<glob>"
---
# <Descriptive Title>
- Rule bullet 1
- Rule bullet 2
- Rule bullet 3
.claude/rules/ exists. If not, ask: "The .claude/rules/ directory does not exist. Should I create it?".claude/rules/<name>.md?" Wait for explicit confirmation before writing each file.After the CLAUDE.md code block, show a separate callout:
To make this optimizer always available in your project, add the following to your CLAUDE.md
(replace <plugin-dir> with the path passed to --plugin-dir when loading this plugin):
@<plugin-dir>/skills/claude-md-optimizer/SKILL.md
If the user says no, stop here.
After showing the optimized version, ask: "Should I write this to disk? Commit or back up your current CLAUDE.md first — this will overwrite it."
Wait for an explicit second confirmation before writing. Write only the file that was audited in Step 1.
development
Checks whether the branch's PR is ready and merges it when green. Runs the readiness gate, lint, and an approval prompt. Use when the user asks "merge?" or if a PR is ready to merge.
development
Implements a plan file that already exists. Walks its steps, ticks the spec, re-renders, and runs the completion gates. Use when asked to implement an existing plan.
development
Audits and optimizes CLAUDE.md project memory files. Checks adherence to Claude Code best practices and produces actionable fixes. Use when the user asks to audit, optimize, or diagnose a CLAUDE.md.
development
Converts an HTML artifact or Markdown file into a draft post for a static site. Scopes CSS to keep interactive blocks alive and escapes prose for MDX. Use when asked to turn an artifact into a post.