Project Structure
Recommended Layout
Section titled βRecommended Layoutβyour-project/βββ .claude/β βββ settings.json # shared team settings (commit this)β βββ settings.local.json # personal overrides (gitignore this)β βββ CLAUDE.md # project instructions (commit this)β βββ CLAUDE.local.md # personal instructions (gitignore this)β βββ rules/ # path-scoped instruction filesβ β βββ api.md # rules for src/api/**β β βββ testing.md # rules for **/*.test.tsβ β βββ frontend/β β βββ components.md # rules for src/components/**β βββ skills/ # custom slash commandsβ β βββ deploy/β β β βββ SKILL.mdβ β β βββ deploy.shβ β βββ new-feature/β β βββ SKILL.mdβ βββ agents/ # custom subagentsβ β βββ code-reviewer.mdβ β βββ frontend-specialist.mdβ βββ commands/ # legacy (prefer skills/ instead)β βββ format.mdβββ .mcp.json # MCP server config (commit this)βββ CLAUDE.md # alternative location (commit this)βββ CLAUDE.local.md # alternative personal location (gitignore)βββ src/βββ tests/βββ package.jsonβββ README.mdβββ .gitignoreUser Config Directory
Section titled βUser Config Directoryβ~/.claude/βββ settings.json # applies to all projectsβββ CLAUDE.md # personal instructions for all projectsβββ rules/ # user-level path-scoped rulesβββ skills/ # reusable skills across projectsβββ agents/ # reusable subagents across projectsβββ keybindings.json # custom keyboard shortcutsβββ statusline.py # custom status line scriptβββ projects/ # session history (auto-managed) βββ <project-hash>/ βββ sessions.jsonl # conversation transcripts βββ memory/ # auto memory files βββ MEMORY.md # memory index βββ *.md # individual memory files.gitignore Entries
Section titled β.gitignore Entriesβ# Claude Code β never commit these.claude/settings.local.jsonCLAUDE.local.md.claude.local.json.claude/projects/Rules File Format
Section titled βRules File Formatβ.claude/rules/api.md:
---paths: - "src/api/**/*.ts" - "src/routes/**"---
# API Rules
- Validate all input with Zod schemas- Use the standard error shape: `{ error: string, code: string }`- All handlers must be async- Return 400 for validation errors, 500 for unexpected errors- Add OpenAPI JSDoc to every route handler.claude/rules/testing.md:
---paths: - "**/*.test.ts" - "**/*.spec.ts"---
# Testing Rules
- Use Vitest (not Jest)- Prefer `it.each` for data-driven tests- Mock only external services β never mock internal modules- Each test file should be self-containedTwo CLAUDE.md Location Options
Section titled βTwo CLAUDE.md Location OptionsβBoth are valid and loaded. Use whichever fits your teamβs convention:
Option A: ./CLAUDE.md (project root)Option B: ./.claude/CLAUDE.md (inside .claude/)If both exist, both are loaded. Avoid duplication.
Minimal Starter Setup
Section titled βMinimal Starter Setupβ# 1. Initialize CLAUDE.mdclaude -p "/init"
# 2. Create settingsmkdir -p .claudecat > .claude/settings.json << 'EOF'{ "permissions": { "allow": ["Bash(npm *)", "Bash(git *)"] }}EOF
# 3. Gitignore personal filesecho '.claude/settings.local.json' >> .gitignoreecho 'CLAUDE.local.md' >> .gitignoreπ§ Quick Recall
Section titled βπ§ Quick Recallβ- Trick: β
.claude/is the projectβs brain: settings, skills, agents, hooks.β
π¨βπ« Teach It
Section titled βπ¨βπ« Teach Itβ- Show: tour a mature repoβs
.claude/directory tree. - Theyβll trip on:
settings.local.jsonis gitignored β personal, not shared.
Learning path: β¬ 18-memory-real-examples.md Β· Index Β· β‘ 20-skills.md
Written by Fenil Patel