Explore skills

Blog / Authoring

Turning a CLAUDE.md Section Into a Skill

How to move a procedure out of CLAUDE.md into a SKILL.md: pick the section, write the description, split the body, test that it fires. With a worked example.

Turning a CLAUDE.md Section Into a Skill

Pick a section of CLAUDE.md that is a procedure, give it a folder and a SKILL.md with a specific description, move the steps over, and test that it fires. Your CLAUDE.md gets shorter and the procedure loads only when the task needs it.

Table of contents

The short answer

Converting a CLAUDE.md section into a skill is mostly a text edit. You create a folder .claude/skills/<name>/, put a SKILL.md in it with a name and a description, paste the section under the frontmatter, and delete it from CLAUDE.md. Two parts take real thought: choosing which section to move, and writing the description so Claude knows when to load it.

Claude Code's memory documentation gives the rule for the first part: if an entry "is a multi-step procedure or only matters for one part of the codebase," move it "to a skill or a path-scoped rule instead" (Claude Code memory docs, checked 2026-11-23). The same page says to "target under 200 lines per CLAUDE.md file." Most files that have grown past that limit grew because of procedures.

I build AI agents full-time, and instruction files that grow one "remember to..." line at a time are the ones I see most. This article is based on the official docs for Claude Code and Anthropic's Agent Skills, read on 2026-11-23 and 2026-11-24. The worked example below uses a sample CLAUDE.md section written to make the steps concrete, and I say where the docs give no number.

If you are still deciding whether something belongs in CLAUDE.md, a skill or AGENTS.md at all, read SKILL.md vs CLAUDE.md vs AGENTS.md first. This post assumes you have decided and want to do the move.

Which sections should move

Not every section should become a skill. A skill adds a cost of its own: its name and description sit in context on every turn. The Claude Code skills docs say so directly: "Every skill in the skill listing adds to your context on every turn, whether or not Claude ever uses it" (skills docs). A one-line rule that applies to every task is cheaper left in CLAUDE.md. Moving it would add a description and a trigger to something Claude needs anyway.

The test I use has three questions. Say yes to at least two and the section is a candidate.

  1. Is it a procedure? Numbered steps, a checklist, a "when X happens, do A then B then C" flow. Facts like "we use pnpm" are not procedures.
  2. Does it matter for only some tasks? A release checklist matters on release days. A migration runbook matters when you touch the schema. If a session can go a full day without needing it, it is a candidate.
  3. Is it long? Ten lines of steps cost little. Sixty lines of steps loaded into every session add up, and the memory docs' 200-line target exists for this reason.

Sections that usually pass:

  • Release, deploy and rollback checklists.
  • Database migration or data backfill runbooks.
  • "How to add a new endpoint/component/job" recipes with several steps.
  • Review rules for one kind of artifact, such as accessibility rules for new UI components.
  • Long reference material: an error-code table, an API quirk list, a naming guide for one subsystem.

Sections that usually fail, and should stay:

  • Commands to build, test and lint.
  • The directory map.
  • Hard "never do this" rules that apply everywhere.
  • Style conventions that touch every file.

There is a third home for content that matters only in one folder. The memory docs mention .claude/rules/, where rules can be scoped to paths. If a section is really "what to know when editing payments/," a path-scoped rule or a nested CLAUDE.md fits better than a skill, because the trigger is a location and not a type of task.

To see what your instructions currently cost, run /context in Claude Code, which shows what is using space in a session. For the cost side of skills in more detail, see the post on Claude skills token cost.

Step by step

Here is the whole conversion in order. Each step is small.

1. Pick one section and copy it out

Do one at a time. Open CLAUDE.md, select the whole section including its heading, and copy it to a scratch file. Do not delete it from CLAUDE.md yet. A skill that never fires leaves you with a procedure that exists nowhere Claude reads, so keep the original until step 7.

2. Name the skill and create the folder

Skills live in one of a few places, per the skills docs:

Location Path Who gets it
Personal ~/.claude/skills/<skill-name>/SKILL.md All your projects on this machine
Project .claude/skills/<skill-name>/SKILL.md The repository; "Commit it so your team gets it too"
Plugin <plugin>/skills/<skill-name>/SKILL.md Wherever the plugin is installed

Source: Claude Code skills docs, checked 2026-11-23.

A section of a project CLAUDE.md is usually project knowledge, so it goes in .claude/skills/ and gets committed with the repository. A section of your personal ~/.claude/CLAUDE.md goes in ~/.claude/skills/.

