@kood/claude-code 0.6.0 → 0.6.2

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.
Files changed (32) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/.claude/instructions/agent-patterns/delegation-patterns.md +389 -0
  4. package/templates/.claude/instructions/context-optimization/phase-based-execution.md +410 -0
  5. package/templates/.claude/instructions/context-optimization/redundant-exploration-prevention.md +646 -0
  6. package/templates/.claude/instructions/context-optimization/sub-agent-distribution.md +476 -0
  7. package/templates/.claude/instructions/glossary.md +48 -0
  8. package/templates/.claude/instructions/project-context-template.md +453 -0
  9. package/templates/.claude/instructions/skill-integration.md +90 -0
  10. package/templates/.claude/instructions/sourcing/reliable-search.md +411 -0
  11. package/templates/.claude/instructions/validation/forbidden-patterns.md +47 -0
  12. package/templates/.claude/instructions/validation/required-behaviors.md +120 -0
  13. package/templates/.claude/instructions/validation/scope-completeness.md +367 -0
  14. package/templates/.claude/instructions/workflow-patterns/todowrite-pattern.md +2 -0
  15. package/templates/.claude/skills/brainstorm/SKILL.md +110 -644
  16. package/templates/.claude/skills/bug-fix/SKILL.md +9 -137
  17. package/templates/.claude/skills/docs-fetch/CLAUDE.md +3 -0
  18. package/templates/.claude/skills/docs-fetch/SKILL.md +458 -0
  19. package/templates/.claude/skills/elon-musk/CLAUDE.md +3 -0
  20. package/templates/.claude/skills/elon-musk/SKILL.md +367 -0
  21. package/templates/.claude/skills/execute/SKILL.md +18 -397
  22. package/templates/.claude/skills/plan/SKILL.md +12 -986
  23. package/templates/.claude/skills/prd/SKILL.md +225 -586
  24. package/templates/.claude/skills/prd/references/ai-native-prd.md +116 -0
  25. package/templates/.claude/skills/prd/references/anti-patterns.md +82 -0
  26. package/templates/.claude/skills/prd/references/frameworks.md +216 -0
  27. package/templates/.claude/skills/prd/references/pm-leaders.md +106 -0
  28. package/templates/.claude/skills/prd/references/trends-2026.md +157 -0
  29. package/templates/.claude/skills/ralph/SKILL.md +15 -497
  30. package/templates/.claude/skills/refactor/SKILL.md +11 -655
  31. package/templates/.claude/skills/research/SKILL.md +257 -0
  32. package/templates/.claude/skills/research/report-template.md +88 -0
@@ -7,6 +7,9 @@ user-invocable: true
7
7
  @../../instructions/workflow-patterns/sequential-thinking.md
8
8
  @../../instructions/agent-patterns/parallel-execution.md
9
9
  @../../instructions/agent-patterns/model-routing.md
10
+ @../../instructions/context-optimization/phase-based-execution.md
11
+ @../../instructions/context-optimization/sub-agent-distribution.md
12
+ @../../instructions/validation/scope-completeness.md
10
13
  @../../instructions/validation/forbidden-patterns.md
11
14
  @../../instructions/validation/required-behaviors.md
12
15
 
@@ -146,664 +149,17 @@ $ARGUMENTS 있음 → 다음 단계 진행
146
149
 
147
150
  <parallel_agent_execution>
148
151
 
149
- ## 병렬 Agent 실행
152
+ ## 병렬 에이전트 실행
150
153
 
