Keep CLAUDE.md short without losing your rules

A shorter CLAUDE.md Claude follows more closely, with job rules moved out but still findable.

CLAUDE.mdToo long. Every job reads all of it.Rules for one kind of job move out.
One file per job, in .claude/jobs/
  • emails.md
  • invoices.md
  • reports.md
Moved word for word.
CLAUDE.mdUnder about 200 lines, plus one pointer per job
  • Emails: read emails.md first
  • Invoices: read invoices.md first
Opened when the job comes up
  1. A long CLAUDE.md is read in full on every job, so Claude follows each rule less closely.
  2. Rules for one kind of job move, word for word, into their own files in .claude/jobs/, such as emails.md, invoices.md and reports.md.
  3. CLAUDE.md keeps the everyday rules and one pointer line per file. Claude opens the job file when that job comes up.
20 minNo code

You need

  • Claude Code
  • A project with a long CLAUDE.md

The more rules you put in CLAUDE.md, the less closely Claude follows them. It is the file Claude Code reads at the start of every session, so everything in it is competing for attention on every job, including jobs it has nothing to do with.

Anthropic's memory docs say it plainly: aim for under 200 lines per CLAUDE.md file, because longer files use more context and reduce how closely Claude follows them. This guide is how to get there without throwing your rules away.

01 / 05

The split in five steps

1. Count your lines

In Claude Code, ask: How many lines is my CLAUDE.md, and what are its section headings? Under about 200 is the target.

2. Decide what stays and what moves

Stays (applies to almost every job):

  • Who you are and how you like answers.
  • Rules that apply every time, such as "ask before spending money".
  • The one-line pointers from step 4.

Moves out (applies to one kind of job):

  • How you write emails, do invoices, review code or format reports.
  • Long examples and templates.
  • Anything Claude can work out by reading your files.

Anthropic's best-practices page says CLAUDE.md works best when it holds only what Claude cannot work out from your files. A good test for each line: would removing it cause mistakes? If not, cut it.

3. Move each job into its own file

Make a plain folder for the files, such as .claude/jobs/, with one file per job: emails.md, invoices.md, reports.md.

One thing to avoid: do not put them in .claude/rules/. According to Anthropic's memory docs, rule files there load at launch unless they have a paths setting, so moving rules into that folder does not shrink what Claude reads every session. Rule files with a paths setting load only when Claude works on matching files, which is a second option.

Paste this and let Claude do the move:

Split my CLAUDE.md
Help me shorten my CLAUDE.md by moving job-specific rules into their own files. Do these steps in order and wait for my yes before you change anything. 1. Read CLAUDE.md. Tell me how many lines it has and list its section headings. 2. Sort every section into two groups: - STAYS: rules that apply to almost every job (who I am, how I like answers, things you must always ask me first). - MOVES: rules that only matter for one kind of job (emails, invoices, reports, reviews), long lists of examples, and anything you could work out by reading my files. For each line, ask: would removing this cause you to make mistakes? If not, suggest cutting it and tell me. 3. Show me the plan: the list of new files (one per job, in a folder called .claude/jobs/, named for the job) and the pointer line that will replace each moved section, in this form: - JOB: read .claude/jobs/FILE.md before DOING THAT KIND OF JOB. Do not use the folder .claude/rules/ for these files. 4. Wait for my yes. Then save a copy of the original as CLAUDE.backup.md, create the job files with the moved text word for word, and replace each moved section with its pointer line. Do not rewrite or reword my rules. 5. Show me the new CLAUDE.md, the line count, and the list of new files. 6. Tell me, in 3 lines, how to test it: start a new session, ask for one of the moved jobs, and check that you open the job file before you start.
1,421 characters

4. Add one pointer line per file

This is what stays in CLAUDE.md for each moved job:

Example pointer lines
CLAUDE.md
- Emails: read .claude/jobs/emails.md before writing or editing any email.
- Invoices: read .claude/jobs/invoices.md before creating an invoice.
- Reports: read .claude/jobs/reports.md before building a weekly report.

Claude opens the file when the job comes up. A pointer line is a request, not a lock, so check in a new session that it does. Do not use an @ import for this: Anthropic's docs say imports organize a long file but do not reduce its context cost, because imported files load with the CLAUDE.md that imports them.

