CClaude Code Catalog
전체 패턴

컨텍스트 윈도우 관리

워크플로우중급

대규모 코드베이스는 Claude의 컨텍스트 윈도우를 쉽게 초과합니다. 이 패턴은 세션을 생산적으로 유지하는 전략을 제공합니다: /compact로 히스토리를 요약하고, CLAUDE.md에 핵심 정보를 우선 배치하며, 작업을 집중된 세션으로 분할하고, 전체 모듈 대신 파일 수준 요약을 사용합니다. 새 세션을 시작할지 현재 세션을 compact할지 결정하는 의사결정 트리를 포함합니다.

컨텍스트메모리대규모 코드베이스세션 관리

패턴 코드

# Context Window Management Pattern ## Strategy 1: CLAUDE.md as Persistent Memory ```markdown # CLAUDE.md — Context Anchors ## Architecture Overview (always loaded first) - Monorepo: apps/ (3 apps), packages/ (7 shared packages) - Entry points: apps/{web,api,admin}/src/index.ts - Shared types: packages/types/src/index.ts ## Key Files (read these before making changes) - Database schema: packages/db/schema.ts - API routes map: apps/api/src/routes/index.ts - Environment config: packages/config/src/env.ts ## Recent Decisions (prevents re-discussion) - 2024-03-01: Switched from REST to tRPC for internal APIs - 2024-02-15: Adopted Drizzle ORM, removed Prisma - 2024-02-10: All new components use Radix UI primitives ``` ## Strategy 2: Session Splitting ```bash # Session 1: Analysis only — output to file claude -p "Analyze src/services/ and list all functions that need error handling improvements. Output to docs/error-audit.md" --output-file error-audit.md # Session 2: Fix based on analysis (fresh context) claude -p "Read docs/error-audit.md and fix each listed issue. Work through files one at a time." ``` ## Strategy 3: Compact Triggers ```markdown # CLAUDE.md — Compact Rules ## When to /compact - After completing a distinct subtask - Before switching to a different module - When you notice repeated file reads ## Compact Summary Format Always include in compact summary: 1. What was accomplished 2. Current file being worked on 3. Remaining items from the task list 4. Any blockers or decisions made ``` ## Strategy 4: Focused File Loading ```bash # Instead of "read the entire src/ directory" # Ask Claude to read specific files claude -p "Read only src/services/auth.ts and src/middleware/validate.ts. Fix the token refresh bug described in issue #234." ```

이 패턴을 프로젝트 설정에 복사하여 적용하세요.

실행 미리보기

컨텍스트 윈도우 관리

컨텍스트 윈도우 관리에 대해

Claude Code 패턴은 복잡한 개발 시나리오를 효과적으로 다루기 위한 검증된 아키텍처 설계와 워크플로우 구조입니다. 컨텍스트 윈도우 관리은(는) 중급 수준의 워크플로우 패턴으로, 프로젝트에 맞게 응용할 수 있는 테스트된 반복 가능한 접근 방식을 제공하여 더 효율적이고 일관된 결과를 만들어 냅니다.

관련 패턴