151
- **복잡한 리팩토링은 여러 Agent를 병렬로 실행하여 효율 향상.**
152
-
153
- ### 권장 Agent
154
-
155
- | Agent | Model | 역할 |
156
- |-------|-------|------|
157
- | **@refactor-advisor** | sonnet | 리팩토링 계획 수립, 우선순위 분석 |
158
- | **@architect** | opus | 아키텍처 분석, 구조 개선 방향 제시 (READ-ONLY) |
159
- | **@implementation-executor** | sonnet | 리팩토링 구현 실행 |
160
- | **@code-reviewer** | opus | 리팩토링 후 품질 검증 |
161
- | **@analyst** | sonnet | 코드 메트릭 분석, 엣지 케이스 검증 |
162
- | **@explore** | haiku | 코드베이스 탐색, 의존성 파악 |
163
- | **@document-writer** | haiku/sonnet | 리팩토링 계획 및 결과 문서화 |
164
- | **@security-reviewer** | opus | 리팩토링 후 보안 취약점 검증 |
165
- | **@build-fixer** | sonnet | 리팩토링 후 빌드/타입 오류 수정 |
166
-
167
- ### 병렬 실행 패턴
168
-
169
- ### Read 도구 병렬화
170
-
171
- **프로젝트 분석 시 파일 병렬 읽기:**
172
-
173
- ```typescript
174
- // ❌ 순차 읽기 (느림)
175
- Read({ file_path: "src/file1.ts" })
176
- // 대기...
177
- Read({ file_path: "src/file2.ts" })
178
-
179
- // ✅ 병렬 읽기 (빠름)
180
- Read({ file_path: "src/file1.ts" })
181
- Read({ file_path: "src/file2.ts" })
182
- Read({ file_path: "src/file3.ts" })
183
- Read({ file_path: "docs/api.md" })
184
- ```
185
-
186
- **복잡한 탐색은 explore 에이전트 활용:**
187
-
188
- ```typescript
189
- // 여러 영역 동시 탐색
190
- Task(subagent_type="explore", model="haiku",
191
- prompt="영역 1 파일 구조 및 패턴 분석")
192
- Task(subagent_type="explore", model="haiku",
193
- prompt="영역 2 의존성 및 관계 분석")
194
- ```
195
-
196
- ---
197
-
198
- #### 1. 독립적 모듈 병렬 리팩토링
199
-
200
- ```typescript
201
- // ✅ 여러 모듈을 동시에 리팩토링
202
- Task({
203
- subagent_type: "implementation-executor",
204
- model: "sonnet",
205
- prompt: "User 모듈 리팩토링: 복잡도 감소, 중복 제거"
206
- })
207
-
208
- Task({
209
- subagent_type: "implementation-executor",
210
- model: "sonnet",
211
- prompt: "Product 모듈 리팩토링: 타입 안정성 개선"
212
- })
213
-
214
- Task({
215
- subagent_type: "implementation-executor",
216
- model: "sonnet",
217
- prompt: "Order 모듈 리팩토링: 함수 분리"
218
- })
219
- ```
220
-
221
- #### 2. 분석 + 계획 병렬
222
-
223
- ```typescript
224
- // ✅ 아키텍처 분석과 리팩토링 계획을 동시에
225
- Task({
226
- subagent_type: "architect",
227
- model: "opus",
228
- prompt: "현재 아키텍처 문제점 및 개선 방향 분석 (READ-ONLY)"
229
- })
230
-
231
- Task({
232
- subagent_type: "refactor-advisor",
233
- model: "sonnet",
234
- prompt: "리팩토링 우선순위 계획 및 단계별 전략"
235
- })
236
-
237
- Task({
238
- subagent_type: "analyst",
239
- model: "sonnet",
240
- prompt: "코드 복잡도, 중복률, 결합도 메트릭 분석"
241
- })
242
- ```
243
-
244
- #### 3. 의존성 분석 + 수정 병렬
245
-
246
- ```typescript
247
- // ✅ 의존성 파악과 독립 모듈 리팩토링 동시 진행
248
- Task({
249
- subagent_type: "explore",
250
- model: "haiku",
251
- prompt: "모듈 간 의존성 그래프 분석 및 순환 의존성 탐지"
252
- })
253
-
254
- Task({
255
- subagent_type: "implementation-executor",
256
- model: "sonnet",
257
- prompt: "독립 유틸리티 함수 리팩토링 (의존성 없음)"
258
- })
259
-
260
- Task({
261
- subagent_type: "implementation-executor",
262
- model: "sonnet",
263
- prompt: "타입 정의 개선 (다른 모듈에 영향 없음)"
264
- })
265
- ```
266
-
267
- #### 4. 리팩토링 + 테스트 + 문서 병렬
268
-
269
- ```typescript
270
- // ✅ 구현, 테스트, 문서를 동시에
271
- Task({
272
- subagent_type: "implementation-executor",
273
- model: "sonnet",
274
- prompt: "API 레이어 리팩토링 실행"
275
- })
276
-
277
- Task({
278
- subagent_type: "implementation-executor",
279
- model: "sonnet",
280
- prompt: "리팩토링된 함수에 대한 단위 테스트 작성"
281
- })
282
-
283
- Task({
284
- subagent_type: "document-writer",
285
- model: "haiku",
286
- prompt: "리팩토링 변경 사항 및 마이그레이션 가이드 문서화"
287
- })
288
- ```
289
-
290
- #### 5. 다중 관점 코드 리뷰 (병렬)
291
-
292
- ```typescript
293
- // ✅ 리팩토링 후 여러 관점에서 동시 검증
294
- Task({
295
- subagent_type: "code-reviewer",
296
- model: "opus",
297
- prompt: "성능 검토: 불필요한 리렌더, N+1 쿼리, 메모이제이션"
298
- })
299
-
300
- Task({
301
- subagent_type: "code-reviewer",
302
- model: "opus",
303
- prompt: "보안 검토: 타입 안정성, 입력 검증, 인증/인가 로직"
304
- })
305
-
306
- Task({
307
- subagent_type: "code-reviewer",
308
- model: "opus",
309
- prompt: "가독성 검토: 명명 규칙, 함수 길이, 주석 품질"
310
- })
311
-
312
- Task({
313
- subagent_type: "code-reviewer",
314
- model: "opus",
315
- prompt: "유지보수성 검토: 테스트 커버리지, 의존성 관리, 확장성"
316
- })
317
- ```
318
-
319
- #### 5-1. 리팩토링 후 보안 + 빌드 검증 병렬
320
-
321
- ```typescript
322
- // ✅ 리팩토링 후 보안 + 빌드 검증 병렬
323
- Task({
324
- subagent_type: "security-reviewer",
325
- model: "opus",
326
- prompt: "리팩토링 후 보안 취약점 검토"
327
- })
328
-
329
- Task({
330
- subagent_type: "build-fixer",
331
- model: "sonnet",
332
- prompt: "리팩토링으로 발생한 빌드/타입 오류 수정"
333
- })
334
- ```
335
-
336
- #### 6. 점진적 마이그레이션 병렬화
337
-
338
- ```typescript
339
- // ✅ 레거시 + 신규 시스템 공존 리팩토링
340
- Task({
341
- subagent_type: "implementation-executor",
342
- model: "sonnet",
343
- prompt: "새 인증 시스템 구현 (기존과 독립)"
344
- })
345
-
346
- Task({
347
- subagent_type: "implementation-executor",
348
- model: "sonnet",
349
- prompt: "레거시 API 어댑터 구현 (호환성 유지)"
350
- })
351
-
352
- Task({
353
- subagent_type: "implementation-executor",
354
- model: "haiku",
355
- prompt: "Feature flag 설정 및 점진적 전환 로직"
356
- })
357
-
358
- Task({
359
- subagent_type: "document-writer",
360
- model: "sonnet",
361
- prompt: "마이그레이션 플랜 및 롤백 가이드 작성"
362
- })
363
- ```
364
-
365
- ### Model Routing (복잡도별)
366
-
367
- | 복잡도 | 리팩토링 유형 | Model | Agent | 예시 |
368
- |--------|--------------|-------|-------|------|
369
- | **LOW** | 단순 개선 | haiku | implementation-executor | 변수명 변경, 코드 포맷팅, 주석 정리 |
370
- | **MEDIUM** | 일반 리팩토링 | sonnet | implementation-executor, refactor-advisor | 함수 분리, 중복 제거, 타입 개선 |
371
- | **HIGH** | 복잡한 구조 변경 | opus | architect, code-reviewer | 아키텍처 재설계, 모듈 분리, 디자인 패턴 적용 |
372
-
373
- **Agent별 모델 선택 원칙:**
374
-
375
- | Agent | 권장 모델 | 이유 |
376
- |-------|----------|------|
377
- | **architect** | **opus** | 아키텍처 분석은 높은 사고력 필요 |
378
- | **implementation-executor** | **sonnet** | 균형 잡힌 품질/속도 (haiku: 단순 작업) |
379
- | **code-reviewer** | **opus** | 품질 검증은 세밀한 분석 필요 |
380
- | **refactor-advisor** | **sonnet** | 계획 수립은 중간 복잡도 |
381
- | **explore** | **haiku** | 단순 탐색은 빠른 응답 우선 |
382
- | **analyst** | **sonnet** | 메트릭 분석은 중간 복잡도 |
383
- | **document-writer** | **haiku/sonnet** | 간단한 문서는 haiku, 상세 문서는 sonnet |
384
-
385
- ### 병렬 실행 전략
386
-
387
- #### 언제 병렬 실행하는가
388
-
389
- | 조건 | 병렬 실행 | 순차 실행 |
390
- |------|----------|----------|
391
- | **독립성** | ✅ 서로 다른 파일/모듈 | ❌ 같은 파일 수정 |
392
- | **의존성** | ✅ 의존성 없음 | ❌ 순차 의존성 있음 |
393
- | **작업 유형** | ✅ 읽기 전용 (분석/탐색) | ❌ 결과가 다음 입력 |
394
- | **컨텍스트** | ✅ 독립 컨텍스트 | ❌ 공유 컨텍스트 필요 |
395
-
396
- #### 병렬 실행 체크리스트
397
-
398
- 실행 전 확인:
399
-
400
- ```text
401
- - [ ] 이 작업들은 독립적인가? (서로 다른 파일/모듈)
402
- - [ ] 순차 의존성이 없는가? (A 결과 → B 입력 아님)
403
- - [ ] 같은 파일을 동시에 수정하지 않는가?
404
- - [ ] 컨텍스트 분리가 가능한가? (각 에이전트가 독립적으로 작업)
405
- - [ ] 적절한 모델을 선택했는가? (복잡도에 맞게)
406
- ```
407
-
408
- **모든 항목 ✅ → 병렬 실행 / 하나라도 ❌ → 순차 실행**
409
-
410
- ### 실전 시나리오
411
-
412
- #### 시나리오 1: 레거시 → 최신 프레임워크 전환
413
-
414
- **배경:** 레거시 React 클래스 컴포넌트를 TanStack Start로 전환
415
-
416
- ```typescript
417
- // 1단계: 분석 (병렬)
418
- Task({
419
- subagent_type: "architect",
420
- model: "opus",
421
- prompt: "레거시 아키텍처 분석 및 TanStack Start 전환 전략"
422
- })
423
-
424
- Task({
425
- subagent_type: "explore",
426
- model: "haiku",
427
- prompt: "레거시 컴포넌트 목록 및 의존성 파악"
428
- })
429
-
430
- Task({
431
- subagent_type: "analyst",
432
- model: "sonnet",
433
- prompt: "전환 리스크 분석: 상태 관리, 라우팅, 데이터 페칭 차이점"
434
- })
435
-
436
- // 2단계: 점진적 전환 (병렬 - 독립 컴포넌트)
437
- Task({
438
- subagent_type: "implementation-executor",
439
- model: "sonnet",
440
- prompt: "Profile 페이지 전환: createFileRoute + Server Functions"
441
- })
442
-
443
- Task({
444
- subagent_type: "implementation-executor",
445
- model: "sonnet",
446
- prompt: "Settings 페이지 전환: createFileRoute + Server Functions"
447
- })
448
-
449
- Task({
450
- subagent_type: "implementation-executor",
451
- model: "sonnet",
452
- prompt: "Dashboard 페이지 전환: createFileRoute + Server Functions"
453
- })
454
-
455
- // 3단계: 검증 + 문서 (병렬)
456
- Task({
457
- subagent_type: "code-reviewer",
458
- model: "opus",
459
- prompt: "전환된 코드 품질 검증: 라우팅, 상태, 데이터 페칭"
460
- })
461
-
462
- Task({
463
- subagent_type: "document-writer",
464
- model: "sonnet",
465
- prompt: "마이그레이션 가이드 작성: 패턴 비교, 주의사항, 롤백 절차"
466
- })
467
- ```
468
-
469
- #### 시나리오 2: 아키텍처 개선 (모놀리식 → 레이어드)
470
-
471
- **배경:** 모든 로직이 혼재된 파일을 레이어드 아키텍처로 분리
472
-
473
- ```typescript
474
- // 1단계: 현재 상태 분석 (병렬)
475
- Task({
476
- subagent_type: "architect",
477
- model: "opus",
478
- prompt: "현재 아키텍처 문제점 분석: 순환 의존성, 결합도, 테스트 어려움"
479
- })
480
-
481
- Task({
482
- subagent_type: "explore",
483
- model: "haiku",
484
- prompt: "모듈 간 의존성 그래프 생성 및 순환 의존성 식별"
485
- })
486
-
487
- Task({
488
- subagent_type: "analyst",
489
- model: "sonnet",
490
- prompt: "복잡도 메트릭 분석: 파일 크기, 함수 길이, 중첩 깊이"
491
- })
492
-
493
- // 2단계: 레이어 분리 계획
494
- Task({
495
- subagent_type: "refactor-advisor",
496
- model: "sonnet",
497
- prompt: "레이어드 아키텍처 전환 계획: Presentation → Service → Domain → Data"
498
- })
499
-
500
- // 3단계: 레이어별 구현 (순차적 - 의존성 있음)
501
- // 먼저 Domain Layer (의존성 없음)
502
- Task({
503
- subagent_type: "implementation-executor",
504
- model: "sonnet",
505
- prompt: "Domain Layer 분리: 엔티티, Value Object, 비즈니스 로직"
506
- })
507
-
508
- // 이후 상위 레이어 (병렬 가능)
509
- Task({
510
- subagent_type: "implementation-executor",
511
- model: "sonnet",
512
- prompt: "Data Layer 구현: Repository, Prisma 연동"
513
- })
514
-
515
- Task({
516
- subagent_type: "implementation-executor",
517
- model: "sonnet",
518
- prompt: "Service Layer 구현: 비즈니스 로직 조율, 트랜잭션 관리"
519
- })
520
-
521
- Task({
522
- subagent_type: "implementation-executor",
523
- model: "sonnet",
524
- prompt: "Presentation Layer 구현: Server Functions, 입력 검증"
525
- })
526
-
527
- // 4단계: 다중 관점 검증 (병렬)
528
- Task({
529
- subagent_type: "code-reviewer",
530
- model: "opus",
531
- prompt: "아키텍처 검증: 레이어 분리 원칙 준수, 의존성 방향"
532
- })
533
-
534
- Task({
535
- subagent_type: "code-reviewer",
536
- model: "opus",
537
- prompt: "테스트 용이성 검증: 단위 테스트 가능성, Mock 필요성"
538
- })
539
- ```
540
-
541
- #### 시나리오 3: 성능 최적화 리팩토링
542
-
543
- **배경:** 느린 렌더링, N+1 쿼리 문제 해결
544
-
545
- ```typescript
546
- // 1단계: 성능 문제 분석 (병렬)
547
- Task({
548
- subagent_type: "analyst",
549
- model: "sonnet",
550
- prompt: "성능 병목 지점 분석: React Profiler 데이터, DB 쿼리 로그"
551
- })
552
-
553
- Task({
554
- subagent_type: "explore",
555
- model: "haiku",
556
- prompt: "불필요한 리렌더 발생 컴포넌트 탐색"
557
- })
558
-
559
- Task({
560
- subagent_type: "explore",
561
- model: "haiku",
562
- prompt: "N+1 쿼리 발생 지점 탐색 (Prisma 쿼리 분석)"
563
- })
564
-
565
- // 2단계: 최적화 실행 (병렬 - 독립 영역)
566
- Task({
567
- subagent_type: "implementation-executor",
568
- model: "sonnet",
569
- prompt: "React 최적화: useMemo, useCallback, React.memo 적용"
570
- })
571
-
572
- Task({
573
- subagent_type: "implementation-executor",
574
- model: "sonnet",
575
- prompt: "Prisma 쿼리 최적화: include 정리, select 최소화, 배치 쿼리"
576
- })
577
-
578
- Task({
579
- subagent_type: "implementation-executor",
580
- model: "sonnet",
581
- prompt: "TanStack Query 최적화: 캐싱 전략, staleTime/cacheTime 조정"
582
- })
583
-
584
- // 3단계: 성능 검증 (병렬)
585
- Task({
586
- subagent_type: "code-reviewer",
587
- model: "opus",
588
- prompt: "성능 개선 검증: 렌더 횟수, 쿼리 실행 시간, 번들 크기"
589
- })
590
-
591
- Task({
592
- subagent_type: "analyst",
593
- model: "sonnet",
594
- prompt: "Before/After 메트릭 비교: 응답 시간, 메모리 사용량"
595
- })
596
-
597
- Task({
598
- subagent_type: "document-writer",
599
- model: "haiku",
600
- prompt: "성능 최적화 가이드 작성: 적용 패턴, 측정 방법"
601
- })
602
- ```
603
-
604
- #### 시나리오 4: 타입 안정성 개선 (any 제거)
605
-
606
- **배경:** 프로젝트 전반에 any 타입 남용, 런타임 에러 빈발
607
-
608
- ```typescript
609
- // 1단계: any 사용 분석 (병렬)
610
- Task({
611
- subagent_type: "explore",
612
- model: "haiku",
613
- prompt: "any 타입 사용 지점 전수 조사 (ast-grep 활용)"
614
- })
615
-
616
- Task({
617
- subagent_type: "analyst",
618
- model: "sonnet",
619
- prompt: "any 사용 우선순위 분석: 영향 범위, 수정 난이도"
620
- })
621
-
622
- Task({
623
- subagent_type: "architect",
624
- model: "opus",
625
- prompt: "타입 설계 개선 방향: Generic, Utility Types, Type Guards"
626
- })
627
-
628
- // 2단계: 타입 정의 개선 (병렬 - 독립 모듈)
629
- Task({
630
- subagent_type: "implementation-executor",
631
- model: "sonnet",
632
- prompt: "API 응답 타입 정의: Zod 스키마 → TypeScript 타입"
633
- })
634
-
635
- Task({
636
- subagent_type: "implementation-executor",
637
- model: "sonnet",
638
- prompt: "이벤트 핸들러 타입 정의: React.MouseEvent, React.ChangeEvent"
639
- })
640
-
641
- Task({
642
- subagent_type: "implementation-executor",
643
- model: "sonnet",
644
- prompt: "유틸리티 함수 타입 정의: Generic, Overload"
645
- })
646
-
647
- // 3단계: 타입 안정성 검증 (병렬)
648
- Task({
649
- subagent_type: "code-reviewer",
650
- model: "opus",
651
- prompt: "타입 안정성 검토: unknown vs any, Type Guards 필요성"
652
- })
653
-
654
- Task({
655
- subagent_type: "code-reviewer",
656
- model: "opus",
657
- prompt: "타입 에러 검증: tsc --noEmit, 런타임 에러 가능성"
658
- })
659
- ```
660
-
661
- #### 시나리오 5: 코드 중복 제거 (DRY 원칙)
662
-
663
- **배경:** 여러 파일에 유사한 로직 반복, 유지보수 어려움
664
-
665
- ```typescript
666
- // 1단계: 중복 패턴 분석 (병렬)
667
- Task({
668
- subagent_type: "explore",
669
- model: "haiku",
670
- prompt: "중복 코드 패턴 탐색: 유사 함수, 중복 로직 (jscpd 등 활용)"
671
- })
672
-
673
- Task({
674
- subagent_type: "analyst",
675
- model: "sonnet",
676
- prompt: "중복률 분석 및 우선순위: 중복 라인 수, 파일 개수, 수정 빈도"
677
- })
678
-
679
- // 2단계: 공통 모듈 추출 계획
680
- Task({
681
- subagent_type: "refactor-advisor",
682
- model: "sonnet",
683
- prompt: "공통 모듈 추출 전략: 유틸리티 vs 훅 vs 컴포넌트"
684
- })
685
-
686
- // 3단계: 모듈 추출 및 교체 (병렬 - 독립 영역)
687
- Task({
688
- subagent_type: "implementation-executor",
689
- model: "sonnet",
690
- prompt: "공통 유틸리티 함수 추출: src/lib/utils/ 구성"
691
- })
692
-
693
- Task({
694
- subagent_type: "implementation-executor",
695
- model: "sonnet",
696
- prompt: "커스텀 훅 추출: src/hooks/ 구성"
697
- })
698
-
699
- Task({
700
- subagent_type: "implementation-executor",
701
- model: "sonnet",
702
- prompt: "공통 UI 컴포넌트 추출: src/components/ui/ 구성"
703
- })
704
-
705
- // 4단계: 기존 코드 교체 (병렬 - 독립 파일)
706
- Task({
707
- subagent_type: "implementation-executor",
708
- model: "haiku",
709
- prompt: "components/ 내 중복 코드 → 공통 모듈 참조로 교체"
710
- })
711
-
712
- Task({
713
- subagent_type: "implementation-executor",
714
- model: "haiku",
715
- prompt: "routes/ 내 중복 코드 → 공통 모듈 참조로 교체"
716
- })
717
-
718
- Task({
719
- subagent_type: "implementation-executor",
720
- model: "haiku",
721
- prompt: "functions/ 내 중복 코드 → 공통 모듈 참조로 교체"
722
- })
723
-
724
- // 5단계: 검증 (병렬)
725
- Task({
726
- subagent_type: "code-reviewer",
727
- model: "opus",
728
- prompt: "중복 제거 검증: 기존 기능 유지, 새로운 중복 발생 여부"
729
- })
730
-
731
- Task({
732
- subagent_type: "analyst",
733
- model: "sonnet",
734
- prompt: "Before/After 중복률 측정: 개선 효과 정량화"
735
- })
736
- ```
737
-
738
- ### 병렬 실행 시 주의사항
739
-
740
- ```text
741
- ✅ 권장:
742
- - 독립적인 모듈/파일 → 병렬 실행
743
- - 분석 작업 (읽기 전용) → 병렬 실행
744
- - 다중 관점 검증 → 병렬 실행
745
- - 테스트 + 문서 작성 → 병렬 실행
746
- - 레거시 + 신규 시스템 공존 → 병렬 실행
747
-
748
- ❌ 금지:
749
- - 같은 파일 동시 수정 (충돌 발생)
750
- - 순차 의존성 있는 작업 병렬화 (A → B → C)
751
- - 공유 상태/컨텍스트 필요한 작업
752
- - 결과가 다음 작업의 입력인 경우
753
- ```
754
-
755
- ### Model 선택 가이드
756
-
757
- ```typescript
758
- // ✅ 적절한 모델 선택
759
- Task({
760
- subagent_type: "implementation-executor",
761
- model: "haiku", // 단순 작업: 변수명 변경, 주석 정리
762
- prompt: "변수명을 camelCase로 통일"
763
- })
764
-
765
- Task({
766
- subagent_type: "refactor-advisor",
767
- model: "sonnet", // 일반 작업: 함수 분리 계획, 중복 제거
768
- prompt: "함수 복잡도 감소 계획 수립"
769
- })
770
-
771
- Task({
772
- subagent_type: "architect",
773
- model: "opus", // 복잡한 작업: 아키텍처 재설계
774
- prompt: "레이어드 아키텍처 전환 전략 분석"
775
- })
776
-
777
- Task({
778
- subagent_type: "code-reviewer",
779
- model: "opus", // 품질 검증: 세밀한 검토 필요
780
- prompt: "리팩토링 후 보안/성능/가독성 종합 검토"
781
- })
782
-
783
- // ❌ 잘못된 모델 선택
784
- Task({
785
- subagent_type: "architect",
786
- model: "haiku", // 복잡한 작업에 haiku 사용 금지
787
- prompt: "아키텍처 재설계..."
788
- })
789
-
790
- Task({
791
- subagent_type: "implementation-executor",
792
- model: "opus", // 단순 작업에 opus 낭비
793
- prompt: "변수명 변경..."
794
- })
795
- ```
154
+ @../../instructions/agent-patterns/delegation-patterns.md
155
+ @../../instructions/agent-patterns/parallel-execution.md
156
+ @../../instructions/agent-patterns/model-routing.md
796
157
 
