클로드코드 12-claude-directory
1. .claude 디렉토리
참고: Claude Code가 설정을 읽는 위치와 각 파일의 역할
1.1. 개요
Claude Code는 프로젝트 설정을 ./.claude/에서, 사용자 전역 설정을 ~/.claude/에서 읽는다.
1.2. 프로젝트 레벨 (./)
- 파일/디렉토리: 역할: git에 커밋?
- CLAUDE.md: 프로젝트 지시사항: ✅
- .mcp.json: 프로젝트 MCP 서버 설정: ✅
- .worktreeinclude: worktree 생성 시 복사할 gitignored 파일 목록: ✅
- .claude/settings.json: 권한, hooks, 모델 등 설정: ✅
- .claude/settings.local.json: 개인 설정 오버라이드: ❌ (자동 gitignored)
- .claude/rules/: 주제별/경로별 규칙 파일: ✅
- .claude/skills/: 재사용 가능한 skill 폴더: ✅
- .claude/commands/: 단일 파일 명령어 (skill로 대체 권장): ✅
- .claude/agents/: 커스텀 subagent 정의: ✅
- .claude/output-styles/: 프로젝트 공유 output style: ✅
- .claude/agent-memory/: subagent 지속 메모리 (프로젝트 범위): ✅
1.3. 사용자 레벨 (~/.claude/)
- 파일/디렉토리: 역할
- .claude.json: 앱 상태, UI 설정, 개인 MCP 서버
- CLAUDE.md: 모든 프로젝트의 개인 지시사항
- settings.json: 모든 프로젝트의 기본 설정
- keybindings.json: 커스텀 키보드 단축키
- themes/: 커스텀 색상 테마
- projects/: Auto memory 저장소
- rules/: 사용자 전역 규칙
- skills/: 사용자 전역 skill
- commands/: 사용자 전역 명령어
- output-styles/: 사용자 전역 output style
- agents/: 사용자 전역 subagent
- agent-memory/: subagent 지속 메모리 (사용자 범위)
1.4. 주요 파일 상세
1.4.1. CLAUDE.md
- 위치: ./CLAUDE.md, ./.claude/CLAUDE.md, ~/.claude/CLAUDE.md
- 매 세션 시작 시 컨텍스트에 로드
- 200줄 이하 권장
1.4.2. .mcp.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
1.4.3. .claude/settings.json
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": ["Bash(npm test *)"],
"deny": ["Bash(rm -rf *)"]
},
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "npx prettier --write"
}]
}]
}
}
1.4.4. .claude/rules/
마크다운 파일로 주제별 규칙 작성. YAML frontmatter로 paths를 지정하면 조건부 로드.
---
paths:
- "**/*.test.ts"
---
# Testing Rules
- Use descriptive test names
- Mock external dependencies
1.4.5. .claude/skills/
각 skill은 폴더에 SKILL.md와 필요한 지원 파일을 포함.
.claude/skills/security-review/
├── SKILL.md
└── checklist.md
---
description: Reviews code for security vulnerabilities
disable-model-invocation: true
argument-hint: <branch-or-path>
---
!\`git diff $ARGUMENTS\`
Audit the changes above for injection vulnerabilities, auth gaps, and secrets.
1.4.6. .claude/agents/
subagent 정의 파일.
---
name: code-reviewer
description: Reviews code for correctness and security
tools: Read, Grep, Glob
---
You are a senior code reviewer. Review for correctness, security, and maintainability.

민형준 님의 최근 댓글
ㅋㅋㅋㅋㅋ 2019 01.14 잘 읽었습니다 2018 12.30 포인트가 없어서 아직 시작을 못하고있는데요! 글은 잘 읽었습니다! 포인트 쌓고 도전할거에요 2018 12.30