{"slug": "keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it", "title": "Keep your CLAUDE.md under 40 lines so Claude Code actually follows it", "summary": "A developer published a house-rules pattern for Claude Code that keeps CLAUDE.md under 40 lines, arguing that since the file is loaded into context at session start, every extra line competes with the actual task. The recommended file limits itself to checkable rules: read files and tests before editing, ask before adding dependencies, explicit test and lint commands, a list of forbidden commands like git push --force, and a one-line-per-file change summary. The author also advises moving architecture notes into separate docs the agent reads on demand and using hooks rather than CLAUDE.md for hard guarantees, shipping the pattern in a paid Vildanden Agent Config bundle.", "body_md": "Most `CLAUDE.md` files I see grow into a wiki: architecture notes, style essays, a changelog, three pasted READMEs. Then people wonder why the agent ignores the one rule that mattered.\n\n`CLAUDE.md` is loaded into context at the start of a session, so every line competes with your actual task. Short, concrete house rules beat long explanations.\n\n```\n# House rules\n\n## Before you edit\n- Read the file and its tests before changing it.\n- Ask before adding a new dependency.\n\n## Commands\n- Test: `npm test`\n- Lint: `npm run lint -- --fix`\n- Never run: `git push --force`, `rm -rf`, database migrations.\n\n## Done means\n- Tests and lint pass locally.\n- You list the files you changed and why, in one line each.\n\n## Style\n- Match the surrounding code. No drive-by refactors.\n```\n\nThat is the whole file. Each line is something you could check in a diff.\n\n`npm test`\" is better than a paragraph about the test philosophy.` settings.json`. `CLAUDE.md` is guidance; hooks are guarantees.`docs/architecture.md` and let the agent read it when needed instead of loading it every session.\nCheck the memory docs for your installed Claude Code version; how nested and user-level files are loaded can change between releases.\n\nI ship this short house-rules file together with the allow-list and the safety hooks in [Vildanden Agent Config](https://justly-mia-429.rehost.page/). The free sample is enough to try the pattern today.", "url": "https://wpnews.pro/news/keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it", "canonical_source": "https://dev.to/vildandenai/keep-your-claudemd-under-40-lines-so-claude-code-actually-follows-it-2hhf", "published_at": "2026-10-20 01:10:34+00:00", "updated_at": "2026-10-20 01:16:41.460629+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Anthropic", "Vildanden Agent Config"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it", "markdown": "https://wpnews.pro/news/keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it.md", "text": "https://wpnews.pro/news/keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it.txt", "jsonld": "https://wpnews.pro/news/keep-your-claude-md-under-40-lines-so-claude-code-actually-follows-it.jsonld"}}