@kood/claude-code 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +53 -7
- package/package.json +2 -1
- package/templates/.claude/PARALLEL_AGENTS.md +737 -0
- package/templates/.claude/agents/analyst.md +416 -0
- package/templates/.claude/agents/architect.md +569 -0
- package/templates/.claude/agents/code-reviewer.md +132 -133
- package/templates/.claude/agents/dependency-manager.md +93 -94
- package/templates/.claude/agents/deployment-validator.md +64 -65
- package/templates/.claude/agents/designer.md +655 -0
- package/templates/.claude/agents/document-writer.md +500 -0
- package/templates/.claude/agents/explore.md +499 -0
- package/templates/.claude/agents/git-operator.md +74 -75
- package/templates/.claude/agents/implementation-executor.md +138 -109
- package/templates/.claude/agents/ko-to-en-translator.md +18 -22
- package/templates/.claude/agents/lint-fixer.md +250 -93
- package/templates/.claude/agents/planner.md +356 -0
- package/templates/.claude/agents/refactor-advisor.md +135 -136
- package/templates/.claude/commands/bug-fix.md +296 -207
- package/templates/.claude/commands/git-all.md +199 -46
- package/templates/.claude/commands/git-session.md +113 -57
- package/templates/.claude/commands/lint-fix.md +219 -153
- package/templates/.claude/commands/lint-init.md +113 -76
- package/templates/.claude/commands/pre-deploy.md +190 -124
- package/templates/.claude/commands/refactor.md +407 -162
- package/templates/.claude/commands/version-update.md +138 -37
- package/templates/.claude/instructions/context-engineering/ANTHROPIC_CONTEXT_ENGINEERING.md +178 -0
- package/templates/.claude/instructions/context-engineering/references/claude-4x.md +215 -0
- package/templates/.claude/instructions/context-engineering/references/core-principles.md +137 -0
- package/templates/.claude/instructions/context-engineering/references/examples.md +351 -0
- package/templates/.claude/instructions/context-engineering/references/techniques.md +162 -0
- package/templates/.claude/instructions/parallel-agent-execution.md +874 -0
- package/templates/.claude/skills/docs-creator/AGENTS.md +238 -0
- package/templates/.claude/{commands/docs-creator.md → skills/docs-creator/SKILL.md} +61 -75
- package/templates/.claude/skills/docs-refactor/AGENTS.md +270 -0
- package/templates/.claude/{commands/docs-refactor.md → skills/docs-refactor/SKILL.md} +30 -44
- package/templates/.claude/skills/execute/SKILL.md +451 -0
- package/templates/.claude/skills/figma-to-code/AGENTS.md +287 -0
- package/templates/.claude/skills/figma-to-code/SKILL.md +225 -225
- package/templates/.claude/skills/figma-to-code/references/design-tokens.md +75 -73
- package/templates/.claude/skills/figma-to-code/references/figma-mcp-tools.md +73 -73
- package/templates/.claude/skills/figma-to-code/references/layout-mapping.md +104 -104
- package/templates/.claude/skills/figma-to-code/references/responsive-design.md +99 -99
- package/templates/.claude/skills/figma-to-code/references/verification.md +91 -91
- package/templates/.claude/skills/global-uiux-design/AGENTS.md +317 -0
- package/templates/.claude/skills/global-uiux-design/SKILL.md +738 -0
- package/templates/.claude/skills/global-uiux-design/references/accessibility.md +401 -0
- package/templates/.claude/skills/global-uiux-design/references/color-system.md +275 -0
- package/templates/.claude/skills/global-uiux-design/references/design-philosophy.md +206 -0
- package/templates/.claude/skills/global-uiux-design/references/design-systems.md +446 -0
- package/templates/.claude/skills/korea-uiux-design/AGENTS.md +307 -0
- package/templates/.claude/skills/korea-uiux-design/SKILL.md +170 -0
- package/templates/.claude/skills/nextjs-react-best-practices/AGENTS.md +95 -116
- package/templates/.claude/skills/nextjs-react-best-practices/SKILL.md +134 -152
- package/templates/.claude/skills/nextjs-react-best-practices/rules/advanced-event-handler-refs.md +6 -6
- package/templates/.claude/skills/nextjs-react-best-practices/rules/advanced-use-latest.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/async-api-routes.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/async-defer-await.md +22 -22
- package/templates/.claude/skills/nextjs-react-best-practices/rules/async-dependencies.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/async-parallel.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/async-suspense-boundaries.md +21 -21
- package/templates/.claude/skills/nextjs-react-best-practices/rules/bundle-barrel-imports.md +18 -18
- package/templates/.claude/skills/nextjs-react-best-practices/rules/bundle-conditional.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/bundle-defer-third-party.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/bundle-dynamic-imports.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/bundle-preload.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/client-event-listeners.md +9 -9
- package/templates/.claude/skills/nextjs-react-best-practices/rules/client-swr-dedup.md +7 -7
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-batch-dom-css.md +13 -13
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-cache-function-results.md +14 -14
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-cache-property-access.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-cache-storage.md +10 -10
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-combine-iterations.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-early-exit.md +7 -7
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-hoist-regexp.md +6 -6
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-index-maps.md +6 -6
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-length-check-first.md +14 -14
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-min-max-loop.md +16 -16
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-set-map-lookups.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/js-tosorted-immutable.md +17 -17
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-activity.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-animate-svg-wrapper.md +11 -11
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-conditional-render.md +8 -8
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-content-visibility.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-hoist-jsx.md +6 -6
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-hydration-no-flicker.md +14 -14
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rendering-svg-precision.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-defer-reads.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-dependencies.md +7 -7
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-derived-state.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-functional-setstate.md +34 -34
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-lazy-state-init.md +15 -15
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-memo.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/rerender-transitions.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/server-after-nonblocking.md +24 -24
- package/templates/.claude/skills/nextjs-react-best-practices/rules/server-cache-lru.md +10 -10
- package/templates/.claude/skills/nextjs-react-best-practices/rules/server-cache-react.md +4 -4
- package/templates/.claude/skills/nextjs-react-best-practices/rules/server-parallel-fetching.md +5 -5
- package/templates/.claude/skills/nextjs-react-best-practices/rules/server-serialization.md +6 -6
- package/templates/.claude/skills/plan/SKILL.md +594 -0
- package/templates/.claude/skills/prd/SKILL.md +496 -0
- package/templates/.claude/skills/ralph/AGENTS.md +393 -0
- package/templates/.claude/skills/ralph/SKILL.md +1035 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/AGENTS.md +100 -121
- package/templates/.claude/skills/tanstack-start-react-best-practices/SKILL.md +139 -157
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/async-defer-await.md +22 -22
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/async-dependencies.md +5 -5
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/async-loader.md +7 -7
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/async-parallel.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-barrel-imports.md +18 -18
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-conditional.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-defer-third-party.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-lazy-routes.md +12 -12
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-preload.md +5 -5
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/client-event-listeners.md +9 -9
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/client-tanstack-query.md +12 -12
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-batch-dom-css.md +13 -13
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-cache-function-results.md +14 -14
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-cache-property-access.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-cache-storage.md +10 -10
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-combine-iterations.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-early-exit.md +7 -7
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-hoist-regexp.md +6 -6
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-index-maps.md +6 -6
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-length-check-first.md +14 -14
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-min-max-loop.md +16 -16
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-set-map-lookups.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/js-tosorted-immutable.md +17 -17
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rendering-animate-svg-wrapper.md +11 -11
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rendering-conditional-render.md +8 -8
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rendering-content-visibility.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rendering-hoist-jsx.md +6 -6
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rendering-svg-precision.md +5 -5
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-defer-reads.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-dependencies.md +7 -7
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-derived-state.md +5 -5
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-functional-setstate.md +34 -34
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-lazy-state-init.md +15 -15
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-memo.md +5 -5
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-transitions.md +4 -4
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-cache-lru.md +12 -12
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-deferred-data.md +14 -14
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-parallel-fetching.md +9 -9
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-serialization.md +6 -6
- package/templates/.claude/commands/agent-creator.md +0 -370
- package/templates/.claude/commands/command-creator.md +0 -524
- package/templates/.claude/commands/execute.md +0 -469
- package/templates/.claude/commands/git.md +0 -98
- package/templates/.claude/commands/plan.md +0 -526
- package/templates/.claude/commands/prd.md +0 -629
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
# Multi-Agent Coordination Guide
|
|
2
|
+
|
|
3
|
+
병렬 에이전트 실행 및 조정을 통한 성능 최적화와 작업 효율 극대화.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<overview>
|
|
8
|
+
|
|
9
|
+
## 핵심 원칙
|
|
10
|
+
|
|
11
|
+
**Goal:** 독립적인 작업을 동시에 처리하여 대기 시간 최소화, 처리량 극대화, 비용 절감.
|
|
12
|
+
|
|
13
|
+
**Performance:** 순차 실행 → 병렬 실행으로 5-15배 성능 향상.
|
|
14
|
+
|
|
15
|
+
</overview>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
<core_principles>
|
|
20
|
+
|
|
21
|
+
## 3대 원칙
|
|
22
|
+
|
|
23
|
+
| 원칙 | 실행 방법 | 기대 효과 |
|
|
24
|
+
|------|----------|----------|
|
|
25
|
+
| **PARALLEL** | 단일 메시지에서 여러 Tool 동시 호출 | 5-15배 속도 향상 |
|
|
26
|
+
| **BACKGROUND** | 10개 이상 작업 시 `run_in_background=true` | 대기 시간 제거 |
|
|
27
|
+
| **DELEGATE** | 전문 에이전트에게 즉시 위임 | 컨텍스트 격리, 품질 향상 |
|
|
28
|
+
|
|
29
|
+
**핵심 룰:**
|
|
30
|
+
```typescript
|
|
31
|
+
// ❌ 순차 실행 (느림)
|
|
32
|
+
Task(...) // 60초 대기
|
|
33
|
+
Task(...) // 60초 대기
|
|
34
|
+
// 총 120초
|
|
35
|
+
|
|
36
|
+
// ✅ 병렬 실행 (빠름)
|
|
37
|
+
Task(...) // 단일 메시지에서
|
|
38
|
+
Task(...) // 동시 호출
|
|
39
|
+
// 총 60초 (가장 긴 작업 기준)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</core_principles>
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
<model_routing>
|
|
47
|
+
|
|
48
|
+
## 스마트 모델 라우팅
|
|
49
|
+
|
|
50
|
+
**원칙:** 작업 복잡도에 따라 모델 선택, 비용 최적화.
|
|
51
|
+
|
|
52
|
+
| 복잡도 | 모델 | 작업 예시 | 비용 | 속도 |
|
|
53
|
+
|--------|------|----------|------|------|
|
|
54
|
+
| **LOW** | haiku | 파일 읽기, 정의 조회, 간단한 탐색 | 💰 | ⚡⚡⚡ |
|
|
55
|
+
| **MEDIUM** | sonnet | 기능 구현, 버그 수정, 리팩토링 | 💰💰 | ⚡⚡ |
|
|
56
|
+
| **HIGH** | opus | 아키텍처 설계, 복잡한 디버깅, 보안 | 💰💰💰 | ⚡ |
|
|
57
|
+
|
|
58
|
+
**모델 명시 예시:**
|
|
59
|
+
```typescript
|
|
60
|
+
Task(subagent_type="explore", model="haiku", ...) // 빠르고 저렴
|
|
61
|
+
Task(subagent_type="implementation-executor", model="sonnet", ...)
|
|
62
|
+
Task(subagent_type="planner", model="opus", ...) // 복잡하지만 정확
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
</model_routing>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
<agent_roster>
|
|
70
|
+
|
|
71
|
+
## 에이전트 목록
|
|
72
|
+
|
|
73
|
+
### 계획 및 분석
|
|
74
|
+
|
|
75
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
76
|
+
|---------|------|------|----------|
|
|
77
|
+
| **planner** | opus | 작업 계획 수립, 인터뷰, .claude/plans/ 생성 | ❌ (조정자) |
|
|
78
|
+
| **analyst** | sonnet | 데이터 분석, 패턴 발견 | ✅ |
|
|
79
|
+
| **architect** | opus | 아키텍처 설계, 시스템 디자인 | ❌ (의사결정) |
|
|
80
|
+
|
|
81
|
+
### 탐색 및 조사
|
|
82
|
+
|
|
83
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
84
|
+
|---------|------|------|----------|
|
|
85
|
+
| **explore** | haiku | 코드베이스 빠른 탐색, 파일/패턴 검색 | ✅ |
|
|
86
|
+
|
|
87
|
+
### 구현
|
|
88
|
+
|
|
89
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
90
|
+
|---------|------|------|----------|
|
|
91
|
+
| **implementation-executor** | sonnet | 즉시 구현, 옵션 제시 없이 최적 방법 실행 | ✅ |
|
|
92
|
+
| **designer** | sonnet/opus | UI/UX 구현, 컴포넌트 작성 | ✅ |
|
|
93
|
+
|
|
94
|
+
### 검증 및 수정
|
|
95
|
+
|
|
96
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
97
|
+
|---------|------|------|----------|
|
|
98
|
+
| **deployment-validator** | sonnet | typecheck/lint/build 검증 | ❌ (순차) |
|
|
99
|
+
| **lint-fixer** | sonnet | tsc/eslint 에러 자동 수정 | ✅ |
|
|
100
|
+
| **code-reviewer** | opus | 코드 리뷰, 보안/성능 검토 | ✅ |
|
|
101
|
+
|
|
102
|
+
### 문서 및 유틸
|
|
103
|
+
|
|
104
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
105
|
+
|---------|------|------|----------|
|
|
106
|
+
| **document-writer** | haiku/sonnet | 문서 작성, 주석, README | ✅ |
|
|
107
|
+
| **ko-to-en-translator** | sonnet | 한글 → 영어 번역 (커밋 메시지) | ✅ |
|
|
108
|
+
|
|
109
|
+
### Git 및 배포
|
|
110
|
+
|
|
111
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
112
|
+
|---------|------|------|----------|
|
|
113
|
+
| **git-operator** | sonnet | Git 작업 (commit, branch, merge) | ❌ (순차) |
|
|
114
|
+
| **dependency-manager** | sonnet | package.json 의존성 관리 | ❌ (의존성) |
|
|
115
|
+
|
|
116
|
+
### 고급
|
|
117
|
+
|
|
118
|
+
| 에이전트 | 모델 | 용도 | 병렬 가능 |
|
|
119
|
+
|---------|------|------|----------|
|
|
120
|
+
| **refactor-advisor** | opus | 리팩토링 전략 제안 | ❌ (의사결정) |
|
|
121
|
+
|
|
122
|
+
</agent_roster>
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
<coordination_patterns>
|
|
127
|
+
|
|
128
|
+
## 조정 패턴
|
|
129
|
+
|
|
130
|
+
### 패턴 1: 서브에이전트 패턴 (Subagents)
|
|
131
|
+
|
|
132
|
+
**특징:** 메인 에이전트가 컨텍스트 유지, 서브에이전트는 stateless.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// 메인 에이전트: 전체 흐름 조정
|
|
136
|
+
// 서브에이전트 1: API 구현
|
|
137
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
138
|
+
prompt="User API 엔드포인트 구현")
|
|
139
|
+
|
|
140
|
+
// 서브에이전트 2: UI 구현 (동시 실행)
|
|
141
|
+
Task(subagent_type="designer", model="sonnet",
|
|
142
|
+
prompt="User Profile UI 구현")
|
|
143
|
+
|
|
144
|
+
// 서브에이전트 3: 테스트 작성 (동시 실행)
|
|
145
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
146
|
+
prompt="API 통합 테스트 작성")
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**장점:**
|
|
150
|
+
- 컨텍스트 격리 (재귀 위임 방지)
|
|
151
|
+
- 병렬 실행 (독립적인 작업)
|
|
152
|
+
- 재사용 가능 (전문화된 에이전트)
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 패턴 2: 순차 파이프라인 (Sequential Pipeline)
|
|
157
|
+
|
|
158
|
+
**용도:** 단계별 의존성 있는 작업.
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// Step 1: 분석 (haiku)
|
|
162
|
+
Task(subagent_type="explore", model="haiku",
|
|
163
|
+
prompt="기존 인증 로직 분석")
|
|
164
|
+
|
|
165
|
+
// Step 2: 구현 (sonnet) - Step 1 결과 필요
|
|
166
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
167
|
+
prompt="분석 결과 바탕으로 새 인증 로직 구현")
|
|
168
|
+
|
|
169
|
+
// Step 3: 검증 (sonnet) - Step 2 완료 필요
|
|
170
|
+
Task(subagent_type="deployment-validator", model="sonnet",
|
|
171
|
+
prompt="typecheck/lint/build 검증")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**주의:** 순차 실행은 의존성이 명확할 때만 사용.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 패턴 3: 라우터 패턴 (Router)
|
|
179
|
+
|
|
180
|
+
**정의:** 중앙 에이전트가 작업 분석 후 전문 에이전트에게 라우팅.
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
// 작업 분석
|
|
184
|
+
const taskType = analyzeTask(userRequest)
|
|
185
|
+
|
|
186
|
+
// 조건부 라우팅
|
|
187
|
+
if (taskType === "frontend") {
|
|
188
|
+
Task(subagent_type="designer", model="sonnet", ...)
|
|
189
|
+
} else if (taskType === "backend") {
|
|
190
|
+
Task(subagent_type="implementation-executor", model="sonnet", ...)
|
|
191
|
+
} else if (taskType === "documentation") {
|
|
192
|
+
Task(subagent_type="document-writer", model="haiku", ...)
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**활용:** 복잡한 요청을 도메인별로 자동 분배.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### 패턴 4: Fan-Out Fan-In
|
|
201
|
+
|
|
202
|
+
**정의:** 하나의 작업을 여러 하위 작업으로 분산(Fan-Out) → 결과 수집 및 통합(Fan-In).
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// Fan-Out: 여러 컴포넌트 동시 구현
|
|
206
|
+
Task(subagent_type="designer", model="sonnet",
|
|
207
|
+
prompt="Header 컴포넌트 구현")
|
|
208
|
+
Task(subagent_type="designer", model="sonnet",
|
|
209
|
+
prompt="Footer 컴포넌트 구현")
|
|
210
|
+
Task(subagent_type="designer", model="sonnet",
|
|
211
|
+
prompt="Sidebar 컴포넌트 구현")
|
|
212
|
+
|
|
213
|
+
// Fan-In: 결과 수집 후 통합
|
|
214
|
+
Read("components/Header.tsx")
|
|
215
|
+
Read("components/Footer.tsx")
|
|
216
|
+
Read("components/Sidebar.tsx")
|
|
217
|
+
// → Layout.tsx에 통합
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**활용 사례:**
|
|
221
|
+
- 여러 API 엔드포인트 동시 호출
|
|
222
|
+
- 다중 컴포넌트 병렬 구현
|
|
223
|
+
- 배치 데이터 처리
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### 패턴 5: 계층적 위임 (Hierarchical Delegation)
|
|
228
|
+
|
|
229
|
+
**구조:** 메인 에이전트 → 계획 + 조정, 서브 에이전트 → 실행.
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
// 메인 에이전트: 계획 수립
|
|
233
|
+
Task(subagent_type="planner", model="opus",
|
|
234
|
+
prompt="전체 아키텍처 설계 및 작업 분해")
|
|
235
|
+
|
|
236
|
+
// 서브 에이전트: 병렬 실행
|
|
237
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
238
|
+
prompt="Auth 모듈 구현")
|
|
239
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
240
|
+
prompt="User 모듈 구현")
|
|
241
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
242
|
+
prompt="Post 모듈 구현")
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**장점:**
|
|
246
|
+
- 컨텍스트 격리 (각 에이전트 독립 컨텍스트)
|
|
247
|
+
- 전문화 (도메인별 최적화)
|
|
248
|
+
- 재시도 용이 (실패 시 해당 에이전트만 재실행)
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### 패턴 6: 배치 처리 (Batching)
|
|
253
|
+
|
|
254
|
+
**원리:** 유사 작업을 묶어서 컨텍스트 공유, 토큰 70-90% 절감.
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
// ❌ 개별 처리 (비효율)
|
|
258
|
+
Edit("file1.ts", ...) // 컨텍스트 전송
|
|
259
|
+
Edit("file2.ts", ...) // 컨텍스트 재전송
|
|
260
|
+
Edit("file3.ts", ...) // 컨텍스트 재전송
|
|
261
|
+
|
|
262
|
+
// ✅ 배치 처리 (효율)
|
|
263
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
264
|
+
prompt=`다음 파일들에 동일한 수정 적용:
|
|
265
|
+
- file1.ts
|
|
266
|
+
- file2.ts
|
|
267
|
+
- file3.ts
|
|
268
|
+
|
|
269
|
+
수정 내용: [공통 규칙]`)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**적용 기준:**
|
|
273
|
+
- 10개 이상 유사 작업
|
|
274
|
+
- 공통 컨텍스트 공유 가능
|
|
275
|
+
- 순서 무관
|
|
276
|
+
|
|
277
|
+
</coordination_patterns>
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
<context_preservation>
|
|
282
|
+
|
|
283
|
+
## 컨텍스트 보존
|
|
284
|
+
|
|
285
|
+
### 문제: 병렬 실행 시 컨텍스트 손실
|
|
286
|
+
|
|
287
|
+
**원인:**
|
|
288
|
+
- 서브에이전트는 독립 컨텍스트
|
|
289
|
+
- 메인 에이전트 컨텍스트와 분리
|
|
290
|
+
- 결과만 전달됨
|
|
291
|
+
|
|
292
|
+
### 해결책
|
|
293
|
+
|
|
294
|
+
#### 1. 공유 상태 관리
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// ❌ 컨텍스트 손실
|
|
298
|
+
Task(subagent_type="implementation-executor",
|
|
299
|
+
prompt="모듈 A 구현")
|
|
300
|
+
Task(subagent_type="implementation-executor",
|
|
301
|
+
prompt="모듈 B 구현")
|
|
302
|
+
// → 서로 모듈 존재 모름
|
|
303
|
+
|
|
304
|
+
// ✅ 공유 상태 명시
|
|
305
|
+
Task(subagent_type="implementation-executor",
|
|
306
|
+
prompt=`모듈 A 구현
|
|
307
|
+
|
|
308
|
+
공유 상태:
|
|
309
|
+
- 프로젝트 구조: [설명]
|
|
310
|
+
- 공통 인터페이스: [설명]
|
|
311
|
+
- 의존성: [리스트]`)
|
|
312
|
+
|
|
313
|
+
Task(subagent_type="implementation-executor",
|
|
314
|
+
prompt=`모듈 B 구현 (모듈 A와 통합)
|
|
315
|
+
|
|
316
|
+
공유 상태:
|
|
317
|
+
- 프로젝트 구조: [설명]
|
|
318
|
+
- 공통 인터페이스: [설명]
|
|
319
|
+
- 모듈 A 위치: [경로]`)
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
#### 2. 문서 기반 컨텍스트
|
|
323
|
+
|
|
324
|
+
**활용:** 상태 문서 파일로 컨텍스트 공유.
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
// Step 1: 상태 문서 생성
|
|
328
|
+
Write(".claude/context/project-state.md", `
|
|
329
|
+
# Project State
|
|
330
|
+
|
|
331
|
+
## Architecture
|
|
332
|
+
- Auth: JWT 기반
|
|
333
|
+
- Database: Prisma + PostgreSQL
|
|
334
|
+
- API: TanStack Start Server Functions
|
|
335
|
+
|
|
336
|
+
## Modules
|
|
337
|
+
- User: 완료
|
|
338
|
+
- Auth: 진행 중
|
|
339
|
+
- Post: 대기
|
|
340
|
+
`)
|
|
341
|
+
|
|
342
|
+
// Step 2: 병렬 실행 시 문서 참조
|
|
343
|
+
Task(subagent_type="implementation-executor",
|
|
344
|
+
prompt="@.claude/context/project-state.md 참조하여 Post 모듈 구현")
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
#### 3. 핸드오프 (Handoffs)
|
|
348
|
+
|
|
349
|
+
**정의:** 에이전트 간 명시적 정보 전달.
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
// Agent A → Agent B 핸드오프
|
|
353
|
+
const resultA = Task(subagent_type="explore", model="haiku",
|
|
354
|
+
prompt="인증 로직 위치 찾기")
|
|
355
|
+
|
|
356
|
+
// 결과 명시적 전달
|
|
357
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
358
|
+
prompt=`인증 로직 수정
|
|
359
|
+
|
|
360
|
+
이전 에이전트 결과:
|
|
361
|
+
${resultA}
|
|
362
|
+
|
|
363
|
+
수정 내용: [...]`)
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
#### 4. 컨텍스트 컴팩션 (Context Compaction)
|
|
367
|
+
|
|
368
|
+
**문제:** 토큰 한계 도달 시 이전 작업 손실.
|
|
369
|
+
|
|
370
|
+
**해결책:**
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
// 주기적 요약 및 저장
|
|
374
|
+
Task(subagent_type="document-writer", model="haiku",
|
|
375
|
+
prompt=`현재까지 작업 요약하여 .claude/context/summary.md에 저장
|
|
376
|
+
|
|
377
|
+
포함 내용:
|
|
378
|
+
- 완료된 작업
|
|
379
|
+
- 중요 의사결정
|
|
380
|
+
- 다음 단계`)
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**컨텍스트 복구:**
|
|
384
|
+
|
|
385
|
+
```text
|
|
386
|
+
1. pwd → 작업 디렉토리 확인
|
|
387
|
+
2. Read(".claude/context/summary.md") → 진행 상태 파악
|
|
388
|
+
3. git log --oneline -10 → 최근 작업 확인
|
|
389
|
+
4. 중단 지점부터 재개
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
</context_preservation>
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
<error_handling>
|
|
397
|
+
|
|
398
|
+
## 에러 처리 및 복구
|
|
399
|
+
|
|
400
|
+
### 전략
|
|
401
|
+
|
|
402
|
+
| 전략 | 설명 | 구현 |
|
|
403
|
+
|------|------|------|
|
|
404
|
+
| **Failure Isolation** | 실패 도메인 격리 | 에이전트별 독립 실행 |
|
|
405
|
+
| **Retry Strategy** | 제한적 재시도 | 3회 재시도 + 에스컬레이션 |
|
|
406
|
+
| **Circuit Breaker** | 반복 실패 시 중단 | 3회 실패 시 대안 에이전트 |
|
|
407
|
+
| **Redundancy** | 중요 작업 중복 실행 | 동일 작업 여러 에이전트 |
|
|
408
|
+
| **Graceful Degradation** | 부분 실패 허용 | 핵심 작업 우선 완료 |
|
|
409
|
+
|
|
410
|
+
### 패턴 1: 실패 격리
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
// ✅ 에이전트별 격리
|
|
414
|
+
try {
|
|
415
|
+
Task(subagent_type="implementation-executor",
|
|
416
|
+
prompt="기능 A 구현")
|
|
417
|
+
} catch (error) {
|
|
418
|
+
// 기능 A 실패해도 B는 계속
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
Task(subagent_type="implementation-executor",
|
|
422
|
+
prompt="기능 B 구현")
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### 패턴 2: 재시도 전략
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
// ❌ 무한 재시도
|
|
429
|
+
while (true) {
|
|
430
|
+
Task(...) // 위험
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ✅ 제한적 재시도
|
|
434
|
+
const maxRetries = 3
|
|
435
|
+
let attempt = 0
|
|
436
|
+
|
|
437
|
+
while (attempt < maxRetries) {
|
|
438
|
+
try {
|
|
439
|
+
Task(subagent_type="implementation-executor", ...)
|
|
440
|
+
break // 성공 시 탈출
|
|
441
|
+
} catch (error) {
|
|
442
|
+
attempt++
|
|
443
|
+
if (attempt >= maxRetries) {
|
|
444
|
+
// 에스컬레이션: 더 강력한 모델 사용
|
|
445
|
+
Task(subagent_type="planner", model="opus",
|
|
446
|
+
prompt="문제 분석 및 대안 제시")
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### 패턴 3: 서킷 브레이커
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
// 에이전트 상태 추적
|
|
456
|
+
const agentFailures = new Map()
|
|
457
|
+
|
|
458
|
+
function executeWithCircuitBreaker(agentType, prompt) {
|
|
459
|
+
const failures = agentFailures.get(agentType) || 0
|
|
460
|
+
|
|
461
|
+
// 3회 이상 실패 시 차단
|
|
462
|
+
if (failures >= 3) {
|
|
463
|
+
console.log(`Circuit breaker: ${agentType} 차단됨`)
|
|
464
|
+
// 대안 에이전트 사용
|
|
465
|
+
return Task(subagent_type="alternative-agent", ...)
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
try {
|
|
469
|
+
const result = Task(subagent_type=agentType, prompt=prompt)
|
|
470
|
+
agentFailures.set(agentType, 0) // 성공 시 리셋
|
|
471
|
+
return result
|
|
472
|
+
} catch (error) {
|
|
473
|
+
agentFailures.set(agentType, failures + 1)
|
|
474
|
+
throw error
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### 패턴 4: 모니터링
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
// 작업 상태 추적
|
|
483
|
+
TaskList() // pending/in_progress 작업 확인
|
|
484
|
+
|
|
485
|
+
// 실패 기록
|
|
486
|
+
Write(".claude/logs/failures.md", `
|
|
487
|
+
## Failure Log
|
|
488
|
+
|
|
489
|
+
- Time: ${timestamp}
|
|
490
|
+
- Agent: ${agentType}
|
|
491
|
+
- Task: ${taskDescription}
|
|
492
|
+
- Error: ${errorMessage}
|
|
493
|
+
- Retry: ${retryCount}
|
|
494
|
+
`)
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
</error_handling>
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
<examples>
|
|
502
|
+
|
|
503
|
+
## 실전 예제
|
|
504
|
+
|
|
505
|
+
### 예제 1: 풀스택 기능 구현
|
|
506
|
+
|
|
507
|
+
```typescript
|
|
508
|
+
// 목표: User Profile 기능 구현 (API + UI + 테스트)
|
|
509
|
+
|
|
510
|
+
// ✅ 병렬 실행
|
|
511
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
512
|
+
prompt=`User Profile API 구현
|
|
513
|
+
|
|
514
|
+
- GET /profile: 프로필 조회
|
|
515
|
+
- PUT /profile: 프로필 수정
|
|
516
|
+
- 인증 필수
|
|
517
|
+
- Prisma User 모델 사용`)
|
|
518
|
+
|
|
519
|
+
Task(subagent_type="designer", model="sonnet",
|
|
520
|
+
prompt=`User Profile UI 구현
|
|
521
|
+
|
|
522
|
+
- 프로필 조회 화면
|
|
523
|
+
- 수정 폼
|
|
524
|
+
- TanStack Query 사용
|
|
525
|
+
- Tailwind 스타일`)
|
|
526
|
+
|
|
527
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
528
|
+
prompt=`User Profile 통합 테스트 작성
|
|
529
|
+
|
|
530
|
+
- API 테스트
|
|
531
|
+
- UI 테스트
|
|
532
|
+
- E2E 시나리오`)
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
**예상 시간:**
|
|
536
|
+
- 순차 실행: 180초 (60 + 60 + 60)
|
|
537
|
+
- 병렬 실행: 60초 (가장 긴 작업)
|
|
538
|
+
- 개선: 3배 향상
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
### 예제 2: 대규모 리팩토링
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
// 목표: 10개 파일 동일 패턴으로 리팩토링
|
|
546
|
+
|
|
547
|
+
// ❌ 순차 실행 (비효율)
|
|
548
|
+
Edit("file1.ts", ...)
|
|
549
|
+
Edit("file2.ts", ...)
|
|
550
|
+
// ... (10번 반복)
|
|
551
|
+
|
|
552
|
+
// ✅ 배치 처리 (효율)
|
|
553
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
554
|
+
prompt=`다음 파일들 리팩토링:
|
|
555
|
+
|
|
556
|
+
파일 목록:
|
|
557
|
+
- file1.ts ~ file10.ts
|
|
558
|
+
|
|
559
|
+
공통 규칙:
|
|
560
|
+
1. const 함수 → arrow function
|
|
561
|
+
2. any → unknown
|
|
562
|
+
3. 명시적 return type 추가
|
|
563
|
+
|
|
564
|
+
패턴:
|
|
565
|
+
❌ function fn() { ... }
|
|
566
|
+
✅ const fn = (): ReturnType => { ... }`)
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**예상 효과:**
|
|
570
|
+
- 토큰 사용: 70-90% 절감
|
|
571
|
+
- 실행 시간: 단축
|
|
572
|
+
- 일관성: 향상
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
### 예제 3: 멀티 스테이지 파이프라인
|
|
577
|
+
|
|
578
|
+
```typescript
|
|
579
|
+
// Phase 1: 탐색 (병렬)
|
|
580
|
+
Task(subagent_type="explore", model="haiku",
|
|
581
|
+
prompt="프로젝트 구조 분석")
|
|
582
|
+
Task(subagent_type="explore", model="haiku",
|
|
583
|
+
prompt="기존 인증 로직 위치")
|
|
584
|
+
Task(subagent_type="explore", model="haiku",
|
|
585
|
+
prompt="테스트 구조 파악")
|
|
586
|
+
|
|
587
|
+
// Phase 2: 구현 (병렬)
|
|
588
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
589
|
+
prompt="새 인증 로직 구현")
|
|
590
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
591
|
+
prompt="미들웨어 구현")
|
|
592
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
593
|
+
prompt="테스트 작성")
|
|
594
|
+
|
|
595
|
+
// Phase 3: 검증 (순차)
|
|
596
|
+
Task(subagent_type="deployment-validator", model="sonnet",
|
|
597
|
+
prompt="typecheck/lint/build 전체 검증")
|
|
598
|
+
|
|
599
|
+
// Phase 4: 리뷰 (병렬)
|
|
600
|
+
Task(subagent_type="code-reviewer", model="opus",
|
|
601
|
+
prompt="보안 검토")
|
|
602
|
+
Task(subagent_type="code-reviewer", model="opus",
|
|
603
|
+
prompt="성능 검토")
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
**구조:**
|
|
607
|
+
1. Phase 1, 2, 4: 병렬 실행 (독립 작업)
|
|
608
|
+
2. Phase 3: 순차 실행 (의존성)
|
|
609
|
+
3. 모델 최적화 (haiku → sonnet → opus)
|
|
610
|
+
|
|
611
|
+
</examples>
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
<best_practices>
|
|
616
|
+
|
|
617
|
+
## 모범 사례
|
|
618
|
+
|
|
619
|
+
### 실행 전 체크
|
|
620
|
+
|
|
621
|
+
```text
|
|
622
|
+
1. 작업 분석
|
|
623
|
+
- 독립적인가? → 병렬
|
|
624
|
+
- 의존적인가? → 순차
|
|
625
|
+
- 유사한가? → 배치
|
|
626
|
+
|
|
627
|
+
2. 모델 선택
|
|
628
|
+
- 간단 → haiku
|
|
629
|
+
- 일반 → sonnet
|
|
630
|
+
- 복잡 → opus
|
|
631
|
+
|
|
632
|
+
3. 컨텍스트 계획
|
|
633
|
+
- 공유 상태 필요? → 문서화
|
|
634
|
+
- 컨텍스트 한계? → 컴팩션
|
|
635
|
+
|
|
636
|
+
4. 에러 처리
|
|
637
|
+
- 재시도 전략
|
|
638
|
+
- 대안 계획
|
|
639
|
+
- 모니터링
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### 작업 분해 원칙
|
|
643
|
+
|
|
644
|
+
| 원칙 | 설명 | 예시 |
|
|
645
|
+
|------|------|------|
|
|
646
|
+
| **Single Responsibility** | 에이전트당 하나의 책임 | explore, implement, review 분리 |
|
|
647
|
+
| **Loose Coupling** | 에이전트 간 최소 의존성 | 공유 상태만 문서로 전달 |
|
|
648
|
+
| **High Cohesion** | 관련 작업 그룹화 | UI 관련 작업 → designer |
|
|
649
|
+
|
|
650
|
+
### 효율적인 프롬프트
|
|
651
|
+
|
|
652
|
+
```typescript
|
|
653
|
+
// ❌ 모호한 지시
|
|
654
|
+
Task(subagent_type="implementation-executor",
|
|
655
|
+
prompt="뭔가 구현해줘")
|
|
656
|
+
|
|
657
|
+
// ✅ 명확한 지시
|
|
658
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
659
|
+
prompt=`User API 엔드포인트 구현
|
|
660
|
+
|
|
661
|
+
요구사항:
|
|
662
|
+
- GET /users: 사용자 목록
|
|
663
|
+
- POST /users: 사용자 생성
|
|
664
|
+
- 인증: JWT 미들웨어
|
|
665
|
+
- 검증: Zod 스키마
|
|
666
|
+
|
|
667
|
+
기존 패턴:
|
|
668
|
+
@functions/auth.ts 참조
|
|
669
|
+
|
|
670
|
+
예상 결과:
|
|
671
|
+
- functions/users.ts
|
|
672
|
+
- 테스트 포함`)
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
### 성능 최적화 체크리스트
|
|
676
|
+
|
|
677
|
+
- [ ] 독립 작업 → 병렬 실행
|
|
678
|
+
- [ ] 10개 이상 유사 작업 → 배치 처리
|
|
679
|
+
- [ ] 10분 이상 작업 → 백그라운드 실행
|
|
680
|
+
- [ ] 복잡도별 모델 선택 (haiku/sonnet/opus)
|
|
681
|
+
- [ ] 컨텍스트 크기 모니터링 → 컴팩션
|
|
682
|
+
- [ ] 실패 시 재시도 제한 (3회)
|
|
683
|
+
- [ ] 상태 문서화 (컨텍스트 복구)
|
|
684
|
+
|
|
685
|
+
### 안티패턴
|
|
686
|
+
|
|
687
|
+
| 안티패턴 | 문제 | 올바른 방법 |
|
|
688
|
+
|---------|------|------------|
|
|
689
|
+
| **순차 실행** | 불필요한 대기 | 병렬 실행 |
|
|
690
|
+
| **과도한 병렬** | 컨텍스트 혼란 | 3-10개 제한 |
|
|
691
|
+
| **모델 미스매치** | 비용 낭비 | 복잡도별 선택 |
|
|
692
|
+
| **컨텍스트 미보존** | 작업 손실 | 상태 문서화 |
|
|
693
|
+
| **무한 재시도** | 리소스 낭비 | 3회 제한 |
|
|
694
|
+
|
|
695
|
+
</best_practices>
|
|
696
|
+
|
|
697
|
+
---
|
|
698
|
+
|
|
699
|
+
<summary>
|
|
700
|
+
|
|
701
|
+
## 핵심 요약
|
|
702
|
+
|
|
703
|
+
| 개념 | 핵심 포인트 |
|
|
704
|
+
|------|----------|
|
|
705
|
+
| **병렬 실행** | 단일 메시지에서 여러 Tool 호출 → 5-15배 향상 |
|
|
706
|
+
| **배치 처리** | 유사 작업 묶음 → 토큰 70-90% 절감 |
|
|
707
|
+
| **모델 라우팅** | haiku (간단), sonnet (일반), opus (복잡) |
|
|
708
|
+
| **에이전트 위임** | 전문 에이전트 즉시 위임 → 품질 향상 |
|
|
709
|
+
| **컨텍스트 보존** | 상태 문서화 + 핸드오프 |
|
|
710
|
+
| **에러 처리** | 격리 + 재시도 (3회) + 서킷 브레이커 |
|
|
711
|
+
| **성능 목표** | 대기 시간 80% 감소, 병렬도 3-10개 |
|
|
712
|
+
|
|
713
|
+
**시작하기:**
|
|
714
|
+
1. 작업 분석 → 독립/의존/유사 구분
|
|
715
|
+
2. 패턴 선택 → 병렬/순차/배치
|
|
716
|
+
3. 모델 선택 → 복잡도 기반
|
|
717
|
+
4. 실행 → 단일 메시지 다중 Tool
|
|
718
|
+
5. 모니터링 → TaskList, 로그
|
|
719
|
+
|
|
720
|
+
</summary>
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
<references>
|
|
725
|
+
|
|
726
|
+
## 참고 자료
|
|
727
|
+
|
|
728
|
+
**관련 문서:**
|
|
729
|
+
- `.claude/instructions/parallel-agent-execution.md` - 병렬 실행 상세 가이드
|
|
730
|
+
- `.claude/agents/*.md` - 개별 에이전트 스펙
|
|
731
|
+
|
|
732
|
+
**외부 자료:**
|
|
733
|
+
- [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
|
|
734
|
+
- [Multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system)
|
|
735
|
+
- [Multi-Agent Design Patterns (Azure)](https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/ai-agent-design-patterns)
|
|
736
|
+
|
|
737
|
+
</references>
|