@kood/claude-code 0.6.6 → 0.7.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 +7 -1
- package/package.json +1 -1
- package/templates/.claude/agents/analyst.md +5 -0
- package/templates/.claude/agents/architect.md +5 -0
- package/templates/.claude/agents/build-fixer.md +1 -0
- package/templates/.claude/agents/code-reviewer.md +1 -0
- package/templates/.claude/agents/critic.md +4 -0
- package/templates/.claude/agents/deep-executor.md +1 -0
- package/templates/.claude/agents/dependency-manager.md +2 -0
- package/templates/.claude/agents/deployment-validator.md +2 -0
- package/templates/.claude/agents/designer.md +2 -0
- package/templates/.claude/agents/document-writer.md +3 -0
- package/templates/.claude/agents/explore.md +1 -0
- package/templates/.claude/agents/git-operator.md +2 -0
- package/templates/.claude/agents/implementation-executor.md +2 -0
- package/templates/.claude/agents/ko-to-en-translator.md +3 -0
- package/templates/.claude/agents/lint-fixer.md +2 -0
- package/templates/.claude/agents/planner.md +3 -0
- package/templates/.claude/agents/pm.md +349 -0
- package/templates/.claude/agents/qa-tester.md +1 -0
- package/templates/.claude/agents/refactor-advisor.md +4 -0
- package/templates/.claude/agents/researcher.md +9 -1
- package/templates/.claude/agents/scientist.md +1 -0
- package/templates/.claude/agents/security-reviewer.md +1 -0
- package/templates/.claude/agents/tdd-guide.md +1 -0
- package/templates/.claude/agents/vision.md +1 -0
- package/templates/.claude/instructions/agent-patterns/agent-teams-usage.md +376 -0
- package/templates/.claude/instructions/sourcing/reliable-search.md +49 -2
- package/templates/.claude/scripts/agent-teams/check-availability.sh +238 -0
- package/templates/.claude/scripts/agent-teams/setup-tmux.sh +125 -0
- package/templates/.claude/skills/agent-teams-setup/SKILL.md +460 -0
- package/templates/.claude/skills/brainstorm/SKILL.md +1 -0
- package/templates/.claude/skills/bug-fix/SKILL.md +1 -0
- package/templates/.claude/skills/crawler/SKILL.md +2 -0
- package/templates/.claude/skills/docs-creator/SKILL.md +1 -0
- package/templates/.claude/skills/docs-fetch/SKILL.md +6 -4
- package/templates/.claude/skills/docs-refactor/SKILL.md +1 -0
- package/templates/.claude/skills/elon-musk/SKILL.md +1 -0
- package/templates/.claude/skills/execute/SKILL.md +1 -0
- package/templates/.claude/skills/feedback/SKILL.md +1 -0
- package/templates/.claude/skills/figma-to-code/SKILL.md +1 -0
- package/templates/.claude/skills/genius-thinking/SKILL.md +1 -0
- package/templates/.claude/skills/global-uiux-design/SKILL.md +1 -0
- package/templates/.claude/skills/korea-uiux-design/SKILL.md +1 -0
- package/templates/.claude/skills/nextjs-react-best-practices/SKILL.md +1 -0
- package/templates/.claude/skills/plan/SKILL.md +1 -0
- package/templates/.claude/skills/prd/SKILL.md +1 -0
- package/templates/.claude/skills/project-optimizer/AGENTS.md +275 -0
- package/templates/.claude/skills/project-optimizer/SKILL.md +375 -0
- package/templates/.claude/skills/project-optimizer/rules/arch-config-centralize.md +66 -0
- package/templates/.claude/skills/project-optimizer/rules/arch-hot-path.md +35 -0
- package/templates/.claude/skills/project-optimizer/rules/arch-interface-segregation.md +51 -0
- package/templates/.claude/skills/project-optimizer/rules/arch-module-boundary.md +42 -0
- package/templates/.claude/skills/project-optimizer/rules/build-cache.md +57 -0
- package/templates/.claude/skills/project-optimizer/rules/build-code-split.md +56 -0
- package/templates/.claude/skills/project-optimizer/rules/build-incremental.md +65 -0
- package/templates/.claude/skills/project-optimizer/rules/build-minify.md +61 -0
- package/templates/.claude/skills/project-optimizer/rules/build-tree-shake.md +60 -0
- package/templates/.claude/skills/project-optimizer/rules/code-complexity.md +65 -0
- package/templates/.claude/skills/project-optimizer/rules/code-dead-elimination.md +32 -0
- package/templates/.claude/skills/project-optimizer/rules/code-duplication.md +54 -0
- package/templates/.claude/skills/project-optimizer/rules/code-error-handling.md +75 -0
- package/templates/.claude/skills/project-optimizer/rules/code-naming.md +52 -0
- package/templates/.claude/skills/project-optimizer/rules/concurrency-defer-await.md +54 -0
- package/templates/.claude/skills/project-optimizer/rules/concurrency-parallel.md +90 -0
- package/templates/.claude/skills/project-optimizer/rules/concurrency-pipeline.md +68 -0
- package/templates/.claude/skills/project-optimizer/rules/concurrency-pool.md +68 -0
- package/templates/.claude/skills/project-optimizer/rules/deps-lightweight-alt.md +37 -0
- package/templates/.claude/skills/project-optimizer/rules/deps-peer-align.md +44 -0
- package/templates/.claude/skills/project-optimizer/rules/deps-security-audit.md +45 -0
- package/templates/.claude/skills/project-optimizer/rules/deps-unused-removal.md +25 -0
- package/templates/.claude/skills/project-optimizer/rules/deps-version-pin.md +40 -0
- package/templates/.claude/skills/project-optimizer/rules/dx-ci-speed.md +47 -0
- package/templates/.claude/skills/project-optimizer/rules/dx-dev-server.md +35 -0
- package/templates/.claude/skills/project-optimizer/rules/dx-lint-config.md +36 -0
- package/templates/.claude/skills/project-optimizer/rules/dx-test-coverage.md +34 -0
- package/templates/.claude/skills/project-optimizer/rules/dx-type-safety.md +49 -0
- package/templates/.claude/skills/project-optimizer/rules/io-batch-queries.md +67 -0
- package/templates/.claude/skills/project-optimizer/rules/io-cache-layer.md +67 -0
- package/templates/.claude/skills/project-optimizer/rules/io-connection-reuse.md +67 -0
- package/templates/.claude/skills/project-optimizer/rules/io-serialize-minimal.md +61 -0
- package/templates/.claude/skills/project-optimizer/rules/io-stream.md +75 -0
- package/templates/.claude/skills/project-optimizer/rules/memory-bounded-cache.md +65 -0
- package/templates/.claude/skills/project-optimizer/rules/memory-large-data.md +64 -0
- package/templates/.claude/skills/project-optimizer/rules/memory-lazy-init.md +78 -0
- package/templates/.claude/skills/project-optimizer/rules/memory-leak-prevention.md +79 -0
- package/templates/.claude/skills/project-optimizer/rules/memory-pool-reuse.md +70 -0
- package/templates/.claude/skills/ralph/SKILL.md +1 -0
- package/templates/.claude/skills/refactor/SKILL.md +1 -0
- package/templates/.claude/skills/research/SKILL.md +1 -0
- package/templates/.claude/skills/sql-optimizer/SKILL.md +438 -0
- package/templates/.claude/skills/sql-optimizer/orm-patterns.md +218 -0
- package/templates/.claude/skills/startup-validator/SKILL.md +1 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/AGENTS.md +53 -14
- package/templates/.claude/skills/tanstack-start-react-best-practices/SKILL.md +94 -27
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/bundle-defer-third-party.md +42 -19
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/client-optimistic-updates.md +109 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/client-suspense-query.md +74 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/client-use-hook.md +81 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/rerender-react-compiler.md +81 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-beforeload-auth.md +121 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-file-conventions.md +104 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-link-navigation.md +119 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-nested-layouts.md +155 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-path-params.md +89 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-pending-component.md +110 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-preload-strategy.md +91 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-router-context.md +120 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/routing-search-params.md +114 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-deferred-data.md +1 -1
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-error-boundaries.md +79 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-middleware.md +85 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-serialization.md +56 -21
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-streaming.md +84 -0
- package/templates/.claude/skills/tanstack-start-react-best-practices/rules/server-validator.md +71 -0
- package/templates/.claude/skills/tauri-react-best-practices/AGENTS.md +527 -0
- package/templates/.claude/skills/tauri-react-best-practices/SKILL.md +571 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/bundle-barrel-imports.md +140 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/bundle-cargo-profile.md +96 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/bundle-frontend-treeshake.md +242 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/bundle-lazy-components.md +255 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/bundle-remove-unused-commands.md +160 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/deploy-ci-pipeline.md +269 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/deploy-signing.md +207 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/deploy-updater.md +226 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-async-commands.md +172 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-batch-commands.md +133 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-binary-response.md +198 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-channel-streaming.md +186 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-error-handling.md +250 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/ipc-type-safe.md +227 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/perf-derived-state.md +231 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/perf-functional-setstate.md +191 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/perf-index-maps.md +276 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/perf-lazy-state-init.md +196 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/plugin-lifecycle.md +265 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/plugin-mobile-compat.md +199 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/plugin-permission-scope.md +193 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/react-error-boundary.md +239 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/react-event-listener.md +151 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/react-file-src.md +155 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/react-invoke-hook.md +139 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/react-optimistic-update.md +211 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/security-capability-split.md +205 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/security-csp.md +207 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/security-least-privilege.md +106 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/security-no-wildcard.md +253 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/security-scope-paths.md +160 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/state-async-mutex.md +270 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/state-mutex-pattern.md +265 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/state-react-sync.md +375 -0
- package/templates/.claude/skills/tauri-react-best-practices/rules/state-single-container.md +275 -0
- package/templates/tanstack-start/docs/architecture.md +238 -167
- package/templates/tanstack-start/docs/library/tanstack-router/error-handling.md +777 -38
- package/templates/tanstack-start/docs/library/tanstack-router/hooks.md +549 -37
- package/templates/tanstack-start/docs/library/tanstack-router/index.md +895 -111
- package/templates/tanstack-start/docs/library/tanstack-router/navigation.md +641 -43
- package/templates/tanstack-start/docs/library/tanstack-router/route-context.md +889 -38
- package/templates/tanstack-start/docs/library/tanstack-router/search-params.md +891 -29
- package/templates/tanstack-start/docs/library/tanstack-start/auth-patterns.md +972 -36
- package/templates/tanstack-start/docs/library/tanstack-start/index.md +1525 -881
- package/templates/tanstack-start/docs/library/tanstack-start/middleware.md +1099 -20
- package/templates/tanstack-start/docs/library/tanstack-start/routing.md +796 -30
- package/templates/tanstack-start/docs/library/tanstack-start/server-functions.md +953 -35
- package/templates/tanstack-start/docs/library/tanstack-start/setup.md +371 -15
- package/templates/tauri/CLAUDE.md +189 -0
- package/templates/tauri/docs/guides/distribution.md +261 -0
- package/templates/tauri/docs/guides/getting-started.md +302 -0
- package/templates/tauri/docs/guides/mobile.md +288 -0
- package/templates/tauri/docs/library/tauri/index.md +510 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-optimizer
|
|
3
|
+
description: 범용 프로젝트 최적화 스킬. 언어/프레임워크 무관하게 코드 품질, 성능, 빌드, DX를 분석하고 개선. 코드 리뷰, 리팩토링, 성능 개선, 빌드 최적화, 의존성 정리 작업에 트리거.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: kood
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
adapted_for: universal
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
@../../instructions/agent-patterns/read-parallelization.md
|
|
12
|
+
@../../instructions/agent-patterns/agent-teams-usage.md
|
|
13
|
+
@../../instructions/validation/forbidden-patterns.md
|
|
14
|
+
@../../instructions/validation/required-behaviors.md
|
|
15
|
+
@../../instructions/multi-agent/coordination-guide.md
|
|
16
|
+
@../../instructions/multi-agent/execution-patterns.md
|
|
17
|
+
|
|
18
|
+
# Project Optimizer
|
|
19
|
+
|
|
20
|
+
범용 프로젝트 최적화 가이드. 언어/프레임워크에 종속되지 않는 8개 카테고리, 38개 규칙. 영향도별 우선순위로 자동 분석/리팩토링/코드 생성 가이드 제공. 어떤 프로젝트든 적용 가능한 보편적 최적화 원칙 기반.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<when_to_use>
|
|
25
|
+
|
|
26
|
+
## 사용 시점
|
|
27
|
+
|
|
28
|
+
| 상황 | 설명 |
|
|
29
|
+
|------|------|
|
|
30
|
+
| **성능 개선** | 응답 시간, 처리량, 메모리 사용량 최적화 |
|
|
31
|
+
| **빌드 최적화** | 빌드 속도, 출력 크기, CI/CD 파이프라인 개선 |
|
|
32
|
+
| **코드 품질** | 데드 코드 제거, 복잡도 감소, 중복 제거 |
|
|
33
|
+
| **의존성 정리** | 미사용 패키지 제거, 보안 취약점, 버전 관리 |
|
|
34
|
+
| **DX 개선** | 타입 안전성, 린팅, 테스트, 컨벤션 강화 |
|
|
35
|
+
| **코드 리뷰** | 성능/품질 이슈 검토 |
|
|
36
|
+
| **리팩토링** | 기존 코드 구조 개선 |
|
|
37
|
+
|
|
38
|
+
</when_to_use>
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
<parallel_agent_execution>
|
|
43
|
+
|
|
44
|
+
## 병렬 에이전트 실행
|
|
45
|
+
|
|
46
|
+
### 기본 원칙
|
|
47
|
+
|
|
48
|
+
| 원칙 | 실행 방법 | 효과 |
|
|
49
|
+
|------|----------|------|
|
|
50
|
+
| **PARALLEL** | 독립 작업을 단일 메시지에서 동시 실행 | 5-15배 속도 향상 |
|
|
51
|
+
| **DELEGATE** | 전문 에이전트에게 즉시 위임 | 품질 향상, 컨텍스트 격리 |
|
|
52
|
+
| **SMART MODEL** | 복잡도별 모델 선택 (haiku/sonnet/opus) | 비용 최적화 |
|
|
53
|
+
|
|
54
|
+
### Phase별 에이전트 활용
|
|
55
|
+
|
|
56
|
+
| Phase | 작업 | 에이전트 | 병렬 실행 |
|
|
57
|
+
|-------|------|---------|----------|
|
|
58
|
+
| **1. 프로젝트 분석** | 언어/프레임워크 감지, 구조 파악, 빌드 시스템 확인 | explore (haiku) | 여러 도메인 동시 탐색 |
|
|
59
|
+
| **2. 문제 진단** | 성능 병목, 코드 품질 이슈, 빌드 비효율 식별 | analyst (sonnet) | 카테고리별 동시 분석 |
|
|
60
|
+
| **3. 규칙 적용** | 최적화 규칙 적용, 리팩토링 실행 | implementation-executor (sonnet) | 독립 모듈/파일 동시 수정 |
|
|
61
|
+
| **4. 검증** | typecheck/lint/build/test 확인 | lint-fixer (sonnet), code-reviewer (opus) | lint 순차, review 병렬 |
|
|
62
|
+
| **5. 완료** | git commit | git-operator (sonnet) | 순차 |
|
|
63
|
+
|
|
64
|
+
### 실전 패턴
|
|
65
|
+
|
|
66
|
+
#### 패턴 1: 프로젝트 전체 분석 (Fan-Out)
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// 4개 도메인 동시 탐색 (60초)
|
|
70
|
+
Task(subagent_type="explore", model="haiku",
|
|
71
|
+
prompt="프로젝트 언어/프레임워크/빌드 시스템 감지. package.json, Cargo.toml, go.mod, pyproject.toml, Makefile 등 확인")
|
|
72
|
+
|
|
73
|
+
Task(subagent_type="explore", model="haiku",
|
|
74
|
+
prompt="코드 구조 분석: 디렉토리 구조, 진입점, 모듈 의존성 그래프 파악")
|
|
75
|
+
|
|
76
|
+
Task(subagent_type="explore", model="haiku",
|
|
77
|
+
prompt="빌드/CI 설정 분석: 빌드 스크립트, CI 파이프라인, Docker 설정")
|
|
78
|
+
|
|
79
|
+
Task(subagent_type="explore", model="haiku",
|
|
80
|
+
prompt="의존성 분석: 직접/간접 의존성 수, 보안 취약점, 미사용 패키지")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### 패턴 2: 카테고리별 병렬 최적화
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// 독립 모듈에 다른 규칙 동시 적용
|
|
87
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
88
|
+
prompt="모듈 A 최적화: concurrency-parallel, io-batch-queries")
|
|
89
|
+
|
|
90
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
91
|
+
prompt="모듈 B 최적화: memory-pool-reuse, code-dead-elimination")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### 패턴 3: 대규모 리팩토링 (배치 처리)
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// 10개+ 파일에 동일 규칙 적용 (토큰 70-90% 절감)
|
|
98
|
+
Task(subagent_type="implementation-executor", model="sonnet",
|
|
99
|
+
prompt=`다음 파일들에 concurrency-parallel 적용:
|
|
100
|
+
파일 목록: [...]
|
|
101
|
+
공통 규칙: 독립 I/O는 동시 실행`)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Model Routing
|
|
105
|
+
|
|
106
|
+
| 복잡도 | 모델 | 작업 예시 | 비용 | 속도 |
|
|
107
|
+
|--------|------|----------|------|------|
|
|
108
|
+
| **LOW** | haiku | 파일 구조 파악, 의존성 목록 확인 | 1x | 3x |
|
|
109
|
+
| **MEDIUM** | sonnet | 규칙 적용, 리팩토링 실행 | 2x | 2x |
|
|
110
|
+
| **HIGH** | opus | 아키텍처 설계, 보안 검토, 성능 전략 | 3x | 1x |
|
|
111
|
+
|
|
112
|
+
</parallel_agent_execution>
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
<categories>
|
|
117
|
+
|
|
118
|
+
## 카테고리별 우선순위
|
|
119
|
+
|
|
120
|
+
| 우선순위 | 카테고리 | 영향도 | 접두사 | 적용 범위 |
|
|
121
|
+
|---------|---------|--------|--------|----------|
|
|
122
|
+
| 1 | 동시성/병렬화 | **CRITICAL** | `concurrency-` | 모든 언어 |
|
|
123
|
+
| 2 | 빌드/번들 최적화 | **CRITICAL** | `build-` | 빌드 시스템 보유 프로젝트 |
|
|
124
|
+
| 3 | I/O 성능 | **HIGH** | `io-` | DB/네트워크/파일 I/O 사용 |
|
|
125
|
+
| 4 | 메모리/리소스 관리 | HIGH | `memory-` | 모든 언어 |
|
|
126
|
+
| 5 | 코드 품질 | MEDIUM-HIGH | `code-` | 모든 프로젝트 |
|
|
127
|
+
| 6 | 의존성 관리 | MEDIUM | `deps-` | 패키지 매니저 사용 |
|
|
128
|
+
| 7 | DX (개발자 경험) | MEDIUM | `dx-` | 팀 프로젝트 |
|
|
129
|
+
| 8 | 아키텍처 | LOW-MEDIUM | `arch-` | 중대형 프로젝트 |
|
|
130
|
+
|
|
131
|
+
</categories>
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
<rules>
|
|
136
|
+
|
|
137
|
+
## 빠른 참조
|
|
138
|
+
|
|
139
|
+
### 1. 동시성/병렬화 (CRITICAL)
|
|
140
|
+
|
|
141
|
+
| 규칙 | 설명 |
|
|
142
|
+
|------|------|
|
|
143
|
+
| `concurrency-parallel` | 독립 작업은 동시 실행 (Promise.all, goroutine, asyncio.gather, rayon 등) |
|
|
144
|
+
| `concurrency-defer-await` | await/블로킹을 실제 사용 지점으로 이동 |
|
|
145
|
+
| `concurrency-pipeline` | 파이프라인 병렬화 (생산자-소비자, 스트리밍) |
|
|
146
|
+
| `concurrency-pool` | 동시 실행 수 제한 (connection pool, worker pool, semaphore) |
|
|
147
|
+
|
|
148
|
+
### 2. 빌드/번들 최적화 (CRITICAL)
|
|
149
|
+
|
|
150
|
+
| 규칙 | 설명 |
|
|
151
|
+
|------|------|
|
|
152
|
+
| `build-incremental` | 증분 빌드 활성화 (캐시, 변경 감지) |
|
|
153
|
+
| `build-tree-shake` | 미사용 코드 자동 제거 (dead code elimination) |
|
|
154
|
+
| `build-code-split` | 진입점/라우트별 코드 분할 (lazy loading) |
|
|
155
|
+
| `build-minify` | 프로덕션 출력 최소화 (minification, compression) |
|
|
156
|
+
| `build-cache` | 빌드 캐시 활용 (CI/로컬) |
|
|
157
|
+
|
|
158
|
+
### 3. I/O 성능 (HIGH)
|
|
159
|
+
|
|
160
|
+
| 규칙 | 설명 |
|
|
161
|
+
|------|------|
|
|
162
|
+
| `io-batch-queries` | N+1 쿼리 → 배치/조인으로 전환 |
|
|
163
|
+
| `io-cache-layer` | 반복 읽기에 캐시 레이어 추가 (TTL, LRU, 인메모리) |
|
|
164
|
+
| `io-stream` | 대용량 데이터는 스트리밍 처리 (청크, 이터레이터, 제너레이터) |
|
|
165
|
+
| `io-connection-reuse` | 커넥션 풀/keep-alive/재사용 |
|
|
166
|
+
| `io-serialize-minimal` | 필요한 필드만 직렬화/전송 |
|
|
167
|
+
|
|
168
|
+
### 4. 메모리/리소스 관리 (HIGH)
|
|
169
|
+
|
|
170
|
+
| 규칙 | 설명 |
|
|
171
|
+
|------|------|
|
|
172
|
+
| `memory-leak-prevention` | 리소스 해제 보장 (close, dispose, cleanup, finally) |
|
|
173
|
+
| `memory-pool-reuse` | 객체 풀링/재사용 (버퍼, 커넥션, 스레드) |
|
|
174
|
+
| `memory-lazy-init` | 비싼 초기화는 지연 실행 |
|
|
175
|
+
| `memory-bounded-cache` | 캐시에 크기 제한 설정 (LRU, TTL, maxSize) |
|
|
176
|
+
| `memory-large-data` | 대용량 데이터는 스트림/페이지네이션 처리 |
|
|
177
|
+
|
|
178
|
+
### 5. 코드 품질 (MEDIUM-HIGH)
|
|
179
|
+
|
|
180
|
+
| 규칙 | 설명 |
|
|
181
|
+
|------|------|
|
|
182
|
+
| `code-dead-elimination` | 미사용 코드/변수/import 제거 |
|
|
183
|
+
| `code-duplication` | 중복 코드 추출/통합 (DRY, 단 3회 이상부터) |
|
|
184
|
+
| `code-complexity` | 순환 복잡도 감소 (early return, guard clause, 분리) |
|
|
185
|
+
| `code-naming` | 의도를 드러내는 명확한 이름 |
|
|
186
|
+
| `code-error-handling` | 일관된 에러 처리 패턴 (Result, Either, 에러 타입 계층) |
|
|
187
|
+
|
|
188
|
+
### 6. 의존성 관리 (MEDIUM)
|
|
189
|
+
|
|
190
|
+
| 규칙 | 설명 |
|
|
191
|
+
|------|------|
|
|
192
|
+
| `deps-unused-removal` | 미사용 의존성 제거 |
|
|
193
|
+
| `deps-security-audit` | 보안 취약점 스캔 및 업데이트 |
|
|
194
|
+
| `deps-version-pin` | 프로덕션 의존성 버전 고정 |
|
|
195
|
+
| `deps-lightweight-alt` | 무거운 라이브러리 → 경량 대안 또는 자체 구현 |
|
|
196
|
+
| `deps-peer-align` | peer dependency 버전 충돌 해결 |
|
|
197
|
+
|
|
198
|
+
### 7. DX - 개발자 경험 (MEDIUM)
|
|
199
|
+
|
|
200
|
+
| 규칙 | 설명 |
|
|
201
|
+
|------|------|
|
|
202
|
+
| `dx-type-safety` | 타입 시스템 최대 활용 (strict mode, 제네릭, 유니온) |
|
|
203
|
+
| `dx-lint-config` | 린터/포매터 최적 설정 |
|
|
204
|
+
| `dx-test-coverage` | 핵심 로직 테스트 커버리지 확보 |
|
|
205
|
+
| `dx-ci-speed` | CI 파이프라인 속도 최적화 (캐시, 병렬, 불필요 단계 제거) |
|
|
206
|
+
| `dx-dev-server` | 로컬 개발 서버 시작 속도 개선 |
|
|
207
|
+
|
|
208
|
+
### 8. 아키텍처 (LOW-MEDIUM)
|
|
209
|
+
|
|
210
|
+
| 규칙 | 설명 |
|
|
211
|
+
|------|------|
|
|
212
|
+
| `arch-module-boundary` | 모듈 경계 명확화 (순환 의존 제거) |
|
|
213
|
+
| `arch-interface-segregation` | 인터페이스 분리 (큰 인터페이스 → 작은 단위) |
|
|
214
|
+
| `arch-config-centralize` | 설정/환경변수 중앙 관리 |
|
|
215
|
+
| `arch-hot-path` | 핫 패스 식별 및 집중 최적화 |
|
|
216
|
+
|
|
217
|
+
</rules>
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
<language_detection>
|
|
222
|
+
|
|
223
|
+
## 언어/프레임워크 자동 감지
|
|
224
|
+
|
|
225
|
+
### 감지 매트릭스
|
|
226
|
+
|
|
227
|
+
| 감지 파일 | 언어/도구 | 추가 확인 |
|
|
228
|
+
|-----------|----------|----------|
|
|
229
|
+
| `package.json` | Node.js/TypeScript | `tsconfig.json` → TS |
|
|
230
|
+
| `Cargo.toml` | Rust | `rust-toolchain.toml` |
|
|
231
|
+
| `go.mod` | Go | `go.sum` |
|
|
232
|
+
| `pyproject.toml` / `requirements.txt` | Python | `setup.py`, `poetry.lock` |
|
|
233
|
+
| `pom.xml` / `build.gradle` | Java/Kotlin | `settings.gradle` |
|
|
234
|
+
| `Gemfile` | Ruby | `Rakefile` |
|
|
235
|
+
| `composer.json` | PHP | |
|
|
236
|
+
| `mix.exs` | Elixir | |
|
|
237
|
+
| `CMakeLists.txt` | C/C++ | `Makefile` |
|
|
238
|
+
| `*.sln` / `*.csproj` | C#/.NET | |
|
|
239
|
+
| `pubspec.yaml` | Dart/Flutter | |
|
|
240
|
+
| `Package.swift` | Swift | `*.xcodeproj` |
|
|
241
|
+
|
|
242
|
+
### 감지 후 동작
|
|
243
|
+
|
|
244
|
+
1. **규칙 필터링**: 감지된 언어의 `languages` 태그가 `all` 또는 해당 언어를 포함하는 규칙만 적용
|
|
245
|
+
2. **예시 선택**: 규칙 내 코드 예시 중 감지된 언어의 관용적 패턴 우선 제시
|
|
246
|
+
3. **도구 매핑**: 감지된 언어에 맞는 빌드/린트/테스트 도구 자동 선택
|
|
247
|
+
4. **프레임워크 체이닝**: 프레임워크 감지 시 해당 best-practices 스킬 자동 참조
|
|
248
|
+
|
|
249
|
+
</language_detection>
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
<workflow>
|
|
254
|
+
|
|
255
|
+
## 실행 워크플로우
|
|
256
|
+
|
|
257
|
+
### Phase 1: 프로젝트 분석 (병렬)
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
1. 언어/프레임워크/빌드 시스템 감지 (explore x haiku)
|
|
261
|
+
2. 코드 구조/모듈 의존성 파악 (explore x haiku)
|
|
262
|
+
3. 빌드/CI 설정 분석 (explore x haiku)
|
|
263
|
+
4. 의존성 상태 분석 (explore x haiku)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Phase 2: 문제 진단 (병렬)
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
1. 카테고리별 이슈 스캔 (analyst x sonnet)
|
|
270
|
+
- 우선순위 1-4 (CRITICAL/HIGH) 집중
|
|
271
|
+
- 각 이슈에 영향도/규칙 매핑
|
|
272
|
+
2. 기존 best-practices 스킬과 교차 참조
|
|
273
|
+
- nextjs-react-best-practices (Next.js 프로젝트)
|
|
274
|
+
- tanstack-start-react-best-practices (TanStack 프로젝트)
|
|
275
|
+
- tauri-react-best-practices (Tauri 프로젝트)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Phase 3: 최적화 실행 (병렬)
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
1. CRITICAL 이슈 먼저 (concurrency, build)
|
|
282
|
+
2. HIGH 이슈 (io, memory)
|
|
283
|
+
3. MEDIUM+ 이슈 (code, deps, dx)
|
|
284
|
+
4. 독립 모듈은 병렬 실행
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Phase 4: 검증
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
1. 빌드 성공 확인
|
|
291
|
+
2. 테스트 통과 확인
|
|
292
|
+
3. 린트/타입체크 확인
|
|
293
|
+
4. 성능 벤치마크 (있으면)
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
</workflow>
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
<skill_chaining>
|
|
301
|
+
|
|
302
|
+
## 다른 스킬과 병행
|
|
303
|
+
|
|
304
|
+
### 자동 감지 및 체이닝
|
|
305
|
+
|
|
306
|
+
| 감지 조건 | 추천 스킬 | 역할 |
|
|
307
|
+
|-----------|----------|------|
|
|
308
|
+
| Next.js 프로젝트 | `nextjs-react-best-practices` | 프레임워크 특화 규칙 병행 |
|
|
309
|
+
| TanStack Start 프로젝트 | `tanstack-start-react-best-practices` | 프레임워크 특화 규칙 병행 |
|
|
310
|
+
| Tauri 프로젝트 | `tauri-react-best-practices` | IPC/보안/번들 특화 규칙 병행 |
|
|
311
|
+
| 코드 구조 문제 | `refactor` | 구조적 리팩토링 계획 |
|
|
312
|
+
| 버그 발견 | `bug-fix` | 버그 수정 워크플로우 |
|
|
313
|
+
| 의존성 문서 필요 | `docs-fetch` | 라이브러리 문서 수집 |
|
|
314
|
+
| 배포 전 검증 | `pre-deploy` | typecheck/lint/build 전체 검증 |
|
|
315
|
+
|
|
316
|
+
### 우선순위 규칙
|
|
317
|
+
|
|
318
|
+
| 우선순위 | 규칙 |
|
|
319
|
+
|---------|------|
|
|
320
|
+
| 1 | **프레임워크 특화 스킬 우선**: 프레임워크 스킬의 규칙이 project-optimizer 범용 규칙보다 우선 |
|
|
321
|
+
| 2 | **충돌 시 특화 우선**: 동일 주제에서 범용 규칙과 프레임워크 규칙이 충돌하면 프레임워크 규칙 적용 |
|
|
322
|
+
| 3 | **보완 병행**: 프레임워크 스킬에 없는 카테고리 (concurrency, memory, deps 등)는 project-optimizer 규칙 적용 |
|
|
323
|
+
| 4 | **단계적 적용**: Phase 1-2에서 project-optimizer 분석 → Phase 3에서 프레임워크 스킬과 병합 실행 |
|
|
324
|
+
|
|
325
|
+
</skill_chaining>
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
<usage>
|
|
330
|
+
|
|
331
|
+
## 사용법
|
|
332
|
+
|
|
333
|
+
**상세 규칙 및 예시:**
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
rules/concurrency-parallel.md
|
|
337
|
+
rules/build-incremental.md
|
|
338
|
+
rules/io-batch-queries.md
|
|
339
|
+
rules/memory-leak-prevention.md
|
|
340
|
+
rules/code-dead-elimination.md
|
|
341
|
+
rules/deps-unused-removal.md
|
|
342
|
+
rules/dx-type-safety.md
|
|
343
|
+
rules/arch-module-boundary.md
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
각 규칙 파일 포함 내용:
|
|
347
|
+
- 중요한 이유 설명
|
|
348
|
+
- 여러 언어의 ❌ 잘못된 코드 예시
|
|
349
|
+
- 여러 언어의 ✅ 올바른 코드 예시
|
|
350
|
+
- 추가 컨텍스트 및 참조
|
|
351
|
+
|
|
352
|
+
</usage>
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
<references>
|
|
357
|
+
|
|
358
|
+
## 참고 자료
|
|
359
|
+
|
|
360
|
+
### 범용
|
|
361
|
+
1. [Google Engineering Practices](https://google.github.io/eng-practices/)
|
|
362
|
+
2. [The Twelve-Factor App](https://12factor.net/)
|
|
363
|
+
|
|
364
|
+
### 언어별
|
|
365
|
+
3. [Effective Go](https://go.dev/doc/effective_go)
|
|
366
|
+
4. [Rust Performance Book](https://nnethercote.github.io/perf-book/)
|
|
367
|
+
5. [Python Performance Tips](https://docs.python.org/3/howto/perf_profiling.html)
|
|
368
|
+
6. [Node.js Best Practices](https://github.com/goldbergyoni/nodebestpractices)
|
|
369
|
+
|
|
370
|
+
### 빌드/번들
|
|
371
|
+
7. [Vite Performance](https://vite.dev/guide/performance)
|
|
372
|
+
8. [webpack Tree Shaking](https://webpack.js.org/guides/tree-shaking/)
|
|
373
|
+
9. [Turborepo](https://turbo.build/repo/docs)
|
|
374
|
+
|
|
375
|
+
</references>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Centralize Configuration and Environment Variables
|
|
3
|
+
impact: LOW-MEDIUM
|
|
4
|
+
impactDescription: Single source of truth, easier deployment management
|
|
5
|
+
tags: arch, config, env, centralize, validation
|
|
6
|
+
languages: all
|
|
7
|
+
related: [code-error-handling, dx-type-safety]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 설정/환경변수 중앙 관리
|
|
11
|
+
|
|
12
|
+
코드 전체에 흩어진 `process.env`, `os.environ` 접근을 하나의 설정 모듈로 통합합니다.
|
|
13
|
+
|
|
14
|
+
**❌ 잘못된 예시 (분산된 환경변수 접근):**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// file_a.ts
|
|
18
|
+
const dbUrl = process.env.DATABASE_URL! // 누락 시 런타임 에러
|
|
19
|
+
|
|
20
|
+
// file_b.ts
|
|
21
|
+
const port = parseInt(process.env.PORT || '3000') // 중복 파싱
|
|
22
|
+
|
|
23
|
+
// file_c.ts
|
|
24
|
+
if (process.env.NODE_ENV === 'production') { ... }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**✅ 올바른 예시 (중앙 관리):**
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// config.ts - 단일 설정 모듈
|
|
31
|
+
import { z } from 'zod'
|
|
32
|
+
|
|
33
|
+
const envSchema = z.object({
|
|
34
|
+
DATABASE_URL: z.string().url(),
|
|
35
|
+
PORT: z.coerce.number().default(3000),
|
|
36
|
+
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export const config = envSchema.parse(process.env)
|
|
40
|
+
// 시작 시 검증, 누락/잘못된 값 즉시 감지
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
# Python (pydantic-settings)
|
|
45
|
+
from pydantic_settings import BaseSettings
|
|
46
|
+
|
|
47
|
+
class Config(BaseSettings):
|
|
48
|
+
database_url: str
|
|
49
|
+
port: int = 3000
|
|
50
|
+
debug: bool = False
|
|
51
|
+
|
|
52
|
+
config = Config() # .env + 환경변수 자동 로드
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```go
|
|
56
|
+
// Go (envconfig)
|
|
57
|
+
type Config struct {
|
|
58
|
+
DatabaseURL string `envconfig:"DATABASE_URL" required:"true"`
|
|
59
|
+
Port int `envconfig:"PORT" default:"3000"`
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var cfg Config
|
|
63
|
+
envconfig.Process("", &cfg)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**원칙:** 환경변수는 애플리케이션 시작 시 한 번 파싱/검증하고, 이후 타입 안전한 config 객체로 접근.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Identify and Optimize Hot Paths
|
|
3
|
+
impact: LOW-MEDIUM
|
|
4
|
+
impactDescription: Targeted optimization on code that matters most
|
|
5
|
+
tags: arch, hot-path, profiling, optimization, bottleneck
|
|
6
|
+
languages: all
|
|
7
|
+
related: [concurrency-parallel, io-batch-queries, memory-pool-reuse]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 핫 패스 식별 및 집중 최적화
|
|
11
|
+
|
|
12
|
+
전체 코드의 80%는 최적화 불필요. 실행 빈도가 높은 20% (핫 패스)를 프로파일링으로 식별하고 집중 최적화합니다.
|
|
13
|
+
|
|
14
|
+
**프로파일링 도구:**
|
|
15
|
+
|
|
16
|
+
| 언어 | 도구 | 명령어 |
|
|
17
|
+
|------|------|--------|
|
|
18
|
+
| **JS/TS** | Node.js `--prof` | `node --prof app.js` + `node --prof-process` |
|
|
19
|
+
| **JS/TS** | Chrome DevTools | Performance 탭 |
|
|
20
|
+
| **Python** | cProfile / py-spy | `python -m cProfile -s cumtime app.py` |
|
|
21
|
+
| **Go** | pprof (내장) | `go tool pprof http://localhost:6060/debug/pprof/profile` |
|
|
22
|
+
| **Rust** | flamegraph | `cargo flamegraph` |
|
|
23
|
+
| **Java** | async-profiler | `-agentpath:libasyncProfiler.so` |
|
|
24
|
+
|
|
25
|
+
**최적화 순서:**
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
1. 측정 (프로파일링) → 핫 패스 식별
|
|
29
|
+
2. 알고리즘 개선 (O(n²) → O(n log n))
|
|
30
|
+
3. I/O 최적화 (이 스킬의 io-* 규칙 적용)
|
|
31
|
+
4. 메모리 최적화 (이 스킬의 memory-* 규칙 적용)
|
|
32
|
+
5. 마이크로 최적화 (마지막 수단)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**원칙:** "추측하지 말고, 측정하라." 프로파일링 없는 최적화는 시간 낭비. 핫 패스가 아닌 코드의 최적화는 ROI가 낮음.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Segregate Large Interfaces
|
|
3
|
+
impact: LOW-MEDIUM
|
|
4
|
+
impactDescription: Reduced coupling, easier testing and mocking
|
|
5
|
+
tags: arch, interface, segregation, coupling
|
|
6
|
+
languages: [ts, go, rust, java, csharp]
|
|
7
|
+
related: [arch-module-boundary, code-duplication]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 큰 인터페이스를 작은 단위로 분리
|
|
11
|
+
|
|
12
|
+
하나의 거대한 인터페이스 대신 용도별 작은 인터페이스를 사용합니다.
|
|
13
|
+
|
|
14
|
+
**❌ 잘못된 예시:**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
interface UserService {
|
|
18
|
+
getUser(id: string): User
|
|
19
|
+
createUser(data: CreateUserData): User
|
|
20
|
+
deleteUser(id: string): void
|
|
21
|
+
sendEmail(userId: string, subject: string): void
|
|
22
|
+
generateReport(userId: string): Report
|
|
23
|
+
uploadAvatar(userId: string, file: File): string
|
|
24
|
+
}
|
|
25
|
+
// 이메일만 보내려는 컴포넌트도 전체 인터페이스에 의존
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**✅ 올바른 예시:**
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
interface UserReader { getUser(id: string): User }
|
|
32
|
+
interface UserWriter { createUser(data: CreateUserData): User; deleteUser(id: string): void }
|
|
33
|
+
interface EmailSender { sendEmail(userId: string, subject: string): void }
|
|
34
|
+
// 각 소비자는 필요한 인터페이스만 의존
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```go
|
|
38
|
+
// Go - 암시적 인터페이스 (소비자 쪽에서 정의)
|
|
39
|
+
// reader.go - 이 패키지에서 필요한 것만 정의
|
|
40
|
+
type UserGetter interface {
|
|
41
|
+
GetUser(ctx context.Context, id string) (*User, error)
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```rust
|
|
46
|
+
// Rust - trait 분리
|
|
47
|
+
trait Readable { fn read(&self, id: &str) -> Result<User>; }
|
|
48
|
+
trait Writable { fn write(&self, user: &User) -> Result<()>; }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**원칙:** "클라이언트는 자신이 사용하지 않는 메서드에 의존하지 않아야 한다" (ISP).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Enforce Clear Module Boundaries
|
|
3
|
+
impact: LOW-MEDIUM
|
|
4
|
+
impactDescription: Prevents spaghetti dependencies, enables parallel work
|
|
5
|
+
tags: arch, module, boundary, circular, dependency
|
|
6
|
+
languages: all
|
|
7
|
+
related: [arch-interface-segregation, code-complexity]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 모듈 경계 명확화
|
|
11
|
+
|
|
12
|
+
모듈 간 순환 의존을 제거하고 명확한 의존 방향을 유지합니다.
|
|
13
|
+
|
|
14
|
+
**순환 의존 감지:**
|
|
15
|
+
|
|
16
|
+
| 언어 | 도구 |
|
|
17
|
+
|------|------|
|
|
18
|
+
| **JS/TS** | `madge --circular src/` |
|
|
19
|
+
| **Python** | `pydeps --no-show` |
|
|
20
|
+
| **Go** | 컴파일러 (순환 import = 컴파일 에러) |
|
|
21
|
+
| **Rust** | 컴파일러 (순환 crate = 컴파일 에러) |
|
|
22
|
+
| **Java** | ArchUnit, JDepend |
|
|
23
|
+
|
|
24
|
+
**해결 패턴:**
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
❌ 순환: A → B → C → A
|
|
28
|
+
|
|
29
|
+
✅ 의존성 역전:
|
|
30
|
+
A → Interface ← B → C
|
|
31
|
+
(A는 인터페이스에 의존, B가 구현)
|
|
32
|
+
|
|
33
|
+
✅ 이벤트/메시지:
|
|
34
|
+
A → EventBus ← B
|
|
35
|
+
(A가 이벤트 발행, B가 구독)
|
|
36
|
+
|
|
37
|
+
✅ 추출:
|
|
38
|
+
A → D ← B → C
|
|
39
|
+
(공통 부분을 D로 추출)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**원칙:** 의존 방향은 상위(추상) → 하위(구체). 도메인 모듈이 인프라에 의존하지 않음.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Leverage Build Cache in CI and Local
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: 40-80% CI pipeline time reduction
|
|
5
|
+
tags: build, cache, ci, pipeline
|
|
6
|
+
languages: all
|
|
7
|
+
related: [build-incremental, dx-ci-speed]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 빌드 캐시 활용
|
|
11
|
+
|
|
12
|
+
CI와 로컬 환경에서 빌드 아티팩트, 의존성, 컴파일 캐시를 재사용합니다.
|
|
13
|
+
|
|
14
|
+
**✅ GitHub Actions 캐시:**
|
|
15
|
+
|
|
16
|
+
```yaml
|
|
17
|
+
# Node.js
|
|
18
|
+
- uses: actions/cache@v4
|
|
19
|
+
with:
|
|
20
|
+
path: node_modules
|
|
21
|
+
key: node-${{ hashFiles('yarn.lock') }}
|
|
22
|
+
|
|
23
|
+
# Rust
|
|
24
|
+
- uses: actions/cache@v4
|
|
25
|
+
with:
|
|
26
|
+
path: |
|
|
27
|
+
~/.cargo/registry
|
|
28
|
+
~/.cargo/git
|
|
29
|
+
target
|
|
30
|
+
key: rust-${{ hashFiles('Cargo.lock') }}
|
|
31
|
+
|
|
32
|
+
# Go
|
|
33
|
+
- uses: actions/cache@v4
|
|
34
|
+
with:
|
|
35
|
+
path: |
|
|
36
|
+
~/go/pkg/mod
|
|
37
|
+
~/.cache/go-build
|
|
38
|
+
key: go-${{ hashFiles('go.sum') }}
|
|
39
|
+
|
|
40
|
+
# Python
|
|
41
|
+
- uses: actions/cache@v4
|
|
42
|
+
with:
|
|
43
|
+
path: ~/.cache/pip
|
|
44
|
+
key: pip-${{ hashFiles('requirements.txt') }}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**모노레포 캐시 도구:**
|
|
48
|
+
|
|
49
|
+
| 도구 | 특징 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| **Turborepo** | 원격 캐시, 태스크 그래프 |
|
|
52
|
+
| **Nx** | 영향 받은 프로젝트만 빌드 |
|
|
53
|
+
| **Bazel** | 세밀한 캐시, 원격 실행 |
|
|
54
|
+
| **sccache** | Rust/C/C++ 컴파일 캐시 |
|
|
55
|
+
| **ccache** | C/C++ 컴파일 캐시 |
|
|
56
|
+
|
|
57
|
+
**핵심:** 캐시 키에 lockfile 해시 포함, 의존성 변경 시에만 캐시 무효화.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Code Splitting by Entry Point
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: 30-70% initial load reduction
|
|
5
|
+
tags: build, code-splitting, lazy-loading, bundle
|
|
6
|
+
languages: [js, ts]
|
|
7
|
+
related: [build-tree-shake, memory-lazy-init]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 진입점/라우트별 코드 분할
|
|
11
|
+
|
|
12
|
+
단일 거대 번들 대신 진입점/라우트/기능별로 분할하여 초기 로딩 크기를 줄입니다.
|
|
13
|
+
|
|
14
|
+
**❌ 잘못된 예시 (단일 번들):**
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// 모든 페이지가 하나의 번들에 포함
|
|
18
|
+
import { Dashboard } from './pages/Dashboard'
|
|
19
|
+
import { Settings } from './pages/Settings'
|
|
20
|
+
import { Admin } from './pages/Admin' // 대부분 사용자에게 불필요
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**✅ 올바른 예시 (동적 import):**
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// JS/TS - 라우트별 코드 분할
|
|
27
|
+
const Dashboard = lazy(() => import('./pages/Dashboard'))
|
|
28
|
+
const Settings = lazy(() => import('./pages/Settings'))
|
|
29
|
+
const Admin = lazy(() => import('./pages/Admin'))
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
# Python - 무거운 모듈 지연 로딩
|
|
34
|
+
def analyze():
|
|
35
|
+
import pandas as pd # 필요 시점에만 로드 (import 시간 ~200ms)
|
|
36
|
+
return pd.read_csv("data.csv")
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```go
|
|
40
|
+
// Go - 플러그인 시스템으로 런타임 로딩
|
|
41
|
+
p, _ := plugin.Open("analytics.so")
|
|
42
|
+
analyze, _ := p.Lookup("Analyze")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**프레임워크별 패턴:**
|
|
46
|
+
|
|
47
|
+
| 프레임워크 | 코드 분할 방법 |
|
|
48
|
+
|-----------|-------------|
|
|
49
|
+
| React | `React.lazy()` + `Suspense` |
|
|
50
|
+
| Vue | `defineAsyncComponent()` |
|
|
51
|
+
| Svelte | `import()` in routes |
|
|
52
|
+
| Next.js | `next/dynamic` |
|
|
53
|
+
| TanStack Router | `.lazy.tsx` 파일 컨벤션 |
|
|
54
|
+
| Angular | `loadChildren` (lazy routes) |
|
|
55
|
+
|
|
56
|
+
**적용 기준:** 50KB+ 모듈, 조건부 표시 UI, 관리자 전용 기능.
|