Skip to content
Skills Library
AI & agents · Writing

optimize-claudemd

/optimize-claudemd

Rewrite a bloated CLAUDE.md / AGENTS.md / GEMINI.md under 300 words without dropping constraints. Use for "optimize claude.md", "shrink claude.md". Skip files already under 300 words.

Licence
MIT
Last repository change
06.09.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 06.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Rewrite a bloated CLAUDE.md / AGENTS.md / GEMINI.md under 300 words without dropping constraints. Use for "optimize claude.md", "shrink claude.md". Skip files already under 300 words.

Triggers from the description

optimize claude.mdshrink claude.md
Original author description

Rewrite a bloated CLAUDE.md / AGENTS.md / GEMINI.md under 300 words without dropping constraints. Use for "optimize claude.md", "shrink claude.md". Skip files already under 300 words.

How it works

  1. Step 1: Find and Read the File
  2. Step 2: Analyze Content
  3. Step 3: Rewrite
  4. Step 4: Show Diff and Confirm
  5. Step 5: Write File
  6. Additional Resources
Original SKILL.md headings · 83 lines, 412 words
SKILL.md preview
---
name: optimize-claudemd
description: Rewrite a bloated CLAUDE.md / AGENTS.md / GEMINI.md under 300 words without dropping constraints. Use for "optimize claude.md", "shrink claude.md". Skip files already under 300 words.
---

# Optimize Claude.md

Read, analyze, and rewrite the agent instruction file (`CLAUDE.md`; `AGENTS.md` on Codex; `GEMINI.md` on Gemini CLI) to reduce token cost while preserving all meaningful constraints. Target: under 300 words (~390 tokens — the same "optimal" threshold estimate-tokens and the status line use).

If the file is already under 300 words, stop: report "already optimal" and
change nothing. Optimizing an optimal file is pure churn.

## Step 1: Find and Read the File

Check these locations in order:
1. `./CLAUDE.md` / `./claude.md` (project root)
2. `./AGENTS.md` (Codex) / `./GEMINI.md` (Gemini CLI)
3. `~/.claude/CLAUDE.md` (global)

Read the file. Count approximate word count.

## Step 2: Analyze Content

Categorize each section:

| Category | Keep? | Action |
|----------|-------|--------|
| Coding style rules | Yes | Compress to bullets |
| Project structure | Yes | One-line per item |
| Important constraints | Yes | Keep verbatim |
| Pleasantries / tone instructions | Maybe | Cut if not essential |
| Repeated instructions | No | Remove duplicates |
| Obvious defaults | No | Remove ("always use git" etc.) |
| Long explanations | No | Replace with one-line rule |
| Examples longer than 3 lines | No | Remove or move to references/ |

## Step 3: Rewrite

Apply these compression rules:

1. **Bullets over prose** — Replace paragraphs with bullet lists
2. **Imperative tense** — "Use TypeScript strict mode" not "You should use TypeScript strict mode"
3. **No justifications** — Remove "because X" explanations
4. **Merge related rules** — Combine similar rules into one line
5. **Cut obvious defaults** — Remove anything Claude does by default anyway

Target structure:
```markdown
# Project: [NAME]
Stack: [tech stack, one line]

## Code Style
- [rule 1]
- [rule 2]

## Constraints
- [hard constraint 1]
- [hard constraint 2]

## Structure
- [key path 1]: [purpose]
- [key path 2]: [purpose]
```

Compression rule zero: **never silently drop a constraint.** When unsure
whether a rule is load-bearing, keep it and flag it in the diff — the user
decides. A 50-token saving is not worth one lost hard constraint.

## Step 4: Show Diff and Confirm

Present:
```
BEFORE: ~[N] words (~[N*1.3] tokens)
AFTER:  ~[N] words (~[N*1.3] tokens)
Reduction: [%]%
```

Show the optimized version. Ask user to confirm before writing.

## Step 5: Write File

On confirmation, overwrite the file with the optimized version.

## Additional Resources

- **`references/claudemd-templates.md`** — Optimized claude.md templates for common project types
Files in this package (2)
  • SKILL.md 3 KB
  • references/claudemd-templates.md 2 KB

Versions

RepositoryScoreLicence
This page · kyuna0312/context_forge100MIT
thettwe/nyann100MIT

Database snapshot: 13.11.2026 · package version dec1d5b0a32d (SHA-256 digest of the entire package)

Downloads in the last 30 days: 3 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100gen-claudemd
    Regenerate the nyann-managed block in CLAUDE.md from the current profile, stack detection, and doc plan — without re-running a full bootstrap or retrofit. TRIGGER when the user says "regenerate CLAUDE.md", "update CLAUDE.md", "refresh CLAUDE.md", "rebuild CLAUDE.md", "re-gen…
  • 90codemap-claudemd
    Use to generate or refresh a layered CLAUDE.md hierarchy (lean root + per-subdir) for a large codebase. "Set up CLAUDE.md files", "scaffold context files", "make this repo legible to Claude Code", "add directory-scoped conventions".
  • 95bs-claudemd
    Audit a CLAUDE.md for cruft and render a light-theme report website. Reads the file line by line and flags vague rules with no checkable criterion, low-signal lines that only restate what the model already does, overlapping rules said more than once, and internal contradictions,…
  • 100claudemd-gen
    This skill should be used when the user wants to generate, create, write, audit, improve, or review a CLAUDE.md file, set up .claude/rules/ for path-specific instructions, create a CLAUDE.local.md for personal preferences, set up project instructions, configure Claude Code for a…
  • 100gemini-cli
    Run Gemini CLI for AI queries. Use when user asks to "run/ask/use gemini", compare Claude vs Gemini, or delegate tasks to Gemini.
  • 100prompt-optimizer
    When the user wants a prompt optimized for ChatGPT, Claude, Gemini, or another AI — 'make this prompt better', 'optimize for ChatGPT', 'rewrite my prompt' — even without saying 'optimize'.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.