refactor-agents-md
Skill3 starsChanged 6 months agoMITView on GitHub
Refactor an AGENTS.md or CLAUDE.md file using the Progressive Disclosure Principle so that only essential, universal instructions stay at root level while domain-specific guidance moves to subsidiary files loaded just-in-time. Use this skill whenever the user wants to restructure, slim down, optimize, or declutter their AGENTS.md or CLAUDE.md file, mentions "progressive disclosure" for agent instructions, says their instruction file is "too long" or "bloated," asks how to reduce token overhead in their agent config, or wants Claude to "only load what it needs." Also trigger when the user says things like "refactor my CLAUDE.md," "split up my AGENTS.md," "organize my agent instructions," or "my AGENTS.md has gotten out of hand."
3 other projects use a version of this.
Adopted by
Most recently taken up by
- vinta/hal-9000their own version, first seen Oct 21, 2026
- The-Syntax-Slayer/skill-genietheir own version, first seen Oct 9, 2026
- Fei2-Labs/skill-genietheir own version, first seen Sep 24, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- vinta/hal-9000★ 142same name
- Fei2-Labs/skill-genie★ 12same name
- The-Syntax-Slayer/skill-genie★ 1same 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 repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-browserSkill
- ai-sdkSkill
- electron-scaffoldSkill
- electronSkill
- grill-meSkill
- ou-features-auditSkill
- ou-full-code-reviewSkill
- ouroboros-intent-e2eSkill
- ouroboros-test-plan-authorSkill
- prd-to-ticketsSkill
- team-implement-ticketsSkill
- ai-sdkSkill
- grill-meSkill
- meta-thinkingSkill
- ou-full-code-reviewSkill
- prd-to-ticketsSkill
- team-implement-ticketsSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Read the current AGENTS.md (or CLAUDE.md — treat them identically).
- Distinctive: line 36
If the file is under 40 lines and cleanly organized, tell the user it's already lean and progressive disclosure may not add much value.
- Distinctive: line 59
When in doubt, ask: "Would an agent doing a completely unrelated task in this repo still need this information?" If no, it's …
- Distinctive: line 64
Before touching any files, show the user a clear summary:
- Distinctive: line 105
Not a bulleted link dump — a sentence that tells the agent when and why to look there.
- Distinctive: line 107
Check for cross-references: If the original file had internal references between sections (e.g., "as described in Architecture above"), …
- Distinctive: line 124
If any check fails, fix it before reporting completion.
- Distinctive: line 134
Don't duplicate — if the root file covers a topic, the package file should reference it rather than repeat it.
“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
Refactor AGENTS.md with Progressive Disclosure
Frontier LLMs can follow roughly 150-200 instructions with reasonable consistency. Every token in AGENTS.md loads on every single request — whether or not it's relevant to the current task. A bloated instruction file wastes context window on guidance the agent doesn't need right now, leaving less room for the actual work.
Progressive disclosure fixes this: keep the root file minimal (universal essentials only) and move domain-specific guidance into subsidiary files that the agent reads only when relevant. No content is lost — it's redistributed so the agent finds what it needs exactly when it needs it.
Workflow
Step 1: Read and Measure
Read the current AGENTS.md (or CLAUDE.md — treat them identically). Note:
- Total line count
- Each
##section heading and its approximate size - Whether the project is a monorepo (multiple packages with their own instruction needs)
If the file is under 40 lines and cleanly organized, tell the user it's already lean and progressive disclosure may not add much value. Offer to review it for other improvements instead.
Step 2: Classify Every Section
Go through each section and classify it as either root-essential or domain-specific.
Root-essential (stays in the root file):
- One-sentence project description (what this project is)
- Runtime / package manager (if non-standard)
- Build and test commands (the commands an agent needs for any task)
- Universal workflow rules (e.g., "always run lint before committing")
- Any rule that applies to literally every task regardless of domain
Domain-specific (moves to a subsidiary file):
- Language or framework conventions (TypeScript style, React patterns)
- Architecture details (system design, module boundaries, data flow)
- Testing patterns and strategies (test organization, fixture conventions)
- Tool or API-specific guidance (tool registry patterns, SDK usage)
- Deployment and CI/CD instructions
- Safety or permission models (unless they're brief enough for root)
When in doubt, ask: "Would an agent doing a completely unrelated task in this repo still need this information?" If no, it's domain-specific.
Step 3: Present the Refactoring Plan
Before touching any files, show the user a clear summary:
Sections staying at root:
- Project Overview (3 lines)
- Commands (8 lines)
- Workflow (6 lines)
Sections moving to subsidiary files:
- Architecture → doc/ARCHITECTURE.md
- Conventions → doc/CONVENTIONS.md
- Testing Patterns → doc/TESTING.mdExplain the rationale briefly. Ask the user to confirm or adjust — they may want to keep
certain sections at root, merge some subsidiary files, or use a different directory than
doc/.
Step 4: Execute the Refactoring
Once approved:
- Create subsidiary files in the agreed directory (default:
doc/). Each file should:- Have a clear
# Titlematching its domain - Contain the full content extracted from the root file, unmodified
- Be self-contained — someone reading just that file should understand the domain
- Have a clear
Rewrite the root AGENTS.md with:
- The root-essential sections, unchanged
- Conversational breadcrumbs pointing to each subsidiary file
Breadcrumbs should feel natural, not like a table of contents. Place them where the content used to be, so the flow still reads logically. For example:
## Architecture For architecture details including the core loop pattern, tool registry, and memory system, see doc/ARCHITECTURE.md.Not a bulleted link dump — a sentence that tells the agent when and why to look there.
- Check for cross-references. If the original file had internal references between sections (e.g., "as described in Architecture above"), update them to point to the correct subsidiary file.
For detailed guidance on what makes good breadcrumbs, monorepo layering, and common
anti-patterns, see references/progressive-disclosure-guide.md.
Step 5: Verify
After refactoring, confirm:
- Root file is lean (ideally under 50 lines for most projects)
- Every breadcrumb path actually resolves to an existing file
- No content was lost — diff the total content before and after
- Subsidiary files are self-contained and clearly titled
- The root file still reads naturally top-to-bottom
If any check fails, fix it before reporting completion.
Monorepo Handling
For monorepos, apply a two-level strategy:
- Root AGENTS.md: Monorepo purpose, shared tooling (package manager, workspace commands), cross-package conventions
- Package-level AGENTS.md: Package-specific tech stack, conventions, and commands
Don't duplicate — if the root file covers a topic, the package file should reference it rather than repeat it. Package-level files merge with the root at runtime, so they can assume root context is available.
When to Stop Splitting
Progressive disclosure has diminishing returns. Don't create a subsidiary file for a section that's only 3-5 lines — the breadcrumb itself would be nearly as long. A good rule of thumb: if a section is under 10 lines and isn't part of a clear domain grouping, leave it at root.
The goal is a root file that an agent can absorb in seconds, with clear paths to deeper knowledge. Not a fractal of tiny files.
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.