5. Put rare jobs in a skill

If a job has its own steps and comes up rarely ("run the monthly client audit"), make it a skill. A skill is a folder with a file called SKILL.md. Anthropic's best-practices page says a skill Claude can start on its own shows Claude only its name and description each session, and the full file is read when the task calls for it.

Skill template for a rare job
SKILL.md
---
name: JOB-NAME
description: DO THE JOB. Use when I ask for THE JOB IN MY WORDS.
---
# JOB TITLE

Steps:
1. FIRST STEP
2. SECOND STEP
3. THIRD STEP

Rules for this job:
- A RULE THAT ONLY MATTERS HERE

Output: WHAT TO HAND BACK, AND WHERE TO SAVE IT

Save it as ~/.claude/skills/JOB-NAME/SKILL.md for all projects, or .claude/skills/JOB-NAME/SKILL.md for one. Windows: C:\Users\YOU\.claude\skills\JOB-NAME\SKILL.md. The description line is how Claude decides when to use it, so write it as "Use when I ask for ...".

Download the ZIP for the split prompt, the skill template and the optional line-cap hook.

02 / 05

If one rule still gets skipped

An older habit is to mark the line IMPORTANT. Anthropic's best-practices page now says that probably will not fix it. Either the file has grown long enough that the line gets lost, so shorten it, or it is a rule with no exceptions, and that belongs in a hook. Do not add a second copy of the rule.

03 / 05

Optional: a hard 200-line cap

A written limit is advice. A hook is a small script Claude Code runs automatically, and it can say no. The kit's claudemd-linecap.js blocks any edit that would push a file named CLAUDE.md past 200 lines and tells Claude to move something out instead. It still lets you trim a file that is already too long.

  1. Copy claudemd-linecap.js to ~/.claude/hooks/ (create the folder if needed).

  2. In your Claude Code settings file, add a PreToolUse hook with the matcher Edit|Write. The kit has a ready-made settings-snippet.json to copy from, and Anthropic's hooks guide shows the same shape.

  3. Set its command to node followed by the real full path to the file (on Windows, forward slashes, for example C:/Users/YOU/.claude/hooks/claudemd-linecap.js).

  4. Restart Claude Code. Ask Claude to paste 250 lines into a copy named CLAUDE.md in a scratch folder. It should be blocked.

It needs Node.js (node --version prints a number). Without Node, skip this part. The written rules work without it. To remove it, delete the entry from your settings.

04 / 05

Test it safely

  1. Save a backup of your CLAUDE.md first. The prompt does this, but check the file exists.

  2. After the split, start a new session and ask for one of the moved jobs, such as an email.

  3. Watch whether Claude opens the job file before it starts. If it does not, make the pointer line more specific about when to read it.

Where was this tested? The line-cap hook was run on made-up edit requests (a 250-line write was blocked, a 100-line write and a one-line edit were allowed). The split prompt and the pointer lines were not run in a live Claude Code session for this guide, and neither was the hook inside one. Treat both as a first draft and check the result.

Common mistakes

  1. Putting job files in .claude/rules/. They still load every session.

  2. Rewording rules while moving them. Move them word for word.

  3. Using @ imports to "move" rules. They still count against the context.

  4. Never checking a pointer works. Test in a new session.

  5. Piling emphasis on a skipped rule. Shorten the file or use a hook.

What is a CLAUDE.md?

A file Claude Code reads at the start of every session, with your standing instructions. It can live in your project or in your home folder.

Is 200 lines a hard limit?

No. It is Anthropic's recommended target. The hook in the kit makes it a hard limit if you want one.

Will Claude always read the job file?

Not always. A pointer line is a request. Test it, and if a rule must never bend, use a hook.

Do I need to code?

Not for the split. The optional hook needs Node.js and a small settings edit.

Finish line

What to do next

  1. Ask Claude how many lines your CLAUDE.md has.

  2. If it is over 200, paste the split prompt and read the plan.

  3. Test one moved job in a new session.

Back to all the free guides. Two that pair well with this one: teach Claude your business and build your first Claude skill.

You reached the end of the guide