The name has limits: at most 64 characters, lowercase letters, numbers and hyphens, and it cannot contain anthropic or claude (Anthropic best practices, checked 2026-11-24). Pick a name that says the job: release-checklist, db-migration, a11y-review. Not helper and not notes.

3. Write the frontmatter, description first

Create SKILL.md and add the two required fields:

---
name: db-migration
description: Writes and applies database migrations for this repo. Use when the user asks to change the schema, add a column or table, backfill data, or roll back a migration.
---

The description is where conversion goes wrong, because a CLAUDE.md section has no description at all. It has a heading. A heading is not enough. Anthropic's best practices say the description "should describe what the Skill does and when to use it," that it is limited to 1,024 characters, and that Claude "uses it to choose the right Skill from potentially 100+ available Skills." They also say to write in third person: "The description is injected into the system prompt, and inconsistent point-of-view can cause discovery problems."

A CLAUDE.md section is often written in the imperative or the first person ("remember to run the migration dry run"). The description should not copy that voice. Compare:

Bad Better
Migration notes Writes and applies database migrations for this repo. Use when the user asks to change the schema, add a column or table, backfill data, or roll back a migration.
I can help you with migrations Same line as above; avoid "I" and "you"

The vague forms Anthropic lists ("Helps with documents", "Processes data", "Does stuff with files") fail for the same reason. Put the trigger phrases a user would actually type into the description. The Claude Code docs add that the combined description and when_to_use text is truncated at 1,536 characters in the skill listing, so put the key use case first.

The full method, with before-and-after rewrites and a test loop, is in How to write a SKILL.md description that triggers. Read it before step 3 if your skill does not fire.

4. Move the body and rewrite it as instructions for the job

Paste the section under the frontmatter. Then make three edits:

  • Drop the context that CLAUDE.md already gives. If the section said "our stack is Postgres 15 with Prisma," and CLAUDE.md still says it in the project overview, do not repeat it. If it is only true for this job, keep it.
  • Make the steps self-contained. In CLAUDE.md a section can lean on a neighbor ("see the testing section above"). In a skill, the reader arrives with only the skill. Copy the one command you need or link to a file.
  • Write what to do, in order. A skill is a procedure. Number the steps, say what "done" looks like, and put stop conditions in ("stop if the dry run shows a destructive change").

Anthropic's best practices recommend keeping the SKILL.md body under 500 lines. A converted section is almost always far below that.

5. Split long reference material into files

If the section includes a long table or a runbook with rarely used branches, put it in a separate file in the skill folder and link to it from SKILL.md. The best-practices page describes SKILL.md as "an overview that points Claude to detailed materials as needed, like a table of contents in an onboarding guide." It also says bundled resources have no context penalty until accessed, to keep references one level deep from SKILL.md, and to add a table of contents at the top of reference files longer than 100 lines. Use forward slashes in paths, even on Windows.

.claude/skills/db-migration/
  SKILL.md
  rollback.md
  naming.md

The progressive disclosure post covers this in more depth: the body stays short, and the heavy material loads only on the branch that needs it.

6. Decide whether to leave a pointer in CLAUDE.md

After the move, CLAUDE.md has a hole where the section was. Two options:

  • Leave nothing. If the description is specific, Claude finds the skill by itself. This is the default.
  • Leave one line. Something like Schema changes: use the db-migration skill. This is a cheap hint when the trigger is subtle, for example when users rarely say the word "migration" but do say "update the model."

I leave a pointer only when I have seen the skill miss. One line costs little, but a CLAUDE.md full of pointers to skills is the long file you were trying to get rid of.

7. Delete the original and reload

Once the skill works (see Check that it worked below), delete the section from CLAUDE.md. Claude Code picks up skill changes within the current session, and "If a new skill doesn't appear, run /reload-skills" (skills docs).

8. Repeat for the next section

Do one conversion, use it for a few days, and then do the next. Doing six at once leaves you unable to tell which skill broke what.

A worked example

This is a sample written to make the steps concrete.

Here is a section from a hypothetical project CLAUDE.md, about 30 lines in the real version and shortened here:

## Database migrations

When you need to change the schema:

1. Never edit an existing migration file. Always add a new one.
2. Run `pnpm db:migrate:new <name>` to create it. Names are snake_case,
   verb first: `add_user_email_index`.
3. Write the up and the down. Every migration needs a working down.
4. Run `pnpm db:migrate:dry` and read the output. If it shows DROP or
   a column type change, stop and ask the user before continuing.
