agentleFS
paulo-yamagishipaulo-yamagishi/claude-code-setup/.claude/skills/refactor-docs/SKILL.md

refactor-docs

Skill2 starsChanged 9 months agoMITView on GitHub

Split oversized or multi-topic docs into focused files with progressive disclosure

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 7 are distinctive, and 4 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.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If $ARGUMENTS is a file path, analyze only that file

    line 20
  2. Very specific:

    If $ARGUMENTS is a directory, analyze all .md files in it

    line 21
  3. Very specific:

    If $ARGUMENTS is empty, scan all .md files in: core/, projects/, templates/, skill/, .claude/skills/, .claude/rules/

    line 22
  4. Distinctive:

    Create new files with extracted content

    line 42
  5. Distinctive:

    Update the original file to reference the new files

    line 43
  6. Very specific:

    Update @import directives in CLAUDE.md if applicable

    line 44
  7. Distinctive:

    Update cross-references in other files that linked to the original

    line 45
  8. Distinctive:

    Verify: After refactor, confirm:

    line 47
  9. Distinctive:

    No broken cross-references (Grep for old paths, check they've been updated)

    line 48
  10. Distinctive:

    All new files are under 300 lines

    line 49
  11. Distinctive:

    No content was lost in the split

    line 50

≈ “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

Refactor Docs

Split oversized or multi-topic documentation files into focused, smaller files following progressive disclosure principles.

Steps

  1. Determine scope:
    • If $ARGUMENTS is a file path, analyze only that file
    • If $ARGUMENTS is a directory, analyze all .md files in it
    • If $ARGUMENTS is empty, scan all .md files in: core/, projects/, templates/, skill/, .claude/skills/, .claude/rules/
  2. Identify candidates: For each file, flag if:
    • Over 300 lines
    • Covers multiple distinct topics (detected by counting ## sections on unrelated subjects)
    • Has large reference sections that could be extracted
  3. Propose split strategy for each flagged file:

    Core guides: Split into {topic}-guide.md (essentials, <150 lines) + {topic}-reference.md (deep-dive details, examples, edge cases)

    CLAUDE.md files: Move detailed sections to separate files importable via @import, keep CLAUDE.md as a concise overview (<100 lines)

    Rule files: Break multi-topic rule files into single-topic files, each with appropriate paths frontmatter for scoped loading

    Skill files: Extract large reference sections into companion files only if the skill exceeds 250 lines (skills should be self-contained where possible)

  4. Present the plan with before/after line counts for each file. Wait for user approval before proceeding.
  5. Execute the refactor:
    • Create new files with extracted content
    • Update the original file to reference the new files
    • Update @import directives in CLAUDE.md if applicable
    • Update cross-references in other files that linked to the original
  6. Verify: After refactor, confirm:
    • No broken cross-references (Grep for old paths, check they've been updated)
    • All new files are under 300 lines
    • No content was lost in the split

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.