Skip to content

Claude Md Optimizer

Claude Code skill for optimizing oversized CLAUDE.md files using progressive disclosure

Install: git clone https://github.com/wrsmith108/claude-md-optimizer

Works with Claude Code · 26 GitHub stars

Install

$git clone https://github.com/wrsmith108/claude-md-optimizer

Install command taken from the project's README or registry entry. Always review code before running it.

claude-md-optimizer

A Claude Code skill that optimizes oversized agent instruction files using progressive disclosure. Handles CLAUDE.md (Claude Code), AGENTS.md (OpenAI Codex / GitHub Copilot agents), and copilot-instructions.md (GitHub Copilot). Auto-detects all three formats, analyzes content tiers, creates sub-documents using each format's native mechanism, and rewrites the main file — with zero information loss.

The Problem

Agent instruction files grow organically as projects mature. They accumulate troubleshooting guides, deployment commands, API references, and configuration examples alongside the essential rules needed every session. Since these files are loaded into every AI session as context, oversized files waste the context window on content that's only needed occasionally — and for CLAUDE.md, Anthropic explicitly warns that adherence degrades above 200 lines.

Projects with 6+ months of development commonly reach 800–1,500+ lines.

Supported Formats

Format Primary Location Target Size Native Sub-Doc Mechanism
CLAUDE.md ./CLAUDE.md or ./.claude/CLAUDE.md <200 lines @import syntax; .claude/rules/*.md
AGENTS.md ./AGENTS.md (hierarchical) <32 KiB chain (Codex default) Nested AGENTS.md in subdirectories
copilot-instructions.md .github/copilot-instructions.md ~100 lines .github/instructions/NAME.instructions.md

How It Works

The skill uses a 6-phase guided workflow:

  1. Detect & Analyze — Auto-scan the repo for all three file types; report sizes vs. format targets; parse and categorize sections as Essential, Reference, or Redundant
  2. Detect Constraints — Check for git-crypt/SOPS/age encryption; identify format-native sub-doc mechanisms; scan for CI scripts that regex-scan the file
  3. Plan — Present a categorization table showing what stays inline vs. what gets extracted (and where)
  4. Review — User approves the plan before any changes are made
  5. Execute — Create sub-documents using the format's native mechanism; rewrite the main file with rich inline synopses and progressive disclosure links
  6. Validate — Diff total content before/after to confirm zero information loss; verify format target is met

Install

This skill is published as a Claude Code plugin (see skillsmith.app). To install it manually, clone it into your Claude Code skills directory:

git clone https://github.com/wrsmith108/claude-md-optimizer.git ~/.claude/skills/claude-md-optimizer

The skill is automatically available in all Claude Code sessions after installation.

Usage

Trigger the skill by saying any of:

  • "optimize CLAUDE.md"
  • "AGENTS.md is too long"
  • "reduce copilot-instructions.md"
  • "agent instructions file too large"
  • "apply progressive disclosure"

The skill will detect your instruction files, report their sizes, and present a plan for approval before making any changes.

Skill Structure

Similar plugs

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local…

Persistent Context Across Sessions for Every Agent, Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future…

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex…

【低代码v2.0,一句话即可生成整个系统】企业级AI低代码平台,一键生成前后端代码甚至整个系统。 AI Skills 一句话画流程、设计表单、生成报表、大屏。内置 AI应用平台涵盖:AI聊天、知识库、流程编排、MCP插件等,兼容主流大模型。引领AI低代码「Skills 生成 → 在线配置 → 代码生成 → 手工合并->AI修改」开发模式,解决…

Open-source personal AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel.…

Explore related