mcpbeat

Refactor Claude Md

vinta/refactor-claude-md

Use when refactoring a user-level or project-level CLAUDE.md for progressive disclosure

853 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
123
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/vinta/hal-9000 --skill refactor-claude-md

What it tells the agent to use

found in the instruction text
WebFetch fetches pages from the network

The instruction itself

2 sections, as written by the author

Overview

Refactor a CLAUDE.md toward progressive disclosure. Every line it keeps is loaded into every session the file covers, and a frontier model follows only around 150 to 200 standing instructions consistently, so each line competes for that budget. Everything else moves down the ladder or out of the file.

Instructions

  • Pick the target. If the invocation names one, use it. Otherwise ask with AskUserQuestion, one option per file that exists, with the resolved path in the label:
  • The user-level CLAUDE.md at ~/.claude/CLAUDE.md
  • The current project's CLAUDE.md
  • Fetch the yardsticks. Fetch these pages. They calibrate the delete and rewrite verdicts below:
  • https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
  • https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-fable-5
  • https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-opus-5
  • https://www.aihero.dev/a-complete-guide-to-agents-md
  • Audit. Read the file and give every instruction exactly one verdict, judged against the target's bar below. Done when no instruction lacks one.
  • contradiction: conflicts with another instruction. Record both sides.
  • delete: fails the no-op test, meaning the agent would behave the same without it. Covers instructions the agent already follows by default, instructions too vague to act on, and platitudes like "write clean code".
  • demote: real instruction that only applies to some paths or tasks. Pick its destination from the bar. If it describes a multi-step workflow, propose a skill instead. Name the destination in the sign-off.
  • rewrite: right meaning, phrasing falls short of the fetched best practices.
  • keep: earns its always-loaded cost as written.

The bar per target:

  • User-level (loaded into every session in every project): a keep must apply across all projects. Demote destination: a paths:-scoped file in ~/.claude/rules/.
  • Project-level (loaded into every session in this project): a keep must be underivable from the code: a one-sentence project description, commands the agent would guess wrong, domain concepts, gotchas. Lines restating what the code already shows, and volatile detail like file trees, are deletes because they go stale and stale lines poison the context. Demote destinations: a paths:-scoped file in .claude/rules/, or a doc file linked from CLAUDE.md.
  • Get decisions. One AskUserQuestion per contradiction, with each conflicting version as an option. Then present the delete and demote lists for sign-off. The file stays untouched until sign-off.
  • Rewrite. Apply the signed-off verdicts in one pass. When creating a new rules file, fetch https://code.claude.com/docs/en/memory#path-specific-rules for the paths: frontmatter syntax. Done when every audited instruction landed where its verdict says: kept, rewritten, demoted, or deleted.

How to use it

Copy the folder

Take vinta/refactor-claude-md from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.