agentleFS
buddyhbuddyh/agent-skills/skill-refactoring/skill.md

skill-refactoring

Skill5 starsChanged 8 months agoMITView on GitHub

Refactor bloated skill.md files using progressive disclosure pattern. Moves detailed content to references/ while keeping skill.md focused and discoverable. Use when a skill is approaching 500 lines or needs better organization.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    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
  1. Distinctive:

    Use this skill when:

    line 25
  2. Distinctive:

    Creating a new complex skill: - Start with good structure

    line 27
  3. Distinctive:

    Don't create extraneous files: - No README.md, CHANGELOG.md, etc.

    line 77
  4. Distinctive:

    Analyze: - Read skill.md, identify sections

    line 81
  5. Distinctive:

    Condense: - Create new focused skill.md

    line 84
  6. Distinctive:

    Test: - Verify Claude can still find everything

    line 85
  7. Distinctive:

    Document: - Update progress tracking

    line 86

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
skill.md

Skill Refactoring

Refactor bloated skill.md files to follow best practices using the progressive disclosure pattern.

Platform Support

This skill works for both Claude Code and Codex skills:

  • Claude Code: Skills located in ~/.claude/skills/
  • Codex: Skills located in ~/.codex/skills/

Both platforms use the same skill.md format and 500-line limit.

Purpose

This skill helps refactor large skill.md files into focused, maintainable skills that use reference files for detailed content. Official limit is 500 lines, but targeting shorter is better for context efficiency.

When to Use This Skill

Use this skill when:

  • skill.md approaching 500 lines - Official limit, consider splitting
  • Creating a new complex skill - Start with good structure
  • Skill is hard to navigate - Too much content in one file
  • Adding major new content - Might push skill over limit
  • Reviewing existing skills - Periodic maintenance

Quick Start

# Check skill size
wc -l ~/.claude/skills/my-skill/skill.md

# If large or hard to navigate, invoke this skill:
# "Refactor the my-skill using progressive disclosure pattern"

Reference Files

1. Methodology (references/methodology.md)

Read this for:

  • Step-by-step refactoring process
  • How to analyze and categorize content
  • Creating reference file structure
  • Testing and validation steps

2. Templates (references/templates.md)

Read this for:

  • skill.md template
  • Reference file template
  • Quick start code block template
  • Loading strategy examples

3. Best Practices (references/best-practices.md)

Read this for:

  • Official guidance
  • Progressive disclosure principles
  • What goes in skill.md vs references/
  • Well-structured skill patterns

Loading Strategy

  • Always read methodology.md when refactoring a skill
  • Read for templates templates.md when creating new files
  • Read for guidance best-practices.md when making decisions

Key Principles

  1. Keep skill.md under 500 lines - Official limit; shorter is better for context
  2. Move details to references/ - Implementation, examples, troubleshooting
  3. Include loading strategy - Tell Claude when to read each reference
  4. Preserve all content - Nothing gets deleted, just reorganized
  5. Don't create extraneous files - No README.md, CHANGELOG.md, etc.

Process Overview

  1. Analyze - Read skill.md, identify sections
  2. Plan - Design reference file structure
  3. Extract - Move content to reference files
  4. Condense - Create new focused skill.md
  5. Test - Verify Claude can still find everything
  6. Document - Update progress tracking

Success Criteria

  • skill.md is under 500 lines (shorter is better)
  • All content preserved in references/
  • Clear "when to read" guidance
  • Loading strategy documented
  • Quick start example included
  • No extraneous files (README.md, etc.)

Platform Support

Works for both Claude Code and Codex skills:

  • Claude Code: Skills in ~/.claude/skills/
  • Codex: Skills in ~/.codex/skills/

Both platforms use the same SKILL.md format and progressive disclosure pattern.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.