Three Layers of Claude Instructions
Claude receives instructions from multiple sources, each with different scope and precedence:
Set by application developers via the Anthropic API. Shapes Claude's persona and capabilities for that application.
Your personal global rules. Apply to every Claude Code session across all projects.
Project-specific rules committed to the repository. Apply to all team members working on that project.
Module or feature-specific rules. Apply when Claude navigates into that directory.
System Prompts: Application-Level Control
System prompts are set by developers building products on top of Claude via the API. If you're using Claude.ai, claude.ai sets the system prompt. If you're using a third-party Claude app, that app controls it.
As a Claude Code user, you don't write system prompts — you write CLAUDE.md files. The distinction matters because:
- System prompts take precedence over user rules
- You cannot override a system prompt via CLAUDE.md
- System prompts are typically not visible to end users
User Rules: Your Personal Defaults
The file at ~/.claude/CLAUDE.md (or the platform equivalent) applies to all your Claude Code sessions regardless of project.
Good candidates for user-level rules:
- Your preferred response format (concise vs. verbose)
- Languages and tools you always use
- Personal quirks ("I prefer tabs over spaces")
- Communication style preferences
# My Global Rules ## Communication Style - Be direct. Skip preambles like "Certainly!" or "Of course!" - When showing code changes, show only the changed lines, not the full file - Ask one clarifying question at a time, not a list ## My Preferred Tools - Shell: zsh with Oh My Zsh - Editor: VS Code with vim keybindings - Package manager: npm (not yarn or bun) ## Code Style Defaults - TypeScript strict mode always - Prefer functional programming patterns - Use early returns to reduce nesting
Project CLAUDE.md: Team Shared Context
Project CLAUDE.md files are the most important type for professional development. They encode team conventions that every developer on the project should follow, making Claude a consistent team member rather than a personal assistant.
Precedence and Conflicts
When rules conflict, Claude generally follows this precedence (high to low):
- API system prompt
- Explicit instructions in the conversation
- Subdirectory CLAUDE.md (most specific)
- Project root CLAUDE.md
- User global CLAUDE.md
When writing rules, be explicit about intent: "This overrides the global preference for X in this project."