What Are Rules?
Rules are markdown files containing instructions that Claude reads at the start of every session. They can specify:
- Coding conventions and style guides
- Framework-specific patterns to follow
- Files or patterns to avoid modifying
- Testing requirements
- Architectural decisions
- Any other instructions for Claude
Rule Locations
Global Rules
Apply to all projects. Stored in:
~/.claude/rules/Example: ~/.claude/rules/style.md
Project Rules
Apply to a specific project. Stored in:
your-project/.claude/rules/Example: my-app/.claude/rules/testing.md
CLAUDE.md
The CLAUDE.md file in your project root is a special rule file that Claude always reads. It's the primary place for project-specific instructions.
my-app/CLAUDE.mdOpening Rules Settings
- Open Settings (
Cmd+,) - Select "Rules" from the left sidebar
- Choose scope: Global or a specific Project
Managing Rules
The Rules settings show:
- List of rule files — All
.mdfiles in the rules directory - File editor — Click a file to view/edit its contents
- Add — Create a new rule file
- Remove — Delete a rule file
Writing Effective Rules
Example: Coding Style
# Coding Conventions
- Use TypeScript for all new files
- Use functional components with hooks (no class components)
- Use named exports (not default exports)
- File names: kebab-case (e.g., `user-profile.tsx`)
- Use Tailwind CSS for styling, no inline stylesExample: Project Architecture
# Architecture Rules
- All API routes go in `src/app/api/`
- Database queries use Prisma, never raw SQL
- State management uses Zustand stores in `src/stores/`
- All components must have a corresponding test fileExample: Safety
# Safety Rules
- NEVER modify `.env` or `.env.local` files
- NEVER commit secrets or API keys
- Always validate user input at API boundaries
- Run `npm test` after any code changesSync Rules
On the Dashboard, the "Sync Rules" button copies all pandev-*.md rule files from your global rules directory to all registered projects. This is useful for maintaining consistent rules across projects.
Rule Priority
When multiple rules exist, they're all included. There's no override mechanism — all rules are additive. If rules conflict, the most specific (project-level) rules should take precedence in practice, but it's best to avoid contradictions.
Pandev-Managed Sections
Pandev may inject managed sections into your project's CLAUDE.md file (e.g., Browser MCP tool instructions). These sections are marked with special comments and are automatically maintained — don't edit them manually.
<!-- PANDEV:START -->
... managed content ...
<!-- PANDEV:END -->