Chapter 12: CLAUDE.md — Designing Guardrails That Shape How Claude Thinks
This is Part 12 of a series walking through the book Master Claude Chat, Cowork and Code — From Prompting to Operational AI. In the previous chapter, we scaled Claude Code into CI/CD pipelines with automated refactoring, PR reviews, and security audits. Now Part V begins — Context Engineering and Extensibility — and we start with the document that defines what Claude is in your organization.
Not a Prompt. A Constitution.
CLAUDE.md is the most misunderstood file in the Claude ecosystem. Most teams treat it like a system prompt — a list of instructions that gets prepended to each conversation. Chapter 12 reframes it entirely: CLAUDE.md is a living constitution for how Claude behaves within your specific organizational context. It's persistent behavioral specification that travels with every conversation, every integration, and every workflow.
The critical insight that opens the chapter changed how I think about AI configuration: CLAUDE.md is not primarily about preventing bad behavior — it's about establishing what good behavior looks like. Instead of writing "don't do X," you write "always prioritize Y." This distinction matters enormously because positive constraints are far more efficient than negative ones, and they produce more creative, contextually appropriate responses.
Two Complete CLAUDE.md Examples, Two Different Worlds
The heart of Chapter 12 is two complete, realistic CLAUDE.md files that show how the same principles apply to radically different organizations.
Acme Financial Services needs absolute certainty around regulatory compliance. Their CLAUDE.md establishes a four-tier data classification system (PUBLIC, INTERNAL, CUSTOMER, SENSITIVE) with explicit handling rules for each tier. Non-negotiable rules cover never outputting customer data in examples, always redacting credentials, always including audit logging, and always flagging auth changes for human review. Domain-specific guidelines cover API design conventions, database migration safety, and testing requirements.
What makes this example exceptional is the escalation patterns. Instead of blocking Claude from discussing regulatory questions, the CLAUDE.md provides explicit templates: "This involves [REGULATION]. Should I defer to the compliance team, or do you want me to proceed with my best understanding?" Claude isn't silenced — it's guided to handle sensitive topics with appropriate human involvement.
ProductCraft Engineering is a startup that values shipping velocity. Their CLAUDE.md establishes core values in priority order: Shipping > Perfection, User Value > Technical Elegance, Maintainability > Cleverness, Observability > Assumptions. It defines code generation practices, architectural decision guidelines, and code review feedback patterns. It even lists anti-patterns to call out: "resume-driven development," over-engineering, premature optimization, and configuration explosion.
I will not reproduce the full CLAUDE.md files here — they're the kind of thing you'll want to adapt for your own organization — but the contrast between a compliance-first financial institution and a velocity-first startup is illuminating.
Instruction Decay: Why Less Is More
One of the most valuable sections in Chapter 12 covers a phenomenon the book calls "instruction decay" — the tendency for long instruction sets to lose coherence and impact. As your CLAUDE.md grows, its effectiveness actually decreases. Each additional rule consumes tokens and creates cognitive load. Rules start to interfere with each other. An instruction at the top might be contradicted five hundred lines later.
The book provides a sharp example: a DevOps team managing Kubernetes might be tempted to write 200 lines covering kubectl commands, RBAC policies, networking, storage, and disaster recovery. Instead, one principle covers most of it: "All suggestions for cluster modifications should prioritize zero-downtime deployments and include rollback procedures. Flag any command that could impact availability."
Hierarchical CLAUDE.md: Scaling Across Teams
For organizations with multiple teams, a single CLAUDE.md becomes unwieldy. Chapter 12 introduces hierarchical files — organization-wide principles at the root, team-specific refinements in subdirectories:
/CLAUDE.md — Organization-wide principles. /infrastructure/CLAUDE.md — Infrastructure team specifics. /backend/CLAUDE.md — Backend services specifics. /frontend/CLAUDE.md — Frontend team specifics. /security/CLAUDE.md — Security team specifics.
When working in a specific team's context, Claude loads both the root and team-specific files — progressive context that keeps organization-wide principles consistent while giving teams autonomy for their specific practices. The total token cost stays reasonable because you're not loading all teams' constraints in every conversation.
The Anti-Pattern Everyone Falls Into
Chapter 12 closes with an anti-pattern section that I suspect will save many teams from a frustrating mistake: using CLAUDE.md as a linter. There's a temptation to make Claude enforce every code style, naming convention, and architectural principle through configuration. The book is direct: this is almost always a mistake.
Claude is not a linter — it's a reasoning engine. Using it as a style checker wastes its capabilities and frustrates teams. A team that adds fifty lines of naming conventions gets slower responses, more hallucinations about their conventions, and engineers frustrated that they're using AI for tasks a real linter handles instantly and precisely.
The right pattern: use real tools for enforcement (linters, formatters, CI/CD validation, pre-commit hooks). Use CLAUDE.md to express the principles and values that should guide Claude's suggestions, not to enumerate rules that tools can enforce automatically.
What Chapter 12 Sets Up
With CLAUDE.md you've defined how Claude thinks in your organization. The next chapter defines what Claude can do.
Chapter 13: Encapsulating Knowledge with Agent Skills introduces Skills — reusable, encapsulated procedures that Claude executes autonomously. While CLAUDE.md says "prioritize security and include error handling," a Skill encapsulates the actual procedure for "deploy this application safely, with automated rollback." Complete SKILL.md files with YAML frontmatter, trigger descriptions for automatic invocation, and the Skills Library pattern for team-wide distribution.
Sho Shimoda
I share and organize what I’ve learned and experienced.カテゴリー
タグ
検索ログ
Development & Technical Consulting
Working on a new product or exploring a technical idea? We help teams with system design, architecture reviews, requirements definition, proof-of-concept development, and full implementation. Whether you need a quick technical assessment or end-to-end support, feel free to reach out.
Contact Us