If Claude Code seems to ignore your CLAUDE.md or a skill, check whether the rule was loaded and whether the skill was called before you rewrite anything. When I had Claude Code run these layers on my machine, every CLAUDE.md rule that was actually in context held, 45 runs out of 45.
The misses sat in two places. A subfolder CLAUDE.md hadn’t loaded yet when Claude wrote the first file, and a skill whose job the request never named ran late or not at all in 6 of 15 tries. Rewording the rule fixes neither.
Anything that must never happen, like a push to main or a read of .env, is a separate case: no sentence holds it, so it goes in a hook, behind keys the agent never gets.
On this page
Which layer actually missed in our runs
| Layer | What we asked | Result |
|---|---|---|
| CLAUDE.md rule in context | six rules; one buried on line 228 of 309; one against my own “commit the fix” | 45/45 followed |
| Subfolder CLAUDE.md, folder not read first | write two files in src/test/ |
rule missing on all 4 first writes, fixed after |
| Subfolder CLAUDE.md, a file there read first | same | 4/4 from the first write |
| Skill, request names the job | three different descriptions | called 30/30 |
| Skill, request never names the job | same three descriptions | late or never in 6 of 15 |
After /compact |
root, chat-only and subfolder rules | all held 10/10; the subfolder rule only because the summary carried it |
A rule that isn’t in context yet can’t be followed, and a skill that isn’t called can’t shape the output, yet from the outside both look exactly like Claude ignoring you.
Every run was one short task on a tiny repo, so a rule that drifts late in a long multi-turn session is outside what these rows show.
Check what loaded before you rewrite CLAUDE.md
Three commands tell you whether the file or skill is in the session at all:
/context # Memory files: the CLAUDE.md files loaded right now /memory # the same list, and opens them for editing /skills # whether your skill is installed and listed
A skill missing from /skills can’t be called, and the cause is its folder path, name or SKILL.md frontmatter, which our skill-triggering post covers. If it is listed, ask for the job and watch the terminal for a Skill(name) line; without one, the skill wasn’t called, however close the output looks.
When your CLAUDE.md isn’t in the list
Some files are missing from the list by design:
- A subfolder CLAUDE.md and a
.claude/rules/file withpaths:load only when Claude touches a matching file. - With a CLAUDE.md present, an AGENTS.md beside it isn’t read.
- The built-in Explore and Plan subagents start without CLAUDE.md; custom subagents in
.claude/agentsget it.
I learned the subfolder part while adding service-class tests to a Spring Boot side project. The rules in src/test/CLAUDE.md said Korean method names and no @MockBean, yet the tests came back with English names and @MockBean. I assumed the session had gotten long and asked again. Same result.
Then I ran /memory: the root CLAUDE.md and my global file were listed, the src/test one wasn’t. Claude had written the new test file without opening anything in that folder, so the rule was never in play.
I moved the lines to the root file, repeated the request, and the method names came back in Korean.
Current versions do load the subfolder file once Claude writes there, but only after that first write: in my 2.1.322 check the first files lacked the rule and Claude went back to fix them.
If a subfolder rule has to hold on the very first file, put it in the root CLAUDE.md or have Claude read a file in that folder first.
A rule Claude clearly saw but still bends
If the file is listed and the rule still gets broken, don’t start by cutting the file down; in our runs a rule deep in a long file held as well as one near the top. Look at the wording instead: could you check the rule with one command or one look at the diff?
The bend I hit was in my own writing pipeline. A custom agent in .claude/agents that does the final edit had a line in its own definition file: an unconfirmed experience claim gets written as-is or deleted, never softened. It took a draft sentence saying I’d been using a tool for “a few days” and turned it into “from the standpoint of someone actually using it.”
The number was gone, the sentence stayed, and it now read like long use. My marker check passed it because there was no marker to find; I caught it reading the final file top to bottom before upload.
The agent hadn’t missed the rule. It kept the letter, nothing unconfirmed stated as fact, and lost the point.
What fixed it was splitting the instruction into its two allowed outcomes and putting the softened sentence under it as the wrong example, next to what should have happened. In rule form:
Unconfirmed experience claim: keep the sentence as written, or delete it. Wrong: "a few days" -> "from the standpoint of someone actually using it" Right: "a few days" stays, or the sentence goes
Your bent rule takes the same shape: the outcomes you allow, then the output Claude actually gave you, marked wrong. When a violation shows up now, I grep the agent’s definition before anything else to see exactly what it was told.
If the file you think is ignored is a borrowed principles file, such as a Karpathy-style CLAUDE.md, it may be asking for what Claude already does: in our A/B runs it changed behavior only on ambiguous requests.
A skill or old /project: command that never runs
If /skills lists the skill but no Skill(...) line appears, suspect the request before the description. In our runs, rewriting the description changed nothing; how the request was worded did.
My own case was a thumbnail-prompts skill. I asked for a few picture ideas for the top of a post, a request that never says thumbnail, and got three or four lines of scene ideas with no Skill line above them.
I opened SKILL.md first; it was fine. Typing /thumbnail-prompts got the real output, and for requests worded that loosely I now start with the name.
So when the format matters, type /skill-name instead of describing the task. Old custom commands are skills now: files in .claude/commands/ still work, but the /project: prefix is gone, so type the bare name.
Rules that seem gone after /compact
Before adding a hook, check where the forgotten instruction lived. Claude Code re-reads the root CLAUDE.md from disk after /compact.
Anything you said only in chat survives only if the compaction summary copies it, and a subfolder CLAUDE.md waits until Claude touches that folder again. In our short compaction runs the summary did copy both, but what it copies isn’t up to you.
Mine went the other way in a side project. After an auto-compact, Claude again proposed an approach I’d turned down earlier in the chat, and I had to steer it back. The compaction summary said that approach had been considered and left out why I’d dropped it.
What has helped most since is one line in CLAUDE.md per decision, with the reason attached; it’s still there after an auto-compact, an idle compact or a fresh session.
Keep a SessionStart hook with matcher compact for a short note that must reappear after every compaction. In our runs its output came back all 10 times.
Pushes and .env reads: move them to a hook or sandbox
A rule Claude follows every time still can’t promise that something never happens once. In our runs it kept “never run git commit” even when I asked it to commit. But the official memory docs call CLAUDE.md context, not enforced configuration, and a permissions.deny rule matches only the command string it’s written for.
I found this out testing my deny list in headless runs. cat, source and python3 -c came back denied one after another. Then one line went through and printed the whole file, including the fake key I had planted:
node -e "console.log(require('fs').readFileSync('.env','utf8'))"
I ran the same prompt again before touching settings.json, in case it was a fluke, and got the same output. My six deny lines covered python3 -c and had nothing for node, and a Python script Claude wrote and then ran, python3 read_env.py, got through the same day.
Blocking one interpreter at a time never ends, so put each must-never item where a sentence can’t reach it:
- Keys: give the agent’s shell a narrow dev key instead of real ones, and add a PreToolUse hook that exits with code 2 when a Bash command mentions
.env(below). The command is blocked and Claude gets the hook’s message. - Pushes: keep push credentials out of the agent’s environment and let branch protection and CI guard main.
- A folder it must not edit, say
legacy/: turn on/sandbox, which keeps shell commands writing inside the working folder, list./legacyundersandbox.filesystem.denyWrite, and addEdit(/legacy/**)topermissions.deny. The sandbox covers shell commands only, so Claude’s own file edits need the deny rule.
The .env hook is two pieces. In .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-env.sh" }
]
}
]
}
}
And .claude/hooks/block-env.sh, made executable with chmod +x (it needs jq):
#!/bin/bash cmd=$(jq -r '.tool_input.command // empty') if [[ "$cmd" == *".env"* ]]; then echo "Blocked: this command touches .env" >&2 exit 2 fi exit 0
It catches the node -e line above because it looks for .env anywhere in the command, whatever the interpreter. It would not have caught python3 read_env.py, whose command never says .env, so the narrow key still comes first.
Then confirm the hook runs: /hooks lists it, and the matcher is case-sensitive. My first hook said "bash" and never fired, with no error; the .env read went straight through, and I only noticed because the log file my script wrote on its first line never appeared. "Bash" fixed it.
Sources
- Research note: the layer table behind this post, the new subfolder CLAUDE.md check, and which official causes our runs actually showed, loopnotes-lab on GitHub, 2026-11-15: every count in the table, with versions, models and limits
- When Claude Code ignores your setup, loopnotes-lab topics, 2026-11-15: the measurements behind each post in this group
- How Claude remembers your project, Claude Code Docs, checked 2026-11-15: CLAUDE.md as context not enforced configuration, when subfolder and
paths:files load, AGENTS.md skipped when CLAUDE.md exists, root file re-read after/compact - Debug your configuration, Claude Code Docs, checked 2026-11-15:
/context,/memory,/skills, Explore and Plan skipping CLAUDE.md, Bash deny rules matching the literal command string, case-sensitive hook matchers - Hooks reference, Claude Code Docs, checked 2026-11-15: exit code 2 blocking a PreToolUse call,
/hooks, SessionStart matchercompact
Show 3 more sources
- Automate actions with hooks, Claude Code Docs, checked 2026-11-15: PreToolUse settings shape,
$CLAUDE_PROJECT_DIRscript path,jqreadingtool_input, exit 2 with a stderr message - Sandboxing and settings reference, Claude Code Docs, checked 2026-11-15:
/sandbox, default writable paths,sandbox.filesystem.denyWritewith./paths, sandbox covering shell commands only - Extend Claude with skills, Claude Code Docs, checked 2026-11-15: custom commands merged into skills,
.claude/commands/files still working, calling a skill with/skill-name