refactor-instructions

Installation
SKILL.md

Refactor Instructions

Refactor monolithic instruction files into a minimal root, scoped .claude/rules/ files, and reference docs.

Why this matters

  • The root file loads on every request. A bloated file steals tokens from the actual task and pushes the agent past its effective instruction budget (~150–200 rules before attention drops).
  • .claude/rules/ files with paths: globs load only when matching files are touched — scoped rules keep the base context lean without losing coverage.
  • Stale docs poison context. File paths rot fastest — describe capabilities, not structure.
  • Instruction files grow as balls of mud when rules are added reactively after every agent misstep. Small and focused beats comprehensive.

Process

  1. Detect scope. If a path argument was given ($ARGUMENTS), use that file as the target. Otherwise, use AskUserQuestion to ask which scope to refactor: project-level .claude/CLAUDE.md, user-level ~/.claude/CLAUDE.md, or both. Then scan for CLAUDE.md, AGENTS.md, and .claude/rules/*.md at the chosen scope. In monorepos, also check **/CLAUDE.md. If both CLAUDE.md and AGENTS.md exist with different content, surface this — they may want a symlink. Determine docs location: use existing docs/ if present at repo root, else default to .claude/docs/. When working at project level, also read ~/.claude/CLAUDE.md and ~/.claude/rules/*.md read-only for contradiction checking.

  2. Read every target file in full — root files and every .claude/rules/ file — before proposing anything. Do not rely on skimming.

  3. Find contradictions. Check across all sources: root vs rules, rules vs rules, project-level vs user-level. List every conflicting pair. For each, use AskUserQuestion to ask which version to keep. Do not silently pick.

Installs
6
GitHub Stars
4
First Seen
Apr 22, 2026
refactor-instructions — benjaming/ai-skills