797
- ### 병렬 실행 최적화
158
+ ### Refactor 스킬 고유 패턴
798
159
 
799
- | | 설명 | 예시 |
800
- |----|------|------|
801
- | **독립성 우선** | 의존성 없는 작업부터 병렬 실행 | 여러 모듈 동시 리팩토링 |
802
- | **읽기 병렬화** | 분석/탐색 작업은 항상 병렬 | architect + explore + analyst |
803
- | **쓰기 격리** | 파일 수정은 충돌 없도록 분리 | 각 모듈별로 다른 executor |
804
- | **검증 병렬화** | 다중 관점 코드 리뷰 동시 실행 | 성능/보안/가독성/유지보수성 |
805
- | **문서 병렬화** | 리팩토링과 문서 작성 동시 진행 | implementation + document-writer |
806
- | **모델 적정화** | 복잡도에 맞는 모델 선택 | haiku(단순) / sonnet(일반) / opus(복잡) |
160
+ - **코드 분석 병렬화**: refactor-advisor + architect 에이전트로 코드 구조 분석과 아키텍처 검토를 동시 실행
161
+ - **영향도 평가**: 여러 리팩토링 옵션에 대해 code-reviewer 에이전트로 각각 영향도를 병렬 평가
162
+ - **구현 + 검증 분리**: implementation-executor로 리팩토링 실행, deployment-validator로 동시에 기존 테스트 검증
807
163
 
808
164
  </parallel_agent_execution>
809
165