CLAUDE.md 설정 가이드
CLAUDE.md로 Claude Code에 프로젝트 컨텍스트와 코딩 규칙을 제공하는 방법
API 키가 필요하신가요? 회원가입 →엔드포인트 & Base URL →
이 페이지 목차
CLAUDE.md는 Claude Code의 프로젝트 수준 설정 파일이에요. Claude Code는 시작할 때마다 프로젝트의 CLAUDE.md를 자동으로 읽어 프로젝트 아키텍처, 코딩 규칙, 특별한 약속을 파악하고, 이를 통해 프로젝트를 더 정확하게 이해할 수 있어요.
CLAUDE.md가 필요한 이유¶
CLAUDE.md가 없으면 매 대화마다 다음과 같은 내용을 반복해서 설명해야 할 수 있어요:
- "이 프로젝트는 npm이 아니라 pnpm을 사용해요"
- "테스트 명령은
npm test가 아니라yarn test:unit이에요" - "모든 컴포넌트는 TypeScript를 사용하고
any타입은 쓰지 않아요"
이 정보를 CLAUDE.md에 적어 두면 Claude가 시작할 때마다 자동으로 읽으므로 같은 설명을 반복할 필요가 없어요.
파일 계층 구조¶
Claude Code는 여러 수준의 CLAUDE.md 파일을 읽고 병합해요:
| 위치 | 범위 |
|---|---|
~/.claude/CLAUDE.md |
전역 설정, 모든 프로젝트에 적용 |
<project root>/CLAUDE.md |
프로젝트 설정, 팀 공유를 위해 Git에 커밋 |
.claude/CLAUDE.md |
비공개 프로젝트 설정, .gitignore에 추가 가능 |
하위 디렉터리의 CLAUDE.md |
Claude가 해당 디렉터리에서 작업할 때만 읽음 |
빠른 설정¶
/init 명령으로 자동 생성할 수 있어요:
/init
Claude가 현재 프로젝트 구조를 분석하고 프로젝트 정보로 채워진 CLAUDE.md를 자동으로 생성해요.
기본 구조¶
# Project Name
## Overview
Brief description of the project's purpose and tech stack.
## Tech Stack
- Runtime: Node.js 20
- Framework: Next.js 15
- Styling: Tailwind CSS
- Database: PostgreSQL + Prisma
## Common Commands
- Start dev server: `npm run dev`
- Run tests: `npm test`
- Build for production: `npm run build`
- Lint code: `npm run lint`
## Coding Conventions
- Use TypeScript; no `any` types allowed
- Components use functional style
- Styling with Tailwind only — no inline styles
- Commit message format: `feat:` / `fix:` / `docs:` prefixes, etc.
## Project Structure
- `src/app/` — Next.js App Router pages
- `src/components/` — Reusable components
- `src/lib/` — Utility functions
- `prisma/` — Database schema and migrations
## Notes
- Do not modify `prisma/migrations/` — only create new migrations
- All API routes are under `src/app/api/`
- Image assets go in `public/images/`
실전 팁¶
1. 패키지 관리자 지정하기¶
## Package Management
Use pnpm — do not use npm or yarn.
Install dependencies: `pnpm install`
Add a dependency: `pnpm add <package>`
2. 테스트 규칙 문서화하기¶
## Testing
- Unit tests: `vitest`, files end in `.test.ts`
- E2E tests: `playwright`, located in `tests/e2e/`
- Run unit tests: `pnpm test:unit`
- Run E2E: `pnpm test:e2e`
- New features must include tests
3. 금지 사항 지정하기¶
## Prohibited Actions
- Do not use `console.log` — use the project's `logger` module instead
- Do not modify `package-lock.json` directly
- Do not commit directly to `main` — use feature branches
4. 아키텍처 컨텍스트 제공하기¶
## Architecture Overview
This project follows Hexagonal Architecture:
- `domain/` — Business logic, no external framework dependencies
- `application/` — Use cases, coordinating domain and infrastructure
- `infrastructure/` — External adapters for databases, HTTP, etc.
- `interfaces/` — Entry points such as web controllers and CLI
New features should follow this layering — do not introduce external dependencies in the domain layer.
5. 다른 문서 참조하기¶
## Further Reading
- API documentation: `docs/api.md`
- Deployment process: `docs/deploy.md`
- Database schema: `prisma/schema.prisma`
CLAUDE.md와 컨텍스트 관리¶
CLAUDE.md의 내용은 컨텍스트 공간을 차지해요. 권장 사항:
- CLAUDE.md는 간결하게 유지하고 가장 중요한 정보에 집중하세요
- 상세한 아키텍처 문서는 내용을 그대로 복사하지 말고 CLAUDE.md에 파일 경로 참조를 제공하세요
- 긴 세션에서도 CLAUDE.md는 항상 표시돼요 (
/compact로 제거되지 않아요)
프로젝트 템플릿¶
아래 구조는 일반적인 프로젝트 유형에 맞춰 실전에서 검증된 CLAUDE.md 시작점이에요. 스택에 맞는 것을 복사하고 세부 내용을 조정하세요.
템플릿 1: React + TypeScript 프런트엔드¶
# MyApp Frontend
## Tech Stack
- React 19 + TypeScript 5.x
- Build tool: Vite 6
- Styling: Tailwind CSS v4 (utility-first, no inline styles)
- State management: Zustand (global), TanStack Query (server state)
- Routing: React Router v7
- Testing: Vitest + Testing Library + MSW
## Commands
- Dev: `pnpm dev` (port 3000)
- Test: `pnpm test` (Vitest watch mode)
- Single run: `pnpm test:run`
- Build: `pnpm build`
- Lint: `pnpm lint` (ESLint + Prettier)
- Type check: `pnpm typecheck`
## Coding Conventions
- Components: functional components + Hooks, no class components
- Props: define with `interface` (not `type`)
- File names: components in PascalCase (UserProfile.tsx), utilities in camelCase (formatDate.ts)
- Import order: React → third-party → internal → styles
- No `any` type; explicit type annotations are required
- Async work goes through TanStack Query, not direct `useEffect` + `fetch`
## Project Structure
- src/components/ — reusable UI components
- src/pages/ — route pages
- src/hooks/ — custom Hooks
- src/api/ — API request wrappers (TanStack Query queryFn)
- src/stores/ — Zustand stores
- src/lib/ — utility functions
- src/types/ — global type definitions
## Notes
- Package manager: pnpm (not npm or yarn)
- Node.js 22+
- All API requests go through src/api/client.ts (with interceptors)
- Images live in public/images/, referenced via the /images/ path
템플릿 2: Python + FastAPI 백엔드¶
# MyApp Backend
## Tech Stack
- Python 3.12 + FastAPI
- ORM: SQLAlchemy 2.0 (async) + Alembic migrations
- Database: PostgreSQL 16
- Cache: Redis 7
- Testing: pytest + httpx + factory_boy
## Commands
- Dev: `uvicorn app.main:app --reload --port 8000`
- Test: `pytest -xvs`
- Migrate: `alembic upgrade head`
- New migration: `alembic revision --autogenerate -m "description"`
- Lint: `ruff check .`
- Format: `ruff format .`
- Type check: `mypy app/`
## Coding Conventions
- Type hints: all function parameters and return values must have type hints
- async/await: all I/O operations use async
- Pydantic v2: request/response schemas use Pydantic BaseModel
- Dependency injection: inject database connections, auth, etc. via FastAPI Depends()
- Error handling: business exceptions inherit from app.exceptions.AppError
## Project Structure
- app/main.py — application entry point
- app/api/ — routes (one file per resource)
- app/models/ — SQLAlchemy models
- app/schemas/ — Pydantic schemas
- app/services/ — business logic
- app/core/ — config, database, security, and other core modules
- tests/ — test files (mirror the app/ structure)
- alembic/ — database migrations
## Notes
- Do not modify existing migration files under alembic/versions/
- The .env file is not committed to Git; it is loaded via the Settings class in app/core/config.py
- Virtual environment: `python -m venv venv && source venv/bin/activate`
템플릿 3: Go 마이크로서비스¶
# MyService
## Tech Stack
- Go 1.23
- HTTP framework: Echo v4
- Database: PostgreSQL + sqlc (type-safe SQL)
- Message queue: NATS JetStream
- Containerization: Docker + docker-compose
## Commands
- Run: `go run ./cmd/server`
- Test: `go test ./...`
- Build: `go build -o bin/server ./cmd/server`
- Generate sqlc: `sqlc generate`
- Lint: `golangci-lint run`
## Coding Conventions
- Error handling: always check err, never ignore it with _
- Interface naming: single-method interfaces take the -er suffix (Reader, Writer)
- Package naming: lowercase words, no underscores
- Logging: use slog for structured logging
- Context: pass context.Context as the first parameter of every function
## Project Structure (standard Go layout)
- cmd/server/ — main program entry point
- internal/handler/ — HTTP handlers
- internal/service/ — business logic
- internal/repository/ — data access layer
- internal/model/ — data models
- sql/ — SQL query files (used by sqlc)
템플릿 4: 모노레포 (Turborepo)¶
# MyPlatform Monorepo
## Tech Stack
- Package management: pnpm workspace
- Build system: Turborepo
- Language: TypeScript across the stack
## Commands
- Global dev: `pnpm dev`
- Global test: `pnpm test`
- Global build: `pnpm build`
- Single-package dev: `pnpm --filter @myplatform/web dev`
- Add a dependency: `pnpm --filter @myplatform/api add express`
## Package Structure
- apps/web/ — Next.js frontend
- apps/api/ — Express backend
- apps/admin/ — admin dashboard
- packages/ui/ — shared UI component library
- packages/config/ — shared config (eslint, tsconfig)
- packages/types/ — shared type definitions
## Notes
- Shared code goes in packages/; do not import directly between apps
- When creating a new package, follow the format of packages/ui/package.json
- Turborepo cache: build artifacts are cached in node_modules/.cache/turbo
템플릿 5: 데이터 과학 / ML 프로젝트¶
# ML Pipeline
## Tech Stack
- Python 3.12
- Framework: PyTorch 2.5 + Lightning
- Data processing: Polars (not Pandas)
- Experiment tracking: MLflow
- Dependency management: uv
## Commands
- Train: `python -m src.train --config configs/experiment.yaml`
- Evaluate: `python -m src.evaluate --checkpoint runs/latest`
- Preprocess data: `python -m src.preprocess --data-dir data/raw`
- Jupyter: `jupyter lab`
- Test: `pytest tests/`
## Coding Conventions
- Use YAML for configuration (do not hard-code hyperparameters)
- Use Polars for data processing (faster than Pandas, type-safe)
- All experiments must be logged to MLflow
- Notebooks are for exploration only; production code must live in src/
## Project Structure
- configs/ — experiment configuration YAML
- data/raw/ — raw data (not committed to Git, managed with DVC)
- data/processed/ — processed data
- src/ — core code (model, data, train, evaluate)
- notebooks/ — exploratory analysis
- runs/ — training outputs (checkpoints, logs)
팀 협업 모범 사례¶
Git 전략¶
CLAUDE.md → commit to Git (shared by the team)
.claude/CLAUDE.md → add to .gitignore (personal configuration)
다음 항목을 .gitignore에 추가하세요:
# Personal Claude Code configuration
.claude/CLAUDE.md
.claude/settings.local.json
코드 리뷰 체크리스트¶
모든 PR 리뷰에서 다음을 확인하세요:
- 새로운 기술을 도입할 때 CLAUDE.md를 업데이트했나요?
- 레이아웃이 변경될 때 "Project Structure" 섹션을 업데이트했나요?
- 중요한 명령이 추가될 때 "Commands" 섹션을 업데이트했나요?
온보딩 가이드¶
CLAUDE.md는 프로젝트의 가장 좋은 온보딩 문서 역할을 함께 해요:
1. 클론한 후 새 개발자는 CLAUDE.md를 읽어 프로젝트의 전체 그림을 파악해요
2. claude를 실행하면 → Claude가 모든 프로젝트 규칙을 이미 알고 있어요
3. > help me understand this project로 탐색을 시작해요
고급 팁¶
인라인으로 넣지 말고 참조하세요¶
CLAUDE.md는 너무 길어지면 안 돼요. 상세 문서의 경우 내용을 인라인으로 넣는 대신 경로를 참조하세요:
## Architecture
Detailed architecture doc: `docs/architecture.md`.
API design conventions: `docs/api-design.md`.
Database schema: `prisma/schema.prisma`.
Claude는 필요할 때 해당 파일들을 자동으로 읽어요.
AGENTS.md와의 관계¶
| CLAUDE.md | AGENTS.md | |
|---|---|---|
| 도구 | Claude Code | Codex CLI |
| 형식 | Markdown | Markdown |
| 내용 | 80%+ 재사용 가능 | 80%+ 재사용 가능 |
Claude Code와 Codex를 모두 사용하는 경우 두 파일을 함께 둘 수 있어요:
- 공유 내용: 기술 스택, 명령, 코딩 표준, 프로젝트 구조
- 도구별 설정: Claude의
/model및/plan지침은 CLAUDE.md에 넣고, Codex의 승인 모드 설정은 AGENTS.md에 넣어요
AGENTS.md 가이드를 참고하세요.
컨텍스트 사용량 제어¶
CLAUDE.md의 내용은 항상 컨텍스트에 포함돼요(/compact로도 제거되지 않아요). 다음을 권장해요:
- 전체 줄 수를 500줄 미만으로 유지하세요
- 상세 문서를 인라인으로 넣는 대신 경로를 참조하세요
- 자주 변경되는 정보(현재 진행 상황 등)는 넣지 마세요
- 코드 예시는 넣지 마세요(Claude가 소스 코드를 직접 읽을 수 있어요)
흔한 실수와 디버깅¶
CLAUDE.md를 읽지 않는 경우¶
# Confirm the file is in the project root
ls -la CLAUDE.md
# Confirm Claude sees it
claude
> Do you see CLAUDE.md? What tech stack does it describe?
너무 길어서 컨텍스트가 부족해지는 경우¶
# Check the line count
wc -l CLAUDE.md
# Over 500 lines: trim it
# Check context usage
/cost
팀 구성원의 동작이 서로 다른 경우¶
모두의 전역 ~/.claude/CLAUDE.md는 서로 달라요. 팀에서 일관되지 않은 동작이 보이면 다음을 확인하세요:
1. 프로젝트 루트의 CLAUDE.md가 충분히 구체적인가요?
2. 누군가 .claude/CLAUDE.md에서 팀 규칙을 덮어썼나요?
CLAUDE.md vs AGENTS.md — 선택 방법¶
Claude Code는 CLAUDE.md를 기본적으로 읽어요(메모리 파일과 경로 범위 규칙도 함께 읽어요). 대부분의 다른 도구인 Cursor, Codex, GitHub Copilot, Cline, Gemini / Antigravity, Aider, Zed 등은 대신 AGENTS.md를 읽어요. 어떤 파일을 유지할지는 팀에서 사용하는 도구 수에 따라 결정해요.
| 시나리오 | 권장 사항 |
|---|---|
| 단일 도구(Claude Code만 사용) | CLAUDE.md만 있으면 충분해요 — AGENTS.md는 필요하지 않아요 |
| 다중 도구 팀 | AGENTS.md를 공유 기준 원천으로 유지하고, 이를 가져오는 가벼운 CLAUDE.md를 추가하세요 |
단일 도구: CLAUDE.md만 사용¶
팀 구성원이 모두 Claude Code를 사용한다면 모든 내용을 CLAUDE.md에 넣으세요. 두 번째 파일을 만들어도 얻을 수 있는 이점은 없어요.
다중 도구: AGENTS.md를 기준 원천으로 사용¶
팀에서 Claude Code와 Cursor, Codex, Copilot 또는 다른 도구를 함께 사용한다면, 공유 규칙인 기술 스택, 명령, 코딩 규칙, 프로젝트 구조를 AGENTS.md에 유지하세요. 그런 다음 CLAUDE.md는 이를 가져오고 Claude 전용 추가 사항만 담는 가벼운 파일로 구성하세요:
# Project Rules
@AGENTS.md
## Claude Code specifics
- Use /model to switch to Opus 5.5 for large refactors
- Reference docs/architecture.md instead of pasting it
@AGENTS.md 줄은 공유 내용을 Claude Code의 컨텍스트로 가져와요. 그러면 Claude는 팀 규칙과 Claude 전용 추가 사항을 함께 적용받아요. 동일한 규칙의 서로 다른 사본 두 개를 유지하는 것은 피하세요 — 두 파일이 결국 서로 달라지는 것이 가장 큰 문제예요.
AGENTS.md 형식과 도구 지원에 관한 자세한 내용은 AGENTS.md 구성 가이드를 참고하세요.
다음 단계¶
- 컨텍스트 관리를 익혀 보세요 — 컨텍스트 창을 관리하는 기법을 숙지할 수 있어요
- 권한 설정을 익혀 보세요 — Claude가 수행하도록 허용된 작업을 제어할 수 있어요
- 워크플로 팁을 익혀 보세요 — 효율적인 Claude Code 워크플로를 구축할 수 있어요
QCode 시작하기
Claude Code, Codex 등에 API 키 하나를 쓰세요. 토큰 단위로 과금하며 모델별 가격은 qcode.cc/models에 있어요