agent-md-refactor

48
4
Source

Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.

Install

mkdir -p .claude/skills/agent-md-refactor && curl -L -o skill.zip "https://mcp.directory/api/skills/download/781" && unzip -o skill.zip -d .claude/skills/agent-md-refactor && rm skill.zip

Installs to .claude/skills/agent-md-refactor

About this skill

Agent MD Refactor

Refactor bloated agent instruction files (AGENTS.md, CLAUDE.md, COPILOT.md, etc.) to follow progressive disclosure principles - keeping essentials at root and organizing the rest into linked, categorized files.


Triggers

Use this skill when:

  • "refactor my AGENTS.md" / "refactor my CLAUDE.md"
  • "split my agent instructions"
  • "organize my CLAUDE.md file"
  • "my AGENTS.md is too long"
  • "progressive disclosure for my instructions"
  • "clean up my agent config"

Quick Reference

PhaseActionOutput
1. AnalyzeFind contradictionsList of conflicts to resolve
2. ExtractIdentify essentialsCore instructions for root file
3. CategorizeGroup remaining instructionsLogical categories
4. StructureCreate file hierarchyRoot + linked files
5. PruneFlag for deletionRedundant/vague instructions

Process

Phase 1: Find Contradictions

Identify any instructions that conflict with each other.

Look for:

  • Contradictory style guidelines (e.g., "use semicolons" vs "no semicolons")
  • Conflicting workflow instructions
  • Incompatible tool preferences
  • Mutually exclusive patterns

For each contradiction found:

## Contradiction Found

**Instruction A:** [quote]
**Instruction B:** [quote]

**Question:** Which should take precedence, or should both be conditional?

Ask the user to resolve before proceeding.


Phase 2: Identify the Essentials

Extract ONLY what belongs in the root agent file. The root should be minimal - information that applies to every single task.

Essential content (keep in root):

CategoryExample
Project descriptionOne sentence: "A React dashboard for analytics"
Package managerOnly if not npm (e.g., "Uses pnpm")
Non-standard commandsCustom build/test/typecheck commands
Critical overridesThings that MUST override defaults
Universal rulesApplies to 100% of tasks

NOT essential (move to linked files):

  • Language-specific conventions
  • Testing guidelines
  • Code style details
  • Framework patterns
  • Documentation standards
  • Git workflow details

Phase 3: Group the Rest

Organize remaining instructions into logical categories.

Common categories:

CategoryContents
typescript.mdTS conventions, type patterns, strict mode rules
testing.mdTest frameworks, coverage, mocking patterns
code-style.mdFormatting, naming, comments, structure
git-workflow.mdCommits, branches, PRs, reviews
architecture.mdPatterns, folder structure, dependencies
api-design.mdREST/GraphQL conventions, error handling
security.mdAuth patterns, input validation, secrets
performance.mdOptimization rules, caching, lazy loading

Grouping rules:

  1. Each file should be self-contained for its topic
  2. Aim for 3-8 files (not too granular, not too broad)
  3. Name files clearly: {topic}.md
  4. Include only actionable instructions

Phase 4: Create the File Structure

Output structure:

project-root/
├── CLAUDE.md (or AGENTS.md)     # Minimal root with links
└── .claude/                      # Or docs/agent-instructions/
    ├── typescript.md
    ├── testing.md
    ├── code-style.md
    ├── git-workflow.md
    └── architecture.md

Root file template:

# Project Name

One-sentence description of the project.

## Quick Reference

- **Package Manager:** pnpm
- **Build:** `pnpm build`
- **Test:** `pnpm test`
- **Typecheck:** `pnpm typecheck`

## Detailed Instructions

For specific guidelines, see:
- [TypeScript Conventions](.claude/typescript.md)
- [Testing Guidelines](.claude/testing.md)
- [Code Style](.claude/code-style.md)
- [Git Workflow](.claude/git-workflow.md)
- [Architecture Patterns](.claude/architecture.md)

Each linked file template:

# {Topic} Guidelines

## Overview
Brief context for when these guidelines apply.

## Rules

### Rule Category 1
- Specific, actionable instruction
- Another specific instruction

### Rule Category 2
- Specific, actionable instruction

## Examples

### Good
\`\`\`typescript
// Example of correct pattern
\`\`\`

### Avoid
\`\`\`typescript
// Example of what not to do
\`\`\`

Phase 5: Flag for Deletion

Identify instructions that should be removed entirely.

Delete if:

CriterionExampleWhy Delete
Redundant"Use TypeScript" (in a .ts project)Agent already knows
Too vague"Write clean code"Not actionable
Overly obvious"Don't introduce bugs"Wastes context
Default behavior"Use descriptive variable names"Standard practice
OutdatedReferences deprecated APIsNo longer applies

Output format:

## Flagged for Deletion

| Instruction | Reason |
|-------------|--------|
| "Write clean, maintainable code" | Too vague to be actionable |
| "Use TypeScript" | Redundant - project is already TS |
| "Don't commit secrets" | Agent already knows this |
| "Follow best practices" | Meaningless without specifics |

Execution Checklist

[ ] Phase 1: All contradictions identified and resolved
[ ] Phase 2: Root file contains ONLY essentials
[ ] Phase 3: All remaining instructions categorized
[ ] Phase 4: File structure created with proper links
[ ] Phase 5: Redundant/vague instructions removed
[ ] Verify: Each linked file is self-contained
[ ] Verify: Root file is under 50 lines
[ ] Verify: All links work correctly

Anti-Patterns

AvoidWhyInstead
Keeping everything in rootBloated, hard to maintainSplit into linked files
Too many categoriesFragmentationConsolidate related topics
Vague instructionsWastes tokens, no valueBe specific or delete
Duplicating defaultsAgent already knowsOnly override when needed
Deep nestingHard to navigateFlat structure with links

Examples

Before (Bloated Root)

# CLAUDE.md

This is a React project.

## Code Style
- Use 2 spaces
- Use semicolons
- Prefer const over let
- Use arrow functions
... (200 more lines)

## Testing
- Use Jest
- Coverage > 80%
... (100 more lines)

## TypeScript
- Enable strict mode
... (150 more lines)

After (Progressive Disclosure)

# CLAUDE.md

React dashboard for real-time analytics visualization.

## Commands
- `pnpm dev` - Start development server
- `pnpm test` - Run tests with coverage
- `pnpm build` - Production build

## Guidelines
- [Code Style](.claude/code-style.md)
- [Testing](.claude/testing.md)
- [TypeScript](.claude/typescript.md)

Verification

After refactoring, verify:

  1. Root file is minimal - Under 50 lines, only universal info
  2. Links work - All referenced files exist
  3. No contradictions - Instructions are consistent
  4. Actionable content - Every instruction is specific
  5. Complete coverage - No instructions were lost (unless flagged for deletion)
  6. Self-contained files - Each linked file stands alone

software-architecture

davila7

Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

473163

scroll-experience

davila7

Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.

12580

planning-with-files

davila7

Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.

7966

humanizer

davila7

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases. Credits: Original skill by @blader - https://github.com/blader/humanizer

10352

game-development

davila7

Game development orchestrator. Routes to platform-specific skills based on project needs.

14649

2d-games

davila7

2D game development principles. Sprites, tilemaps, physics, camera.

12744

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

1,5701,369

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

1,1161,190

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

1,4181,109

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

1,193747

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

1,153684

pdf-to-markdown

aliceisjustplaying

Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.

1,311614

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.