5. Run `pnpm db:migrate`, then `pnpm test:db`.
6. For backfills on tables over a million rows, do them in a separate
   migration, in batches of 10,000.

Apply the test. It is a procedure (yes). It matters only when the schema changes (yes). It is long once you add the rest of the real version (yes). It moves.

The result in .claude/skills/db-migration/SKILL.md:

---
name: db-migration
description: Writes and applies database migrations for this repo. Use when the user asks to change the schema, add a column, table or index, backfill data, or roll back a migration.
---

# Database migrations

1. Never edit an existing migration file. Add a new one.
2. Create it with `pnpm db:migrate:new <name>`. Names are snake_case, verb
   first, like `add_user_email_index`.
3. Write both the up and the down. Every migration needs a working down.
4. Run `pnpm db:migrate:dry` and read the output. If it shows a DROP or a
   column type change, stop and ask the user before continuing.
5. Run `pnpm db:migrate`, then `pnpm test:db`.
6. Backfills on large tables go in their own migration. See
   [backfills.md](backfills.md) for batch sizes and the long-table rules.

Done means: the new migration file exists, the dry run was read, and
`pnpm test:db` passes.

What changed, and why:

  • The heading became a description. "Database migrations" told a human where the section was. The description tells Claude when to load the skill and lists the words a user would say: schema, column, table, index, backfill, roll back.
  • "When you need to change the schema" was dropped. That trigger moved into the description, where it does its job.
  • The backfill rule moved to a reference file. It matters in one branch of one procedure. SKILL.md links to backfills.md, so those lines load only if the task involves a backfill.
  • A definition of done was added. The CLAUDE.md version ended with a step. The skill says what finished looks like.
  • A line may remain in CLAUDE.md. If the skill misses, add Schema changes: use the db-migration skill. under your commands list. Otherwise leave it out.

CLAUDE.md lost the whole section and gained nothing. Claude Code still lists the skill's name and description every turn, which is the entire standing cost.

Skills like this also exist ready-made. If you have not written a skill before, skill-creator by @oscar_schmidt is a catalog skill for creating new skills, and its page shows the description and README without an account.

What stays in CLAUDE.md

After you have moved the procedures, what is left should read like a first-day note to a new teammate. In the example repository, that would be:

# Project notes

- Package manager: pnpm. Never run npm install.
- Tests: `pnpm test` for unit tests, `pnpm test:db` for the database.
- API handlers live in `src/api/`; shared types in `src/types/`.
- Schema changes: use the db-migration skill.

That last line is the optional pointer. Everything above it is true for every task, so it earns its place in every session.

Two cleanups are worth doing while you are in the file:

  • Delete stale lines. A conversion is a good moment to read every line and ask whether it is still true. Lines that describe a tool you stopped using cost tokens and mislead.
  • Use imports for long standing material. CLAUDE.md can pull in other files with the @path/to/import syntax, so a long document you do want loaded every session can live in its own file. This is for always-true content. A procedure should not be imported, it should be a skill.

If you want help auditing the file, the catalog has skills for it. claude-md-improver by @andrebrown29 describes itself as auditing and improving CLAUDE.md files in repositories, and creating-claude-md by @marcoy covers creating one from scratch (both pages checked 2026-11-24).

Check that it worked

A converted skill can fail in three ways: it never fires, it fires on the wrong tasks, or it fires but misses something that used to be in CLAUDE.md. Each has a cheap check.

Does it fire? Start a fresh session and ask for the task in the words a teammate would use: "add an index on users.email." Watch whether Claude loads the skill. You can also type /db-migration to invoke it directly, since by default "both you and Claude can invoke any skill" (skills docs). If invoking by hand works but asking in plain words does not, the body is fine and the description is the problem. Add the missing trigger words, and see the description post.

Does it fire too often? If it loads on tasks that have nothing to do with it, the description is too broad. Narrow the "Use when" clause. If you want it only on request, the docs describe disable-model-invocation: true, which stops Claude from loading it automatically so you trigger it with /name. That fits dangerous or rare workflows such as a production deploy.

Did you lose anything? Diff the old section against the skill body. Anything you dropped should be a choice. This is the place to catch a rule that lived in the section's intro paragraph.

What does it cost? Run /skill-doctor, which per the docs shows what each skill costs and how often it is used (needs Claude Code v2.1.252 or later). /context shows the size of the Skills row, so run it before and after the move to see your own saving. The structural gain is fixed: the body is out of the always-loaded file.

