一键导入
prompt-caching-strategy
프롬프트 캐시 최적화 전략 — Dynamic Boundary 배치, 토큰 예산 관리, 정적·동적 영역 분리. 자연어 트리거: '프롬프트 캐시 최적화해줘', '토큰 예산 관리', '캐시 효율 높여줘', 'CLAUDE.md 레이아웃 정리'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
프롬프트 캐시 최적화 전략 — Dynamic Boundary 배치, 토큰 예산 관리, 정적·동적 영역 분리. 자연어 트리거: '프롬프트 캐시 최적화해줘', '토큰 예산 관리', '캐시 효율 높여줘', 'CLAUDE.md 레이아웃 정리'.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| context | fork |
| disable-model-invocation | true |
| name | prompt-caching-strategy |
| description | 프롬프트 캐시 최적화 전략 — Dynamic Boundary 배치, 토큰 예산 관리, 정적·동적 영역 분리. 자연어 트리거: '프롬프트 캐시 최적화해줘', '토큰 예산 관리', '캐시 효율 높여줘', 'CLAUDE.md 레이아웃 정리'. |
| lang | ["en","ko"] |
| platforms | ["claude-code","gemini-cli","codex-cli","cursor"] |
| level | progressive |
| triggers | ["prompt cache","프롬프트 캐시","token efficiency","토큰 효율","context management","컨텍스트 관리","dynamic boundary","캐시 최적화","토큰 예산"] |
| agent | Explore |
| allowed-tools | ["Read","Grep","Glob","Bash"] |
| agents | ["performance-engineer","architect"] |
| tokens | 3000 |
| level1_tokens | 200 |
| level2_tokens | 3000 |
| category | optimization |
| risk | safe |
| version | 1.0.0 |
| lastVerified | 2026-04-01 |
| source_hash | 4787da02 |
| whenNotToUse | Platforms that do not support prompt caching (e.g., non-Anthropic APIs) or single-turn tasks where prompt structure changes every request and no static prefix exists to cache. |
Claude Code 시스템 프롬프트에는 __SYSTEM_PROMPT_DYNAMIC_BOUNDARY__ 마커가 존재한다. 이 마커를 기준으로:
| 영역 | 위치 | 캐시 | 비용 |
|---|---|---|---|
| 정적 영역 | 마커 위 | 캐시됨 | 90% 절감 (캐시 히트 시) |
| 동적 영역 | 마커 아래 | 매 턴 재계산 | 전체 비용 |
chars / 4 + 1정적 영역 (캐시 대상 — 변경 빈도 낮음):
CLAUDE.md 상단:
├── DEV Protocol (Decompose-Execute-Verify)
├── Zero-Skip Policy
├── Quality Gates (함수 50줄, 파일 800줄, 커버리지 80%)
├── Agent Delegation 규칙
├── Naming Conventions
├── Development Standards (ESM only, immutable patterns)
└── Config Files 목록
동적 영역 (매 턴/세션 변경):
system-reminder 태그 내:
├── git status (현재 브랜치, 변경 파일)
├── currentDate (오늘 날짜)
├── MEMORY.md (자동 메모리 인덱스)
├── 활성 스킬 목록 (현재 로드된 스킬)
├── MCP 서버 상태
└── 최근 커밋 로그
# Project Instructions ← 정적 (캐시됨)
## DEV Protocol ← 가장 중요한 규칙을 최상단에
1. DECOMPOSE
2. EXECUTE
3. VERIFY
## Quality Gates ← 핵심 제약 조건
- Read before write
- Functions < 50 lines, files < 800 lines
- 80%+ test coverage
## Agent Delegation ← 위임 규칙
- Complex features → planner
- After code → code-reviewer
## Naming Conventions ← 참조 정보 (덜 중요)
---
__SYSTEM_PROMPT_DYNAMIC_BOUNDARY__ ← 여기부터 동적
---
## Dynamic Context ← 매 턴 변경
- git status, date, memory, skills
핵심: 변경 빈도가 낮은 지시사항을 boundary 위에, 자주 변하는 정보를 아래에 배치하면 캐시 히트율이 극대화된다.
요청 수신
├── 트리거 매칭 → 해당 스킬의 Level 1 로드 (~200 토큰)
├── Level 1으로 충분? → 완료
└── 상세 필요? → Level 2 추가 로드 (~2500-4000 토큰)
Progressive disclosure의 캐시 이점:
| 파일 유형 | 최대 chars | 추정 토큰 | 비고 |
|---|---|---|---|
| CLAUDE.md | 4,000 | ~1,001 | 프로젝트 루트 |
| CLAUDE.local.md | 4,000 | ~1,001 | 개인 설정 |
| rules/*.md (각) | 4,000 | ~1,001 | 경로별 자동 규칙 |
| 총합 | 12,000 | ~3,001 | 모든 instruction 파일 합계 |
예산 초과 시 대응:
캐시 효율을 간접적으로 판단하는 방법:
캐시 히트율 ≈ 정적 영역 토큰 / 전체 시스템 프롬프트 토큰
목표: 캐시 히트율 > 70%
→ 시스템 프롬프트의 70% 이상이 정적 영역에 있어야 함
→ 나머지 30%만 매 턴 재계산
비용 절감 계산:
기존 비용: 전체_토큰 × 단가
캐시 후: (정적_토큰 × 단가 × 0.1) + (동적_토큰 × 단가)
절감율: 1 - ((정적 × 0.1 + 동적) / 전체)
예: 시스템 프롬프트 10K 토큰, 정적 7K + 동적 3K → 절감율 = 1 - ((7000 × 0.1 + 3000) / 10000) = 1 - 0.37 = 63% 절감
Progress:
- [ ] Step 1: 현재 CLAUDE.md 내용을 정적/동적으로 분류
- [ ] Step 2: 정적 지시사항을 CLAUDE.md 상단으로 이동
- [ ] Step 3: 동적 컨텍스트가 system-reminder에 있는지 확인
- [ ] Step 4: 개별 파일 4K chars 이하 확인
- [ ] Step 5: 총합 12K chars 이하 확인
- [ ] Step 6: 스킬의 progressive disclosure 적용 확인
- [ ] Step 7: 캐시 히트율 추정 (목표 70% 이상)
| 항목 | 정적 (캐시) | 동적 (매 턴) |
|---|---|---|
| DEV Protocol | O | |
| Quality Gates | O | |
| Naming Conventions | O | |
| git status | O | |
| 오늘 날짜 | O | |
| MEMORY.md | O | |
| 활성 스킬 목록 | O | |
| 스킬 Level 1 | 이전 턴 캐시 가능 | 첫 로드 시 동적 |
The following table captures common excuses agents make to skip the discipline of this skill, paired with factual rebuttals.
| Excuse | Rebuttal |
|---|---|
| "cache hits are a nice-to-have" | cached tokens are 10x cheaper and 5x faster — at scale this is the difference between viable and unviable |
| "I'll put dynamic context first for freshness" | dynamic-first destroys cache reuse; put static above dynamic to maximize the cacheable prefix |
| "the boundary doesn't matter much" | the boundary is everything — one byte of dynamic content above your static block invalidates the entire prefix cache |
| "caching makes debugging harder" | cached requests are identical by construction — they're EASIER to debug, not harder |
| "tool definitions change too often to cache" | tool definitions should be versioned and stable; "too often" means your tool design needs discipline, not that caching is wrong |
Claude advisor tool strategy for cost-optimized quality retention. Sonnet executor + Opus advisor pattern reduces API cost by ~50% while maintaining near-Opus quality on complex judgment calls. Auto-activates when discussing model cost optimization, executor-advisor delegation, or advisor API integration. Triggers: advisor, cost optimization, model strategy, executor-advisor, advisor tool
Use when creating or editing a SKILL.md. 자연어 트리거: '스킬 만들어줘', '새 스킬 추가', '스킬 작성해줘', 'skill 만들기', '스킬 프론트매터 고쳐줘', 'create a skill', 'edit SKILL.md'.
로컬 관측성(observability) 스킬 — Claude Code hook 이벤트를 JSONL 큐로 fan-out하고 localhost WebSocket 브로드캐스트로 대시보드에 노출. 외부 전송 0건, Artibot 내부 전용. Auto-activates when: building a local hook monitor, an on-device agent dashboard, or an observability surface. Triggers: hook monitor, agent dashboard, event tap, local telemetry, claude code hooks, 훅 모니터, 이벤트 대시보드, 관측성.
Distill a person, role, or character into a reusable persona skill via the 6-layer schema. Use when the user wants to compile a colleague, an internal role archetype, or an authoring style into a persona-* skill — not when invoking an existing persona.
Dynamic tool approval predicates and the bash command allowlist. Use when the user asks about HITL approvals or tightening the pre-bash gate. Triggers: tool approval, approval predicate, bash allowlist, pre-bash, permission gate, HITL.
Coding standards and style guide enforcing immutability, error handling, file organization, and naming conventions. Auto-activates when: writing or modifying code, code review, creating new files or components. Triggers: code, write, edit, implement, component, function, class, style, 코드 작성, 코딩 스타일, 코드 리뷰, 구현, 컴포넌트, 함수