Set Global Defaults in ~/.claude/CLAUDE.md
Project-level CLAUDE.md files are great, but some preferences should follow you everywhere. A CLAUDE.md in your home directory applies to every Claude Code session, regardless of which project you're in.
# Create your global CLAUDE.md
touch ~/.claude/CLAUDE.md
Then add anything you want consistent across all your projects:
## Global Preferences
- Always write TypeScript over JavaScript when given the choice
- Use conventional commits format (feat:, fix:, chore:, etc.)
- Run tests before marking any task complete
- Prefer composition over inheritance
- Add JSDoc comments to all exported functions
This file is loaded first, before any project-level CLAUDE.md. Project files can extend or override it, so your global preferences act as sensible defaults without locking you in.
It's perfect for things like your preferred coding style, commit message format, testing habits, and language preferences — the stuff you'd tell a new team member on day one.
# View your global settings any time
cat ~/.claude/CLAUDE.md
Your global CLAUDE.md is your personal coding style guide that travels with you into every project.
Log in to leave a comment.
When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.
Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.
Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.