@wooojin/forgen 0.1.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.
Files changed (268) hide show
  1. package/.claude-plugin/plugin.json +20 -0
  2. package/CHANGELOG.md +353 -0
  3. package/CONTRIBUTING.md +98 -0
  4. package/LICENSE +21 -0
  5. package/README.ja.md +469 -0
  6. package/README.ko.md +469 -0
  7. package/README.md +483 -0
  8. package/README.zh.md +469 -0
  9. package/agents/analyst.md +98 -0
  10. package/agents/architect.md +62 -0
  11. package/agents/code-reviewer.md +120 -0
  12. package/agents/code-simplifier.md +197 -0
  13. package/agents/critic.md +70 -0
  14. package/agents/debugger.md +117 -0
  15. package/agents/designer.md +131 -0
  16. package/agents/executor.md +54 -0
  17. package/agents/explore.md +145 -0
  18. package/agents/git-master.md +212 -0
  19. package/agents/performance-reviewer.md +172 -0
  20. package/agents/planner.md +29 -0
  21. package/agents/qa-tester.md +158 -0
  22. package/agents/refactoring-expert.md +168 -0
  23. package/agents/scientist.md +144 -0
  24. package/agents/security-reviewer.md +137 -0
  25. package/agents/test-engineer.md +153 -0
  26. package/agents/verifier.md +133 -0
  27. package/agents/writer.md +184 -0
  28. package/commands/api-design.md +268 -0
  29. package/commands/architecture-decision.md +314 -0
  30. package/commands/ci-cd.md +270 -0
  31. package/commands/code-review.md +233 -0
  32. package/commands/compound.md +117 -0
  33. package/commands/database.md +263 -0
  34. package/commands/debug-detective.md +99 -0
  35. package/commands/docker.md +274 -0
  36. package/commands/documentation.md +276 -0
  37. package/commands/ecomode.md +51 -0
  38. package/commands/frontend.md +271 -0
  39. package/commands/git-master.md +90 -0
  40. package/commands/incident-response.md +292 -0
  41. package/commands/migrate.md +101 -0
  42. package/commands/performance.md +288 -0
  43. package/commands/refactor.md +105 -0
  44. package/commands/security-review.md +288 -0
  45. package/commands/tdd.md +183 -0
  46. package/commands/testing-strategy.md +265 -0
  47. package/dist/cli.d.ts +2 -0
  48. package/dist/cli.js +295 -0
  49. package/dist/core/auto-compound-runner.d.ts +12 -0
  50. package/dist/core/auto-compound-runner.js +460 -0
  51. package/dist/core/config-hooks.d.ts +10 -0
  52. package/dist/core/config-hooks.js +112 -0
  53. package/dist/core/config-injector.d.ts +50 -0
  54. package/dist/core/config-injector.js +455 -0
  55. package/dist/core/doctor.d.ts +1 -0
  56. package/dist/core/doctor.js +163 -0
  57. package/dist/core/errors.d.ts +81 -0
  58. package/dist/core/errors.js +133 -0
  59. package/dist/core/global-config.d.ts +43 -0
  60. package/dist/core/global-config.js +25 -0
  61. package/dist/core/harness.d.ts +24 -0
  62. package/dist/core/harness.js +621 -0
  63. package/dist/core/init.d.ts +7 -0
  64. package/dist/core/init.js +37 -0
  65. package/dist/core/inspect-cli.d.ts +7 -0
  66. package/dist/core/inspect-cli.js +47 -0
  67. package/dist/core/legacy-detector.d.ts +33 -0
  68. package/dist/core/legacy-detector.js +66 -0
  69. package/dist/core/logger.d.ts +34 -0
  70. package/dist/core/logger.js +121 -0
  71. package/dist/core/mcp-config.d.ts +44 -0
  72. package/dist/core/mcp-config.js +177 -0
  73. package/dist/core/notepad.d.ts +31 -0
  74. package/dist/core/notepad.js +88 -0
  75. package/dist/core/paths.d.ts +85 -0
  76. package/dist/core/paths.js +101 -0
  77. package/dist/core/plugin-detector.d.ts +44 -0
  78. package/dist/core/plugin-detector.js +226 -0
  79. package/dist/core/runtime-detector.d.ts +8 -0
  80. package/dist/core/runtime-detector.js +49 -0
  81. package/dist/core/scope-resolver.d.ts +8 -0
  82. package/dist/core/scope-resolver.js +45 -0
  83. package/dist/core/session-logger.d.ts +6 -0
  84. package/dist/core/session-logger.js +111 -0
  85. package/dist/core/session-store.d.ts +28 -0
  86. package/dist/core/session-store.js +218 -0
  87. package/dist/core/settings-lock.d.ts +18 -0
  88. package/dist/core/settings-lock.js +125 -0
  89. package/dist/core/spawn.d.ts +3 -0
  90. package/dist/core/spawn.js +135 -0
  91. package/dist/core/types.d.ts +108 -0
  92. package/dist/core/types.js +1 -0
  93. package/dist/core/uninstall.d.ts +4 -0
  94. package/dist/core/uninstall.js +307 -0
  95. package/dist/core/v1-bootstrap.d.ts +26 -0
  96. package/dist/core/v1-bootstrap.js +155 -0
  97. package/dist/engine/compound-cli.d.ts +24 -0
  98. package/dist/engine/compound-cli.js +250 -0
  99. package/dist/engine/compound-extractor.d.ts +68 -0
  100. package/dist/engine/compound-extractor.js +860 -0
  101. package/dist/engine/compound-lifecycle.d.ts +32 -0
  102. package/dist/engine/compound-lifecycle.js +305 -0
  103. package/dist/engine/compound-loop.d.ts +32 -0
  104. package/dist/engine/compound-loop.js +511 -0
  105. package/dist/engine/match-eval-log.d.ts +139 -0
  106. package/dist/engine/match-eval-log.js +270 -0
  107. package/dist/engine/phrase-blocklist.d.ts +119 -0
  108. package/dist/engine/phrase-blocklist.js +208 -0
  109. package/dist/engine/skill-promoter.d.ts +20 -0
  110. package/dist/engine/skill-promoter.js +115 -0
  111. package/dist/engine/solution-format.d.ts +160 -0
  112. package/dist/engine/solution-format.js +432 -0
  113. package/dist/engine/solution-index.d.ts +13 -0
  114. package/dist/engine/solution-index.js +252 -0
  115. package/dist/engine/solution-matcher.d.ts +364 -0
  116. package/dist/engine/solution-matcher.js +656 -0
  117. package/dist/engine/solution-writer.d.ts +76 -0
  118. package/dist/engine/solution-writer.js +157 -0
  119. package/dist/engine/term-matcher.d.ts +81 -0
  120. package/dist/engine/term-matcher.js +268 -0
  121. package/dist/engine/term-normalizer.d.ts +116 -0
  122. package/dist/engine/term-normalizer.js +171 -0
  123. package/dist/fgx.d.ts +6 -0
  124. package/dist/fgx.js +42 -0
  125. package/dist/forge/cli.d.ts +11 -0
  126. package/dist/forge/cli.js +100 -0
  127. package/dist/forge/evidence-processor.d.ts +21 -0
  128. package/dist/forge/evidence-processor.js +87 -0
  129. package/dist/forge/mismatch-detector.d.ts +44 -0
  130. package/dist/forge/mismatch-detector.js +83 -0
  131. package/dist/forge/onboarding-cli.d.ts +6 -0
  132. package/dist/forge/onboarding-cli.js +89 -0
  133. package/dist/forge/onboarding.d.ts +25 -0
  134. package/dist/forge/onboarding.js +122 -0
  135. package/dist/hooks/compound-reflection.d.ts +45 -0
  136. package/dist/hooks/compound-reflection.js +82 -0
  137. package/dist/hooks/context-guard.d.ts +24 -0
  138. package/dist/hooks/context-guard.js +156 -0
  139. package/dist/hooks/dangerous-patterns.json +18 -0
  140. package/dist/hooks/db-guard.d.ts +17 -0
  141. package/dist/hooks/db-guard.js +105 -0
  142. package/dist/hooks/hook-config.d.ts +29 -0
  143. package/dist/hooks/hook-config.js +92 -0
  144. package/dist/hooks/hook-registry.d.ts +43 -0
  145. package/dist/hooks/hook-registry.js +31 -0
  146. package/dist/hooks/hooks-generator.d.ts +49 -0
  147. package/dist/hooks/hooks-generator.js +99 -0
  148. package/dist/hooks/intent-classifier.d.ts +12 -0
  149. package/dist/hooks/intent-classifier.js +62 -0
  150. package/dist/hooks/keyword-detector.d.ts +25 -0
  151. package/dist/hooks/keyword-detector.js +389 -0
  152. package/dist/hooks/notepad-injector.d.ts +18 -0
  153. package/dist/hooks/notepad-injector.js +51 -0
  154. package/dist/hooks/permission-handler.d.ts +14 -0
  155. package/dist/hooks/permission-handler.js +114 -0
  156. package/dist/hooks/post-tool-failure.d.ts +11 -0
  157. package/dist/hooks/post-tool-failure.js +118 -0
  158. package/dist/hooks/post-tool-handlers.d.ts +17 -0
  159. package/dist/hooks/post-tool-handlers.js +115 -0
  160. package/dist/hooks/post-tool-use.d.ts +29 -0
  161. package/dist/hooks/post-tool-use.js +151 -0
  162. package/dist/hooks/pre-compact.d.ts +10 -0
  163. package/dist/hooks/pre-compact.js +165 -0
  164. package/dist/hooks/pre-tool-use.d.ts +31 -0
  165. package/dist/hooks/pre-tool-use.js +325 -0
  166. package/dist/hooks/prompt-injection-filter.d.ts +56 -0
  167. package/dist/hooks/prompt-injection-filter.js +287 -0
  168. package/dist/hooks/rate-limiter.d.ts +21 -0
  169. package/dist/hooks/rate-limiter.js +86 -0
  170. package/dist/hooks/secret-filter.d.ts +14 -0
  171. package/dist/hooks/secret-filter.js +65 -0
  172. package/dist/hooks/session-recovery.d.ts +27 -0
  173. package/dist/hooks/session-recovery.js +406 -0
  174. package/dist/hooks/shared/atomic-write.d.ts +41 -0
  175. package/dist/hooks/shared/atomic-write.js +148 -0
  176. package/dist/hooks/shared/context-budget.d.ts +37 -0
  177. package/dist/hooks/shared/context-budget.js +45 -0
  178. package/dist/hooks/shared/file-lock.d.ts +56 -0
  179. package/dist/hooks/shared/file-lock.js +253 -0
  180. package/dist/hooks/shared/hook-response.d.ts +33 -0
  181. package/dist/hooks/shared/hook-response.js +62 -0
  182. package/dist/hooks/shared/injection-caps.d.ts +39 -0
  183. package/dist/hooks/shared/injection-caps.js +52 -0
  184. package/dist/hooks/shared/plugin-signal.d.ts +23 -0
  185. package/dist/hooks/shared/plugin-signal.js +104 -0
  186. package/dist/hooks/shared/read-stdin.d.ts +8 -0
  187. package/dist/hooks/shared/read-stdin.js +63 -0
  188. package/dist/hooks/shared/sanitize-id.d.ts +7 -0
  189. package/dist/hooks/shared/sanitize-id.js +9 -0
  190. package/dist/hooks/shared/sanitize.d.ts +7 -0
  191. package/dist/hooks/shared/sanitize.js +22 -0
  192. package/dist/hooks/skill-injector.d.ts +38 -0
  193. package/dist/hooks/skill-injector.js +285 -0
  194. package/dist/hooks/slop-detector.d.ts +18 -0
  195. package/dist/hooks/slop-detector.js +93 -0
  196. package/dist/hooks/solution-injector.d.ts +58 -0
  197. package/dist/hooks/solution-injector.js +436 -0
  198. package/dist/hooks/subagent-tracker.d.ts +10 -0
  199. package/dist/hooks/subagent-tracker.js +90 -0
  200. package/dist/i18n/index.d.ts +43 -0
  201. package/dist/i18n/index.js +224 -0
  202. package/dist/lib.d.ts +14 -0
  203. package/dist/lib.js +14 -0
  204. package/dist/mcp/server.d.ts +8 -0
  205. package/dist/mcp/server.js +40 -0
  206. package/dist/mcp/solution-reader.d.ts +90 -0
  207. package/dist/mcp/solution-reader.js +273 -0
  208. package/dist/mcp/tools.d.ts +16 -0
  209. package/dist/mcp/tools.js +302 -0
  210. package/dist/preset/facet-catalog.d.ts +17 -0
  211. package/dist/preset/facet-catalog.js +46 -0
  212. package/dist/preset/preset-manager.d.ts +31 -0
  213. package/dist/preset/preset-manager.js +111 -0
  214. package/dist/renderer/inspect-renderer.d.ts +11 -0
  215. package/dist/renderer/inspect-renderer.js +123 -0
  216. package/dist/renderer/rule-renderer.d.ts +18 -0
  217. package/dist/renderer/rule-renderer.js +159 -0
  218. package/dist/store/evidence-store.d.ts +23 -0
  219. package/dist/store/evidence-store.js +58 -0
  220. package/dist/store/profile-store.d.ts +12 -0
  221. package/dist/store/profile-store.js +53 -0
  222. package/dist/store/recommendation-store.d.ts +22 -0
  223. package/dist/store/recommendation-store.js +64 -0
  224. package/dist/store/rule-store.d.ts +22 -0
  225. package/dist/store/rule-store.js +62 -0
  226. package/dist/store/session-state-store.d.ts +11 -0
  227. package/dist/store/session-state-store.js +44 -0
  228. package/dist/store/types.d.ts +159 -0
  229. package/dist/store/types.js +7 -0
  230. package/hooks/hook-registry.json +21 -0
  231. package/hooks/hooks.json +185 -0
  232. package/package.json +89 -0
  233. package/plugin.json +20 -0
  234. package/scripts/postinstall.js +826 -0
  235. package/skills/api-design/SKILL.md +262 -0
  236. package/skills/architecture-decision/SKILL.md +309 -0
  237. package/skills/ci-cd/SKILL.md +264 -0
  238. package/skills/code-review/SKILL.md +228 -0
  239. package/skills/compound/SKILL.md +101 -0
  240. package/skills/database/SKILL.md +257 -0
  241. package/skills/debug-detective/SKILL.md +95 -0
  242. package/skills/docker/SKILL.md +268 -0
  243. package/skills/documentation/SKILL.md +270 -0
  244. package/skills/ecomode/SKILL.md +46 -0
  245. package/skills/frontend/SKILL.md +265 -0
  246. package/skills/git-master/SKILL.md +86 -0
  247. package/skills/incident-response/SKILL.md +286 -0
  248. package/skills/migrate/SKILL.md +96 -0
  249. package/skills/performance/SKILL.md +282 -0
  250. package/skills/refactor/SKILL.md +100 -0
  251. package/skills/security-review/SKILL.md +282 -0
  252. package/skills/tdd/SKILL.md +178 -0
  253. package/skills/testing-strategy/SKILL.md +260 -0
  254. package/starter-pack/solutions/starter-api-error-responses.md +37 -0
  255. package/starter-pack/solutions/starter-async-patterns.md +40 -0
  256. package/starter-pack/solutions/starter-caching-strategy.md +40 -0
  257. package/starter-pack/solutions/starter-code-review-checklist.md +39 -0
  258. package/starter-pack/solutions/starter-debugging-systematic.md +40 -0
  259. package/starter-pack/solutions/starter-dependency-injection.md +40 -0
  260. package/starter-pack/solutions/starter-error-handling-patterns.md +38 -0
  261. package/starter-pack/solutions/starter-git-atomic-commits.md +36 -0
  262. package/starter-pack/solutions/starter-input-validation.md +40 -0
  263. package/starter-pack/solutions/starter-n-plus-one-queries.md +37 -0
  264. package/starter-pack/solutions/starter-refactor-safely.md +38 -0
  265. package/starter-pack/solutions/starter-secret-management.md +37 -0
  266. package/starter-pack/solutions/starter-separation-of-concerns.md +36 -0
  267. package/starter-pack/solutions/starter-tdd-red-green-refactor.md +40 -0
  268. package/starter-pack/solutions/starter-typescript-strict-types.md +39 -0
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: refactor
3
+ description: This skill should be used when the user asks to "refactor,리팩토링,리팩터,코드정리". Safe refactoring with test-first approach and SOLID principles
4
+ ---
5
+
6
+ <Purpose>
7
+ 테스트 확보→변경→검증의 3단계를 통해 기능을 유지하면서 코드 구조를 개선합니다.
8
+ 코드 스멜 식별, SOLID 원칙 적용, 리팩토링 카탈로그를 활용해 체계적으로 진행합니다.
9
+ </Purpose>
10
+
11
+ <Steps>
12
+ 1. **테스트 확보 (Test First)**
13
+ - 리팩토링 전 기존 동작을 테스트로 고정
14
+ - 테스트 없는 코드: 특성화 테스트(Characterization Test) 먼저 작성
15
+ ```typescript
16
+ // 현재 동작을 그대로 문서화하는 테스트
17
+ it('현재 동작 특성화', () => {
18
+ expect(legacyFunction(input)).toMatchSnapshot();
19
+ });
20
+ ```
21
+ - 커버리지 확인: 변경할 코드 경로가 모두 테스트에 포함됐는지 검증
22
+
23
+ 2. **코드 스멜 식별**
24
+ - **긴 함수**: 50줄 초과 → 추출(Extract) 대상
25
+ - **중복 코드**: DRY 원칙 위반 → 공통 추출
26
+ - **복잡한 조건**: 중첩 if/else 3단계 초과 → Early Return 또는 전략 패턴
27
+ - **긴 매개변수 목록**: 4개 초과 → 객체로 묶기
28
+ - **거대한 클래스**: 단일 책임 원칙 위반 → 분리
29
+ - **주석으로 설명이 필요한 코드**: 코드 자체를 명확하게 개선
30
+
31
+ 3. **SOLID 원칙 적용**
32
+ - **S** (단일 책임): 클래스/함수는 하나의 이유로만 변경
33
+ - **O** (개방-폐쇄): 확장에 열려 있고 수정에 닫혀 있도록 설계
34
+ - **L** (리스코프 치환): 하위 타입은 상위 타입을 완전히 대체 가능
35
+ - **I** (인터페이스 분리): 사용하지 않는 메서드를 강요하지 않음
36
+ - **D** (의존성 역전): 구체 클래스가 아닌 추상화에 의존
37
+
38
+ 4. **리팩토링 카탈로그 (Fowler)**
39
+ - **Extract Method**: 코드 블록을 독립적인 함수로 추출
40
+ ```typescript
41
+ // Before
42
+ function processOrder(order) {
43
+ // 가격 계산 (20줄)
44
+ let total = 0;
45
+ for (const item of order.items) { total += item.price * item.qty; }
46
+ // ...
47
+ }
48
+ // After
49
+ function processOrder(order) {
50
+ const total = calculateTotal(order.items);
51
+ // ...
52
+ }
53
+ function calculateTotal(items) { /* ... */ }
54
+ ```
55
+ - **Move Method**: 다른 클래스에서 더 많이 사용하는 메서드 이동
56
+ - **Replace Conditional with Polymorphism**: switch/if-else 체인 → 다형성
57
+ ```typescript
58
+ // Before: if (type === 'A') ... else if (type === 'B') ...
59
+ // After: strategy[type].execute()
60
+ ```
61
+ - **Introduce Parameter Object**: 매개변수 그룹 → 객체
62
+ - **Replace Magic Number with Constant**: 리터럴 → 명명된 상수
63
+ - **Inline Variable**: 불필요한 중간 변수 제거
64
+
65
+ 5. **변경 (Refactor)**
66
+ - 한 번에 하나의 리팩토링만 적용
67
+ - 각 단계 후 테스트 실행 (`npm test` / `vitest run`)
68
+ - 작은 커밋으로 이력 추적: `refactor: Extract calculateTotal from processOrder`
69
+ - 동작 변경과 구조 변경을 같은 커밋에 섞지 않음
70
+
71
+ 6. **검증 (Verify)**
72
+ - 전체 테스트 스위트 통과 확인
73
+ - 타입 검사: `tsc --noEmit`
74
+ - 린트: `eslint src/`
75
+ - 성능 회귀 없음 확인 (주요 경로 벤치마크)
76
+ </Steps>
77
+
78
+ <Policy>
79
+ - 리팩토링과 기능 추가를 동시에 하지 않는다
80
+ - 테스트 없이 리팩토링 시작 금지
81
+ - 각 단계 후 테스트 통과 확인 필수
82
+ - 한 세션에서 수정하는 파일은 최대 5개로 제한
83
+ </Policy>
84
+
85
+ <Arguments>
86
+ ## 사용법
87
+ `/forgen:refactor {리팩토링 대상}`
88
+
89
+ ### 예시
90
+ - `/forgen:refactor src/services/PaymentService.ts — 200줄 함수 분리`
91
+ - `/forgen:refactor 주문 처리 로직의 중복 코드 제거`
92
+ - `/forgen:refactor UserController를 SOLID 원칙에 맞게 재설계`
93
+
94
+ ### 인자
95
+ - 리팩토링할 파일/함수/모듈 명시
96
+ - 목표 (성능, 가독성, 유지보수성, 특정 패턴 적용)
97
+ - 제약 조건 (하위 호환성 유지, 특정 인터페이스 유지 등)
98
+ </Arguments>
99
+
100
+ $ARGUMENTS
@@ -0,0 +1,282 @@
1
+ ---
2
+ name: security-review
3
+ description: This skill should be used when the user asks to "security review,보안 리뷰,보안 검토,security audit,취약점 점검". Security-focused code audit with OWASP Top 10 and supply chain checks
4
+ ---
5
+
6
+ <Purpose>
7
+ 보안 중심 코드 감사를 수행합니다. OWASP Top 10, 공급망 보안,
8
+ 시크릿 노출, 안전하지 않은 패턴을 체계적으로 점검합니다.
9
+ </Purpose>
10
+
11
+ <Steps>
12
+ 1. **OWASP Top 10 전체 스캔**
13
+ - A01: Broken Access Control — 접근 제어 우회, 권한 에스컬레이션
14
+ - A02: Cryptographic Failures — 약한 해싱(MD5/SHA1), 평문 전송, 키 노출
15
+ - A03: Injection — SQL, NoSQL, Command, XSS, LDAP 인젝션
16
+ - A04: Insecure Design — 보안이 고려되지 않은 설계, 위협 모델링 부재
17
+ - A05: Security Misconfiguration — 기본 설정 미변경, 불필요한 기능 활성화, 에러 정보 노출
18
+ - A06: Vulnerable and Outdated Components — 알려진 CVE가 있는 의존성 사용
19
+ - A07: Identification and Authentication Failures — 약한 인증, 세션 고정, 크리덴셜 스터핑
20
+ - A08: Software and Data Integrity Failures — 서명 미검증, 안전하지 않은 역직렬화
21
+ - A09: Security Logging and Monitoring Failures — 로깅 부재, 침입 탐지 미흡
22
+ - A10: Server-Side Request Forgery (SSRF) — 서버에서 외부 URL 요청 시 검증 부재
23
+
24
+ 2. **시크릿 탐지**
25
+ - 하드코딩된 API 키, 비밀번호, 토큰
26
+ - 개인 키(private key)가 레포에 포함되었는지
27
+ - 커넥션 스트링에 시크릿 포함 여부
28
+ - .env, credentials 파일 커밋 여부
29
+ - 로그에 민감 정보 출력
30
+
31
+ 3. **입력 검증**
32
+ - 모든 외부 입력의 살균/검증 확인
33
+ - SQL/NoSQL Injection 방지 (파라미터화 쿼리)
34
+ - Command Injection 방지
35
+ - XSS 방지 (출력 이스케이핑)
36
+ - Path Traversal 방지
37
+ - SSRF 방지 (URL 화이트리스트)
38
+
39
+ 4. **인증/인가**
40
+ - 비밀번호 해싱 (bcrypt, argon2 등 강력한 알고리즘)
41
+ - 세션 관리 보안 (토큰 암호학적 난수 생성)
42
+ - JWT 구현 보안 (서명 검증, 만료 설정)
43
+ - 접근 제어가 모든 보호 리소스에 적용되는지
44
+
45
+ 5. **암호화**
46
+ - 강력한 알고리즘 사용 (AES-256, RSA-2048+)
47
+ - 적절한 키 관리
48
+ - 암호학적으로 안전한 난수 생성
49
+ - TLS/HTTPS 강제 적용
50
+
51
+ 6. **의존성 보안**
52
+ - `npm audit` 실행하여 알려진 취약점 검사
53
+ - 오래된 의존성 확인
54
+ - CRITICAL/HIGH CVE 식별
55
+ - 의존성 출처 검증
56
+ - 의심스러운 패키지, 과도한 권한 요구 점검
57
+ </Steps>
58
+
59
+ ## 에이전트 위임
60
+
61
+ `security-reviewer` 에이전트(Opus 모델)에 위임하여 심층 보안 분석을 수행합니다:
62
+
63
+ ```
64
+ Agent(
65
+ subagent_type="security-reviewer",
66
+ model="opus",
67
+ prompt="SECURITY REVIEW TASK
68
+
69
+ 보안 감사를 수행하세요.
70
+
71
+ Scope: [특정 파일 또는 전체 코드베이스]
72
+
73
+ Security Checklist:
74
+ 1. OWASP Top 10 전체 스캔 (A01~A10)
75
+ 2. 하드코딩된 시크릿 탐지
76
+ 3. 입력 검증 검토
77
+ 4. 인증/인가 검토
78
+ 5. 의존성 취약점 스캔 (npm audit)
79
+
80
+ Output: 보안 리뷰 리포트:
81
+ - 심각도별 발견 사항 요약 (CRITICAL, HIGH, MEDIUM, LOW)
82
+ - 구체적인 파일:라인 위치
83
+ - CVE 참조 (해당 시)
84
+ - 각 이슈별 수정 방안
85
+ - 전체 보안 상태 평가"
86
+ )
87
+ ```
88
+
89
+ ## External Consultation (Optional)
90
+
91
+ security-reviewer 에이전트는 교차 검증을 위해 Claude Task 에이전트에 자문할 수 있습니다.
92
+
93
+ ### Protocol
94
+ 1. **자체 보안 분석을 먼저 완료** — 독립적으로 리뷰 수행
95
+ 2. **검증을 위한 자문** — Claude Task 에이전트를 통해 발견 사항 교차 확인
96
+ 3. **비판적 평가** — 외부 발견 사항을 맹목적으로 수용하지 않음
97
+ 4. **우아한 폴백** — 위임이 불가능할 경우 절대 차단하지 않음
98
+
99
+ ### 자문이 필요한 경우
100
+ - 인증/인가 코드
101
+ - 암호화 구현
102
+ - 신뢰할 수 없는 데이터의 입력 검증
103
+ - 고위험 취약점 패턴
104
+ - 프로덕션 배포 코드
105
+
106
+ ### 자문을 생략하는 경우
107
+ - 저위험 유틸리티 코드
108
+ - 이미 감사된 패턴
109
+ - 시간이 촉박한 보안 평가
110
+ - 기존 보안 테스트가 있는 코드
111
+
112
+ **참고:** 보안 세컨드 오피니언은 높은 가치를 가집니다. CRITICAL/HIGH 발견 시 자문을 고려하세요.
113
+
114
+ ## 보안 체크리스트
115
+
116
+ ### 인증 및 인가
117
+ - [ ] 비밀번호가 강력한 알고리즘으로 해싱 (bcrypt/argon2)
118
+ - [ ] 세션 토큰이 암호학적으로 무작위
119
+ - [ ] JWT 토큰이 적절히 서명 및 검증됨
120
+ - [ ] 모든 보호 리소스에 접근 제어 적용
121
+ - [ ] 인증 우회 취약점 없음
122
+
123
+ ### 입력 검증
124
+ - [ ] 모든 사용자 입력이 검증 및 살균됨
125
+ - [ ] SQL 쿼리가 파라미터화 사용 (문자열 연결 금지)
126
+ - [ ] NoSQL 쿼리 인젝션 방지
127
+ - [ ] 파일 업로드 검증 (타입, 크기, 콘텐츠)
128
+ - [ ] URL 검증으로 SSRF 방지
129
+
130
+ ### 출력 인코딩
131
+ - [ ] HTML 출력이 XSS 방지를 위해 이스케이핑됨
132
+ - [ ] JSON 응답이 적절히 인코딩됨
133
+ - [ ] 에러 메시지에 사용자 데이터 미포함
134
+ - [ ] Content-Security-Policy 헤더 설정
135
+
136
+ ### 시크릿 관리
137
+ - [ ] 하드코딩된 API 키 없음
138
+ - [ ] 소스 코드에 비밀번호 없음
139
+ - [ ] 레포에 개인 키 없음
140
+ - [ ] 시크릿은 환경변수로 관리
141
+ - [ ] 시크릿이 로그나 에러에 노출되지 않음
142
+
143
+ ### 암호화
144
+ - [ ] 강력한 알고리즘 사용 (AES-256, RSA-2048+)
145
+ - [ ] 적절한 키 관리
146
+ - [ ] 암호학적으로 안전한 난수 생성
147
+ - [ ] 민감 데이터에 TLS/HTTPS 강제
148
+
149
+ ### 의존성
150
+ - [ ] 의존성에 알려진 취약점 없음
151
+ - [ ] 의존성이 최신 상태
152
+ - [ ] CRITICAL 또는 HIGH CVE 없음
153
+ - [ ] 의존성 출처 검증됨
154
+
155
+ ## 심각도 정의
156
+
157
+ | 심각도 | 설명 |
158
+ |--------|------|
159
+ | **CRITICAL** | 악용 가능한 취약점으로 심각한 영향 (데이터 유출, RCE, 크리덴셜 탈취) |
160
+ | **HIGH** | 특정 조건이 필요하지만 심각한 영향을 주는 취약점 |
161
+ | **MEDIUM** | 제한적 영향 또는 악용이 어려운 보안 약점 |
162
+ | **LOW** | 모범 사례 위반 또는 경미한 보안 우려 |
163
+
164
+ ## Remediation Priority (수정 우선순위)
165
+
166
+ | 우선순위 | 타임라인 | 대상 |
167
+ |----------|----------|------|
168
+ | 1. 노출된 시크릿 교체 | **즉시 (1시간 이내)** | 하드코딩된 키, 비밀번호, 토큰 |
169
+ | 2. CRITICAL 수정 | **긴급 (24시간 이내)** | 악용 가능한 취약점 |
170
+ | 3. HIGH 수정 | **중요 (1주일 이내)** | 조건부 취약점 |
171
+ | 4. MEDIUM 수정 | **계획 (1개월 이내)** | 보안 약점 |
172
+ | 5. LOW 수정 | **백로그 (여유 시)** | 모범 사례 위반 |
173
+
174
+ <Output>
175
+ ```
176
+ SECURITY REVIEW REPORT / 보안 리뷰 리포트
177
+ ==========================================
178
+
179
+ Scope: [전체 코드베이스 / 특정 디렉토리] (N개 파일 스캔)
180
+ Scan Date: YYYY-MM-DDTHH:MM:SSZ
181
+
182
+ CRITICAL (N)
183
+ ------------
184
+ 1. src/api/auth.ts:89 - 하드코딩된 API 키
185
+ Finding: AWS API 키가 소스 코드에 하드코딩됨
186
+ Impact: 코드 공개 또는 유출 시 크리덴셜 노출
187
+ Remediation: 환경변수로 이동, 키 즉시 교체
188
+ Reference: OWASP A02:2021 - Cryptographic Failures
189
+ CVE: (해당 시 CVE 번호)
190
+
191
+ 2. src/db/query.ts:45 - SQL Injection 취약점
192
+ Finding: 사용자 입력이 SQL 쿼리에 직접 연결됨
193
+ Impact: 공격자가 임의의 SQL 명령을 실행 가능
194
+ Remediation: 파라미터화 쿼리 또는 ORM 사용
195
+ Reference: OWASP A03:2021 - Injection
196
+
197
+ HIGH (N)
198
+ --------
199
+ ...
200
+
201
+ MEDIUM (N)
202
+ ----------
203
+ ...
204
+
205
+ LOW (N)
206
+ -------
207
+ ...
208
+
209
+ DEPENDENCY VULNERABILITIES / 의존성 취약점
210
+ ------------------------------------------
211
+ Found N vulnerabilities via npm audit:
212
+
213
+ CRITICAL: axios@0.21.0 - Server-Side Request Forgery (CVE-2021-3749)
214
+ Installed: axios@0.21.0
215
+ Fix: npm install axios@0.21.2
216
+
217
+ HIGH: lodash@4.17.19 - Prototype Pollution (CVE-2020-8203)
218
+ Installed: lodash@4.17.19
219
+ Fix: npm install lodash@4.17.21
220
+
221
+ ...
222
+
223
+ OVERALL ASSESSMENT / 종합 평가
224
+ -------------------------------
225
+ Security Posture: [EXCELLENT / GOOD / FAIR / POOR]
226
+ (N CRITICAL, N HIGH issues)
227
+
228
+ Immediate Actions Required:
229
+ 1. [즉시 조치 사항]
230
+ 2. [긴급 수정 사항]
231
+
232
+ Recommendation: [배포 가능 / CRITICAL 및 HIGH 이슈 해결 전 배포 금지]
233
+ ```
234
+ </Output>
235
+
236
+ <Policy>
237
+ - 취약점 발견 시 구체적인 공격 시나리오와 수정 방안을 함께 제시
238
+ - False positive를 최소화하되, 의심스러운 패턴은 빠짐없이 보고
239
+ - 보안 수정은 기능 동작에 영향을 주지 않도록 주의
240
+ - OWASP A01~A10 각 항목에 대해 명시적으로 검사 수행
241
+ - npm audit을 반드시 실행하여 의존성 취약점을 정량적으로 보고
242
+ - CVE 참조를 가능한 한 포함하여 추적 가능성 확보
243
+ </Policy>
244
+
245
+ ## 다른 스킬과의 연동
246
+
247
+ **Pipeline 연동:**
248
+ ```
249
+ /forgen:pipeline security "인증 모듈 리뷰"
250
+ ```
251
+ 사용 흐름: explore -> security-reviewer -> executor -> security-reviewer (재검증)
252
+
253
+ **팀 기반 병렬 리뷰:**
254
+ ```
255
+ /forgen:team 4:security-reviewer "모든 API 엔드포인트 감사"
256
+ ```
257
+ 여러 엔드포인트에 대해 병렬 보안 리뷰 수행
258
+
259
+ ## Best Practices
260
+
261
+ - **조기 리뷰** — 보안은 사후 점검이 아닌 설계 단계부터
262
+ - **자주 리뷰** — 주요 기능 변경이나 API 변경마다
263
+ - **자동화** — CI/CD 파이프라인에서 보안 스캔 실행
264
+ - **즉시 수정** — 보안 부채를 축적하지 않음
265
+ - **수정 검증** — 수정 후 반드시 보안 리뷰 재실행
266
+
267
+ <Arguments>
268
+ ## 사용법
269
+ `/forgen:security-review {점검 대상}`
270
+
271
+ ### 예시
272
+ - `/forgen:security-review` (기본: 전체 프로젝트)
273
+ - `/forgen:security-review src/api/`
274
+ - `/forgen:security-review 인증 관련 코드만 집중 점검`
275
+ - `/forgen:security-review 최근 변경사항의 보안 영향 분석`
276
+
277
+ ### 인자
278
+ - 디렉토리, 파일, 또는 관심 영역을 지정
279
+ - 인자 없으면 프로젝트 전체를 점검
280
+ </Arguments>
281
+
282
+ $ARGUMENTS
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: tdd
3
+ description: This skill should be used when the user asks to "tdd,test first,테스트 먼저,테스트 주도". Test-Driven Development workflow with Red-Green-Refactor cycle
4
+ ---
5
+
6
+ <Purpose>
7
+ TDD(Test-Driven Development) 워크플로우를 실행합니다.
8
+ Red-Green-Refactor 사이클을 통해 견고한 코드를 점진적으로 구축합니다.
9
+ </Purpose>
10
+
11
+ ## The Iron Law / 철의 법칙
12
+
13
+ **실패하는 테스트 없이 프로덕션 코드를 작성하지 않는다**
14
+
15
+ 테스트 전에 코드를 작성했다면? **삭제하고 처음부터 다시 시작한다.** 예외 없음.
16
+
17
+ <Steps>
18
+ 1. **RED**: 실패하는 테스트를 먼저 작성합니다
19
+ - 요구사항을 테스트 케이스로 변환
20
+ - 엣지 케이스와 에러 케이스 포함
21
+ - 테스트 실행 — **반드시 실패해야 함**
22
+ - 첫 실행에 통과하면 테스트가 잘못된 것 — 수정 필요
23
+
24
+ 2. **GREEN**: 테스트를 통과하는 최소한의 코드를 작성합니다
25
+ - 가장 단순한 구현으로 시작
26
+ - "하는 김에" 추가 기능 금지
27
+ - 모든 테스트가 통과하는 것을 확인
28
+ - 불필요한 최적화나 추상화는 하지 않음
29
+
30
+ 3. **REFACTOR**: 코드를 정리합니다
31
+ - 중복 제거
32
+ - 네이밍 개선
33
+ - 필요 시 추상화 도입
34
+ - **변경할 때마다** 테스트 실행
35
+ - 모든 테스트가 여전히 통과해야 함
36
+
37
+ 4. **REPEAT**: 다음 요구사항으로 사이클 반복
38
+ </Steps>
39
+
40
+ ## Enforcement Rules / 시행 규칙
41
+
42
+ | 감지 상황 | 조치 |
43
+ |-----------|------|
44
+ | 테스트보다 코드가 먼저 작성됨 | **중단. 코드 삭제. 테스트 먼저 작성.** |
45
+ | 테스트가 첫 실행에 통과 | **테스트가 잘못됨. 실패하도록 수정.** |
46
+ | 한 사이클에 여러 기능 | **중단. 하나의 테스트, 하나의 기능.** |
47
+ | Refactor 단계 건너뜀 | **돌아가서 정리. 다음 기능 전에 리팩터.** |
48
+ | Refactor에서 동작 변경 | **중단. Refactor는 동작 보존만.** |
49
+ | 테스트를 수정하여 통과시킴 | **금지. 테스트는 요구사항. 코드를 수정.** |
50
+
51
+ ## 에이전트 위임
52
+
53
+ `test-engineer` 에이전트에 위임하여 TDD 사이클을 수행합니다:
54
+
55
+ ```
56
+ Agent(
57
+ subagent_type="test-engineer",
58
+ model="opus",
59
+ prompt="TDD TASK
60
+
61
+ Red-Green-Refactor 사이클로 기능을 구현하세요.
62
+
63
+ Feature: [구현할 기능]
64
+
65
+ Iron Law: 실패하는 테스트 없이 프로덕션 코드를 절대 작성하지 않는다.
66
+
67
+ 각 사이클에서:
68
+ 1. RED: 실패하는 테스트 작성 및 실행 (실패 확인)
69
+ 2. GREEN: 최소한의 코드로 테스트 통과
70
+ 3. REFACTOR: 코드 정리 (테스트 유지)
71
+
72
+ Output: 각 사이클별 RED/GREEN/REFACTOR 결과 리포트"
73
+ )
74
+ ```
75
+
76
+ ## External Consultation (Optional)
77
+
78
+ test-engineer 에이전트는 테스트 전략 검증을 위해 Claude Task 에이전트에 자문할 수 있습니다.
79
+
80
+ ### Protocol
81
+ 1. **자체 테스트 전략을 먼저 수립** — 독립적으로 테스트 설계
82
+ 2. **검증을 위한 자문** — Claude Task 에이전트를 통해 테스트 커버리지 전략 교차 확인
83
+ 3. **비판적 평가** — 외부 제안을 맹목적으로 수용하지 않음
84
+ 4. **우아한 폴백** — 위임이 불가능할 경우 절대 차단하지 않음
85
+
86
+ ### 자문이 필요한 경우
87
+ - 복잡한 도메인 로직의 포괄적 테스트 커버리지
88
+ - 핵심 경로의 엣지 케이스 식별
89
+ - 대규모 기능의 테스트 아키텍처
90
+ - 익숙하지 않은 테스팅 패턴
91
+
92
+ ### 자문을 생략하는 경우
93
+ - 단순 유닛 테스트
94
+ - 잘 알려진 테스팅 패턴
95
+ - 시간이 촉박한 TDD 사이클
96
+ - 작고 격리된 기능
97
+
98
+ ## Phase별 출력 형식 템플릿
99
+
100
+ ```
101
+ ## TDD Cycle: [기능 이름]
102
+
103
+ === RED Phase ===
104
+ Test File: [테스트 파일 경로]
105
+ Test Code:
106
+ [테스트 코드]
107
+
108
+ Expected Failure: [예상되는 에러 메시지]
109
+ Actual Result:
110
+ FAIL: [실제 실행 결과]
111
+ X failing, Y passing
112
+
113
+ Status: RED (테스트 실패 확인)
114
+
115
+ === GREEN Phase ===
116
+ Implementation File: [구현 파일 경로]
117
+ Implementation Code:
118
+ [최소한의 구현 코드]
119
+
120
+ Test Result:
121
+ PASS: [실행 결과]
122
+ All tests passing
123
+
124
+ Status: GREEN (테스트 통과 확인)
125
+
126
+ === REFACTOR Phase ===
127
+ Changes:
128
+ - [변경 사항 1]
129
+ - [변경 사항 2]
130
+
131
+ Test Result:
132
+ PASS: All tests still passing
133
+
134
+ Status: REFACTOR COMPLETE
135
+
136
+ === Cycle Summary ===
137
+ Feature: [구현된 기능]
138
+ Tests Added: N
139
+ Tests Passing: N/N
140
+ Next: [다음 사이클 기능]
141
+ ```
142
+
143
+ ## 명령어
144
+
145
+ 각 구현 전:
146
+ ```bash
147
+ # 프로젝트의 테스트 명령어 실행 — 새 실패 테스트가 하나여야 함
148
+ ```
149
+
150
+ 구현 후:
151
+ ```bash
152
+ # 프로젝트의 테스트 명령어 실행 — 새 테스트 통과, 기존 테스트도 모두 통과
153
+ ```
154
+
155
+ <Policy>
156
+ - 테스트 없이 프로덕션 코드를 작성하지 않습니다
157
+ - 한 번에 하나의 실패하는 테스트만 추가합니다
158
+ - Refactor 단계에서 동작을 변경하지 않습니다
159
+ - 매 사이클 완료 후 테스트 스위트 전체 실행
160
+ - 테스트를 수정하여 통과시키는 행위는 금지 (test hack 금지)
161
+ - 규율 자체가 가치입니다 — 지름길은 이점을 파괴합니다
162
+ </Policy>
163
+
164
+ <Arguments>
165
+ ## 사용법
166
+ `/forgen:tdd {구현할 기능}`
167
+
168
+ ### 예시
169
+ - `/forgen:tdd 이메일 유효성 검증 함수`
170
+ - `/forgen:tdd 장바구니 할인 계산 로직`
171
+ - `/forgen:tdd src/utils/parser.ts에 JSON 파싱 에러 핸들링 추가`
172
+
173
+ ### 인자
174
+ - 구현할 기능이나 요구사항을 설명
175
+ - 테스트 프레임워크는 프로젝트 설정에서 자동 감지 (jest, vitest 등)
176
+ </Arguments>
177
+
178
+ $ARGUMENTS