Understanding the .claude/ folder structure for Claude Code configuration

Project and global configuration folders
There are two .claude directories: one in your project root for team configuration that gets committed to git, and another in your home directory (~/.claude/) for personal preferences and machine-local state like session history.
CLAUDE.md: The instruction manual
CLAUDE.md is loaded into Claude's system prompt at the start of each session and followed throughout the conversation. You can have CLAUDE.md at project root, in ~/.claude/ for global preferences, or in subdirectories for folder-specific rules.
Effective CLAUDE.md content includes:
- Build, test, and lint commands (npm run test, make build, etc.)
- Key architectural decisions
- Non-obvious gotchas
- Import conventions, naming patterns, error handling styles
- File and folder structure for main modules
Keep CLAUDE.md under 200 lines. Files longer than that start eating too much context and Claude's instruction adherence drops.
Example CLAUDE.md structure
# Project: Acme APICommands
npm run dev # Start dev server npm run test # Run tests (Jest) npm run lint # ESLint + Prettier check npm run build # Production build
Architecture
- Express REST API, Node 20
- PostgreSQL via Prisma ORM
- All handlers live in src/handlers/
- Shared types in src/types/
Conventions
- Use zod for request validation in every handler
- Return shape is always { data, error }
- Never expose stack traces to the client
- Use the logger module, not console.log
Watch out for
- Tests use a real local DB, not mocks. Run
npm run db:test:resetfirst - Strict TypeScript: no unused imports, ever
Personal overrides with CLAUDE.local.md
Create CLAUDE.local.md in your project root for personal preferences that don't apply to the whole team. Claude reads it alongside the main CLAUDE.md, and it's automatically gitignored so personal tweaks never land in the repository.
Modular instructions with rules/ folder
For larger teams, the rules/ folder provides modular instructions that scale better than a single large CLAUDE.md file.
📖 Read the full source: HN AI Agents
👀 See Also

Five Common OpenClaw Configuration Issues That Inflate API Costs
A Reddit post identifies five configuration problems in OpenClaw setups that lead to excessive API credit consumption, including using expensive models for routine tasks, missing budget limits, open gateways, unmanaged memory, and unaudited skills.

OpenClaw 5.28: Codex Plugin Broken After Upgrade — Fix with Symlink Shim
OpenClaw 5.28 breaks Codex plugin due to binary path mismatch. Fix: create symlink from expected path to actual bin/codex.

Optimizing GLM-4.7-Flash on M4 Mac Mini with 24GB RAM
A developer shares specific configuration details for running GLM-4.7-Flash on an M4 Mac Mini with 24GB RAM, including Q3_K_XL quantization, 32k context size with MLA, and memory allocation realities for Metal.

vLLM Setup and Testing on 10x NVIDIA V100 Server with 320GB VRAM
A lawyer building a local AI server for legal work shares vLLM testing results on 10x Tesla V100 SXM2 32GB GPUs, detailing what works (FP16 unquantized, bitsandbytes 4-bit) and what doesn't (GPTQ, AWQ, FlashAttention2) on Volta architecture.