For a full test loop, including checking behavior across models, see Test a skill before publishing it. Anthropic's best practices recommend building evaluations before extensive documentation, and testing with Haiku, Sonnet and Opus, since "What works perfectly for Opus might need more detail for Haiku."

Common mistakes

Moving everything. A skill for a one-line rule adds a description to every turn for no gain. Keep always-true facts in CLAUDE.md.

Keeping the heading as the description. "Release process" is a label. Write what the skill does and when to use it, in third person.

Deleting the original first. If the skill does not fire, the procedure is gone from every place Claude looks. Copy, test, then delete.

Assuming skill content stays fresh. Per the docs, once a skill is invoked its content enters the conversation as a single message and stays there, and Claude Code does not re-read the file on later turns. If you edit a skill mid-session, expect the new text only on the next invocation or session.

Cross-references that no longer resolve. A CLAUDE.md section that said "see the testing section" now points at nothing. Make the skill self-contained.

Reference files nested two levels deep. Anthropic says Claude "might partially read files when they're referenced from other referenced files," so link each reference file directly from SKILL.md.

Leaving the procedure in both places. Two copies drift. After the move, the CLAUDE.md copy is the stale one.

Where Ragspaces fits

Ragspaces is an open catalog of 5,299 agent skills for Claude Code and Codex (home page count on 2026-11-23). It has no part in the conversion itself, which is a text edit in your repository. Where it helps is after: once your CLAUDE.md procedures are skills, they are folders you can keep in sync across computers or share with a team, which a section of a CLAUDE.md file is not. Free skills install into your own Claude Code or Codex with one command. A skill you keep private stays visible only to you. See how it works for the sync details.

For skills that already exist, installing from a catalog is covered in how to install a Claude Code skill. For how skills relate to MCP servers and plugins, see Claude skills vs MCP servers vs plugins.

Frequently asked questions

How do I convert a CLAUDE.md section into a skill?

Create .claude/skills/<name>/SKILL.md with a name and a description that says what the skill does and when to use it. Paste the section under the frontmatter, make the steps self-contained, and delete it from CLAUDE.md once the skill fires when you ask for the task in plain words.

Which CLAUDE.md sections should become skills?

Procedures that matter only for some tasks, such as release checklists, migration runbooks and how-to recipes. Claude Code's docs say a multi-step procedure, or an entry that matters for only one part of the codebase, should move to a skill or a path-scoped rule. Keep always-true facts and commands in CLAUDE.md.

Do I need to leave a pointer to the skill in CLAUDE.md?

Usually not. Claude chooses skills from their descriptions, so a specific description is enough. Add a one-line hint, such as "Schema changes: use the db-migration skill," only if the skill misses on realistic requests.

How long should the new SKILL.md be?

Anthropic's best practices say to keep the SKILL.md body under 500 lines and to split larger content into separate files linked from SKILL.md. A converted CLAUDE.md section is usually well under that.

Why is my new skill not triggering?

The usual cause is the description. A heading copied from CLAUDE.md does not say when to use the skill. Rewrite it in third person with what the skill does and the words a user would type. Run /reload-skills if the skill does not appear at all.

Should the skill live in the project or in my home folder?

Use .claude/skills/ in the repository for project procedures, so teammates get them when they pull. Use ~/.claude/skills/ for personal procedures that apply across all your projects on that machine.

Key takeaways

  • Move procedures and rarely needed material out of CLAUDE.md. Keep facts, commands and global rules.
  • A skill needs a specific, third-person description that says what it does and when to use it. A heading is not a description.
  • Copy first, test that it fires in a fresh session, then delete the original section.
  • Put long reference material in files linked from SKILL.md, one level deep.
  • Each skill costs its description in every turn, so do not convert one-line rules.

The bottom line

Convert the sections that read like runbooks, and leave the ones that read like a first-day note. The description is the part to spend your time on. To read how others write theirs before you write yours, browse the Ragspaces catalog. Every skill page shows its description and README with no account.

Related articles

About this research

Dmitry Makarenko co-founded Zipy as VP R&D, leading 50+ engineers across five countries, and now builds AI agents full-time. (LinkedIn)

This article is based on the Claude Code documentation (memory, skills), Anthropic's Agent Skills best practices, and the Ragspaces skill pages, read on 2026-11-23 and 2026-11-24. The worked example is a sample written for illustration. Content reviewed and updated: 2026-11-26

Keep reading