Global and project instructions. Define preferences, keyword triggers, and behavioral guidelines.
CLAUDE.md files provide instructions that Claude Code reads at the start of every session. They define your preferences, patterns, and behaviors.
~/.claude/CLAUDE.mdApplied to all projects
./CLAUDE.mdProject root, checked into git
Define your personal preferences and keyword triggers for all projects.
# Global Claude Code Instructions
## Preferences
- **Model**: Opus 4.5 (default)
- **Package Manager**: pnpm
- **Stack**: Next.js 15, React 19, Prisma 6, TypeScript 5, Tailwind CSS 4, shadcn/ui
- **Languages**: Arabic (RTL default), English (LTR)
---
## Keyword Triggers
When user mentions these keywords, reference the mapped tools:
### Workflow Keywords
| Keyword | Agents | Commands | MCPs |
|---------|--------|----------|------|
| `push` | git-github | /push | github |
| `deploy` | - | /deploy | vercel |
| `build` | build, nextjs | /build | - |
### Creation Keywords
| Keyword | Agents | Commands |
|---------|--------|----------|
| `component` | react, shadcn | /component |
| `page` | nextjs, architecture | /page |
| `api` | api, prisma | /api |
---
## Stack to Agent Mapping
| Technology | Primary Agent | Secondary Agent |
|------------|---------------|-----------------|
| **Next.js** | nextjs | architecture |
| **React** | react | react-reviewer |
| **TypeScript** | typescript | type-safety |
| **Prisma** | prisma | database-optimizer |
| **Tailwind** | tailwind | - |
---
## Behavior
When user mentions a keyword from the trigger tables:
1. **Reference the mapped agent(s)** before starting work
2. **Use relevant MCP tools** if available
3. **Apply skills** for validation/optimization
4. **Suggest relevant commands** when appropriateProject-specific instructions that override or extend global settings.
# CLAUDE.md
Project-specific instructions for this repository.
## Tech Stack
- **Framework**: Next.js 16 with App Router
- **Runtime**: React 19, Node.js runtime only
- **Database**: PostgreSQL with Prisma ORM 6
- **Authentication**: NextAuth v5 (beta)
- **Styling**: Tailwind CSS v4 with OKLCH
## Commands
```bash
pnpm dev # Development server
pnpm build # Production build
pnpm lint # ESLint
pnpm prisma generate # Generate Prisma client
```
## Architecture
### Mirror-Pattern
Every URL route produces **two directories**:
- `app/[lang]/abc/` — page.tsx, layout.tsx
- `components/abc/` — content.tsx, actions.ts, types.ts
### Component Hierarchy
```
UI → Atoms → Templates → Blocks → Micro → Apps
```
## Key Patterns
### Async Request APIs (Next.js 16)
```tsx
export default async function Page(props: {
params: Promise<{ lang: string }>
}) {
const { lang } = await props.params;
}
```
### Authentication
```tsx
// Server Component
import { currentUser } from "@/lib/auth";
const user = await currentUser();
```Control what tools Claude Code can use without asking.
{
"permissions": {
"allow": [
"Bash(pnpm add:*)",
"Bash(mkdir:*)",
"Bash(git:*)",
"WebFetch(domain:ui.shadcn.com)",
"WebFetch(domain:github.com)"
],
"deny": [],
"ask": []
}
}Use tables and bullet points. Claude reads this every session.
Include exact commands, paths, and patterns for your workflow.
Global for personal prefs, project for team standards.
Commit project CLAUDE.md so team shares the same context.