← All Claude Code Skills

Claude Code Projects

How to configure Claude Code for your project: CLAUDE.md, project memory, per-project settings, and best practices for teams.

What is CLAUDE.md?

CLAUDE.md is a Markdown file at the root of your repository that Claude Code reads automatically at the start of every session. It's persistent project context — Claude absorbs it before reading a single line of your code.

Think of it as a README for Claude rather than for humans: concise, machine-first documentation about how to navigate and modify your codebase correctly.

# My Project — CLAUDE.md

## Tech stack
Next.js 14 (App Router), TypeScript, Prisma (PostgreSQL), Tailwind CSS.

## Key paths
- `src/app/` — Next.js routes and layouts
- `src/app/api/` — API route handlers
- `src/lib/` — shared utilities
- `prisma/schema.prisma` — database schema (do not edit directly — use migrations)

## Commands
- `npm run dev` — start dev server
- `npm run typecheck` — TypeScript check (run after any file changes)
- `npm run test` — Jest unit tests
- `npm run lint` — ESLint

## Do NOT modify
- `src/generated/` — auto-generated from GraphQL schema
- `prisma/migrations/` — generated migration files

## Conventions
- All new API routes must validate input with Zod before touching the DB
- Use `src/lib/logger.ts` for all logging (not console.log)
- Database queries must go through Prisma, never raw SQL

## Important invariants
- `userId` in all user-facing queries comes from the authenticated session, never from request body

CLAUDE.md vs README.md

CLAUDE.mdREADME.md
For Claude (AI agent)For human developers
Concise, imperative ("do X", "never Y")Descriptive, explanatory prose
Focus on invariants and gotchasFocus on overview and setup
Committed to version control, team-sharedCommitted to version control, team-shared
Auto-loaded into every sessionHumans read it manually

.claude/settings.json — Project Runtime Config

While CLAUDE.md is prose context, .claude/settings.json controls Claude Code's runtime behaviour for the project:

{
  "allowedTools": [
    "Read",
    "Glob",
    "Grep",
    "Bash(npm run typecheck)",
    "Bash(npm run test **)",
    "Bash(git log **)",
    "Bash(git diff **)",
    "Bash(git status)"
  ],
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "npm run typecheck 2>&1 | tail -5"
          }
        ]
      }
    ]
  }
}

Both files are committed to version control and apply to every team member using Claude Code in the repo.

Memory Layers in Claude Code

LayerScopePersists?How to write
CLAUDE.mdProjectYes — across all sessionsEdit the file directly or ask Claude to update it
~/.claude/memory/User / all projectsYes — across all sessionsClaude can write files here; you can too
In-session contextCurrent session onlyNo — cleared on exitAnything you say or show Claude in a session

Tip: Ask Claude to maintain CLAUDE.md for you. At the end of a session where Claude learned something new about your codebase, say: "Add what you learned about the auth middleware to CLAUDE.md." Claude will append the right facts in the right format.

Monorepo Setup

Claude Code supports hierarchical CLAUDE.md files for monorepos:

my-monorepo/
├── CLAUDE.md               ← global conventions (applies everywhere)
├── packages/
│   ├── api/
│   │   └── CLAUDE.md       ← API-specific notes
│   ├── web/
│   │   └── CLAUDE.md       ← Frontend-specific notes
│   └── shared/
│       └── CLAUDE.md       ← Shared library notes

When Claude works in packages/api/, it reads both the root CLAUDE.md and packages/api/CLAUDE.md. Use the root for cross-cutting concerns (auth invariants, global naming rules) and package files for package-specific commands, paths, and gotchas.

Best Practices for Teams

Frequently Asked Questions

Does CLAUDE.md affect performance or cost?
Yes — CLAUDE.md is added to every session's context, so it consumes tokens. A 200-line CLAUDE.md is ~2,000 tokens (~$0.006 at Sonnet 4.6 input pricing), which is trivial. A 2,000-line CLAUDE.md costs 10× more and may dilute Claude's attention on your actual task. Keep it concise. The cost of a well-focused CLAUDE.md is almost always worth it in reduced errors and re-prompting.
Can I have a CLAUDE.md outside of git repos?
Yes — CLAUDE.md works in any directory you run Claude Code from, regardless of whether it's a git repository. Claude Code looks for it in the current working directory and all parent directories up to a root boundary.
What is the difference between project settings and user settings?
Project settings (.claude/settings.json in your repo) are team-shared and committed to version control. User settings (~/.claude/settings.json) apply to you across all projects and are not committed. If both files contain the same setting, the project setting takes precedence within that project. Use project settings for team conventions; use user settings for personal preferences like your preferred model or default permission mode.
Can Claude Code automatically update CLAUDE.md?
Yes — Claude Code can write to any file in your project, including CLAUDE.md. You can ask it to "update CLAUDE.md with what you learned" or configure a hook to append session learnings automatically. Some teams add a PostSession hook that prompts Claude to summarize any new architecture decisions it discovered and append them to CLAUDE.md.
Should CLAUDE.md be .gitignored?
No — CLAUDE.md should be committed. It's project documentation. The only exception is if CLAUDE.md contains sensitive information (API keys, internal URLs), which it shouldn't — those belong in .env files or secrets managers, not documentation. .claude/settings.json should also be committed; it configures tool permissions for the project and is safe to share.

Related

More Claude Code Tools

⚡ Using Claude Code? 30 power prompts that 2× your output · £5 £3 first 10Get PDF £3 →