# Claude md refactor

> Claude md refactor is an open-source agent skill for developer tools. Trims a repo's CLAUDE.md into a lean index with topic docs under /docs. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/vpaivag/skills/tree/main/skills/claude-md-refactor
- **Repository:** https://github.com/vpaivag/skills
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** claude-md-refactor
- **Collection:** https://github.com/vpaivag/skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill helps an agent audit an oversized CLAUDE.md, bootstrap one for a repository that has none, or confirm that a short file is already healthy and should be left alone. The core idea is progressive disclosure: hard rules and tooling identity stay in the root file, while procedural playbooks and pattern explanations move into separate files under /docs that are read only when relevant.

When auditing, the agent reads the file end to end, classifies each block as keep, extract or drop, and shows a plan before writing anything. When bootstrapping, it explores the repository's manifests, layout and tests, proposes which topic docs to create, and checks that any referenced class, command or file actually exists before documenting it. Convention docs must describe design rules backed by real examples rather than style nits.

The skill expects a repository with a CLAUDE.md or enough code to bootstrap one, and it works with the user's own wording when extracting existing prose. It ships a template file for the root index and does not run scripts.

## When your agent uses it

> Refactor, audit, or bootstrap a repository's CLAUDE.md so it stays lean and acts as an index of pointers to /docs/ files instead of bloating session context. Use this skill whenever the user mentions their CLAUDE.md being too long, bloated, eating context, "collapsing context", needing cleanup, or asks to set up / audit / split / restructure / generate a CLAUDE.md, even if they don't use the word "skill" or "refactor" — also use it when the user wants project memory or AGENTS.md style instructions organized for both humans and agents.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/vpaivag/skills/tree/HEAD/skills/claude-md-refactor)
- [License: MIT](https://github.com/vpaivag/skills/tree/HEAD/skills/claude-md-refactor)

## Features

- **Audit and split:** Classifies each section of an existing CLAUDE.md as keep, extract or drop before moving content.
- **Bootstrap from code:** Explores manifests, layout and tests to propose topic docs for a repo with no CLAUDE.md.
- **Pointer-based index:** Rewrites the root file as a short list of hard rules and links to docs.
- **Verify before documenting:** Confirms that referenced symbols and paths exist before writing about them.
- **Healthy file check:** Recognises a lean CLAUDE.md and avoids over-editing it.
- **Convention doc rules:** Guides writing design rules for code conventions with real examples.

## Good for

- Shrink a bloated CLAUDE.md that is eating session context
- Set up a CLAUDE.md and docs folder for a new repository
- Split deployment or testing playbooks out of the root memory file
- Check whether an existing CLAUDE.md needs any changes at all

## Install

### Claude Code

This skill ships in the `skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add vpaivag/skills
/plugin install skills@vpaivag
```

Or copy only this skill to `~/.claude/skills/claude-md-refactor`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/vpaivag/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/claude-md-refactor &&
cp -R "$tmp/skills/claude-md-refactor" ~/.claude/skills/claude-md-refactor &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/claude-md-refactor` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/claude-md-refactor` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/vpaivag/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/claude-md-refactor &&
cp -R "$tmp/skills/claude-md-refactor" ~/.agents/skills/claude-md-refactor &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/claude-md-refactor` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/claude-md-refactor` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/vpaivag/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/claude-md-refactor &&
cp -R "$tmp/skills/claude-md-refactor" ~/.cursor/skills/claude-md-refactor &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/claude-md-refactor` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/vpaivag/skills.git --path skills/claude-md-refactor
```

Or copy the folder to `~/.gemini/skills/claude-md-refactor` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/claude-md-refactor`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/vpaivag/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/claude-md-refactor &&
cp -R "$tmp/skills/claude-md-refactor" ~/.copilot/skills/claude-md-refactor &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/claude-md-refactor` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/vpaivag/skills.git
```

Then copy `skills/skills/claude-md-refactor` into your agent's skills folder as `claude-md-refactor`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Claude md refactor trigger?

When the user mentions a CLAUDE.md being too long, bloated, eating context, needing cleanup, or asks to set up, audit, split or restructure one, including AGENTS.md style instructions.

### Will Claude md refactor rewrite my existing instructions?

When extracting, it aims to preserve the user's own wording and lightly clean formatting. It asks before removing @import lines or tool-specific syntax.

### Does Claude md refactor change files without asking?

In interactive use it shows a classification or file plan and waits for confirmation. In a non-interactive run it writes the plan to plan.md and proceeds.

### How do I install Claude md refactor in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/claude-md-refactor to use it in all your projects, or to .claude/skills/claude-md-refactor in one project. Or install the skills plugin, which includes it: /plugin marketplace add vpaivag/skills, then /plugin install skills@vpaivag.

### Does Claude md refactor run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Claude md refactor?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Claude md refactor?

The closest alternatives to Claude md refactor are Codebase onboarding, Project retrofit, Setup matt pocock skills, Agents md and Agents md improver.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Codebase onboarding](https://ai-powered.com/skills/codebase-onboarding): Codebase onboarding is an open-source agent skill for developer tools.
- [Project retrofit](https://ai-powered.com/skills/project-retrofit): Project retrofit is an open-source agent skill for developer tools.
- [Setup matt pocock skills](https://ai-powered.com/skills/setup-matt-pocock-skills): Setup matt pocock skills is an open-source agent skill for developer tools.
- [Agents md](https://ai-powered.com/skills/agents-md): Agents md is an open-source agent skill for files and documents.
- [Agents md improver](https://ai-powered.com/skills/agents-md-improver): Agents md improver is an open-source agent skill for developer tools.
- [Setup repo skills](https://ai-powered.com/skills/setup-repo-skills): Setup repo skills is an open-source agent skill for developer tools.
- [Skill update](https://ai-powered.com/skills/skill-update): Skill update is an open-source agent skill for developer tools.
- [Refactor](https://ai-powered.com/skills/refactor-kzytateishi): Refactor is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/claude-md-refactor
