devflow-kit 0.9.0 → 1.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 (414) hide show
  1. package/CHANGELOG.md +197 -29
  2. package/LICENSE +1 -1
  3. package/README.md +185 -309
  4. package/dist/cli.js +7 -1
  5. package/dist/commands/ambient.d.ts +18 -0
  6. package/dist/commands/ambient.js +136 -0
  7. package/dist/commands/init.d.ts +23 -0
  8. package/dist/commands/init.js +393 -571
  9. package/dist/commands/list.d.ts +3 -0
  10. package/dist/commands/list.js +20 -0
  11. package/dist/commands/memory.d.ts +22 -0
  12. package/dist/commands/memory.js +175 -0
  13. package/dist/commands/uninstall.d.ts +10 -0
  14. package/dist/commands/uninstall.js +418 -78
  15. package/dist/plugins.d.ts +46 -0
  16. package/dist/plugins.js +169 -0
  17. package/dist/utils/cli.d.ts +5 -0
  18. package/dist/utils/cli.js +14 -0
  19. package/dist/utils/installer.d.ts +41 -0
  20. package/dist/utils/installer.js +177 -0
  21. package/dist/utils/paths.d.ts +10 -0
  22. package/dist/utils/paths.js +23 -3
  23. package/dist/utils/post-install.d.ts +80 -0
  24. package/dist/utils/post-install.js +508 -0
  25. package/dist/utils/safe-delete-install.d.ts +29 -0
  26. package/dist/utils/safe-delete-install.js +191 -0
  27. package/dist/utils/safe-delete.d.ts +12 -0
  28. package/dist/utils/safe-delete.js +83 -0
  29. package/package.json +18 -8
  30. package/plugins/devflow-ambient/.claude-plugin/plugin.json +7 -0
  31. package/plugins/devflow-ambient/README.md +49 -0
  32. package/plugins/devflow-ambient/commands/ambient.md +110 -0
  33. package/plugins/devflow-ambient/skills/ambient-router/SKILL.md +89 -0
  34. package/plugins/devflow-ambient/skills/ambient-router/references/skill-catalog.md +64 -0
  35. package/plugins/devflow-audit-claude/.claude-plugin/plugin.json +7 -0
  36. package/plugins/devflow-audit-claude/README.md +46 -0
  37. package/plugins/devflow-audit-claude/agents/claude-md-auditor.md +134 -0
  38. package/plugins/devflow-audit-claude/commands/audit-claude.md +85 -0
  39. package/plugins/devflow-code-review/.claude-plugin/plugin.json +31 -0
  40. package/plugins/devflow-code-review/README.md +73 -0
  41. package/plugins/devflow-code-review/agents/git.md +272 -0
  42. package/plugins/devflow-code-review/agents/reviewer.md +119 -0
  43. package/plugins/devflow-code-review/agents/synthesizer.md +204 -0
  44. package/plugins/devflow-code-review/commands/code-review-teams.md +262 -0
  45. package/plugins/devflow-code-review/commands/code-review.md +141 -0
  46. package/plugins/devflow-code-review/skills/accessibility/SKILL.md +229 -0
  47. package/plugins/devflow-code-review/skills/accessibility/references/detection.md +171 -0
  48. package/plugins/devflow-code-review/skills/accessibility/references/patterns.md +670 -0
  49. package/plugins/devflow-code-review/skills/accessibility/references/violations.md +419 -0
  50. package/plugins/devflow-code-review/skills/agent-teams/SKILL.md +124 -0
  51. package/plugins/devflow-code-review/skills/agent-teams/references/cleanup.md +104 -0
  52. package/plugins/devflow-code-review/skills/agent-teams/references/communication.md +122 -0
  53. package/plugins/devflow-code-review/skills/agent-teams/references/team-patterns.md +217 -0
  54. package/plugins/devflow-code-review/skills/architecture-patterns/SKILL.md +153 -0
  55. package/plugins/devflow-code-review/skills/architecture-patterns/references/detection.md +337 -0
  56. package/plugins/devflow-code-review/skills/architecture-patterns/references/patterns.md +873 -0
  57. package/plugins/devflow-code-review/skills/architecture-patterns/references/violations.md +575 -0
  58. package/plugins/devflow-code-review/skills/complexity-patterns/SKILL.md +143 -0
  59. package/plugins/devflow-code-review/skills/complexity-patterns/references/detection.md +264 -0
  60. package/plugins/devflow-code-review/skills/complexity-patterns/references/patterns.md +487 -0
  61. package/plugins/devflow-code-review/skills/complexity-patterns/references/violations.md +361 -0
  62. package/plugins/devflow-code-review/skills/consistency-patterns/SKILL.md +140 -0
  63. package/plugins/devflow-code-review/skills/consistency-patterns/references/detection.md +207 -0
  64. package/plugins/devflow-code-review/skills/consistency-patterns/references/patterns.md +202 -0
  65. package/plugins/devflow-code-review/skills/consistency-patterns/references/violations.md +213 -0
  66. package/plugins/devflow-code-review/skills/database-patterns/SKILL.md +134 -0
  67. package/plugins/devflow-code-review/skills/database-patterns/references/detection.md +208 -0
  68. package/plugins/devflow-code-review/skills/database-patterns/references/patterns.md +394 -0
  69. package/plugins/devflow-code-review/skills/database-patterns/references/violations.md +332 -0
  70. package/plugins/devflow-code-review/skills/dependencies-patterns/SKILL.md +141 -0
  71. package/plugins/devflow-code-review/skills/dependencies-patterns/references/detection.md +181 -0
  72. package/plugins/devflow-code-review/skills/dependencies-patterns/references/patterns.md +225 -0
  73. package/plugins/devflow-code-review/skills/dependencies-patterns/references/violations.md +247 -0
  74. package/plugins/devflow-code-review/skills/documentation-patterns/SKILL.md +125 -0
  75. package/plugins/devflow-code-review/skills/documentation-patterns/references/detection.md +190 -0
  76. package/plugins/devflow-code-review/skills/documentation-patterns/references/patterns.md +189 -0
  77. package/plugins/devflow-code-review/skills/documentation-patterns/references/violations.md +163 -0
  78. package/plugins/devflow-code-review/skills/frontend-design/SKILL.md +254 -0
  79. package/plugins/devflow-code-review/skills/frontend-design/references/detection.md +184 -0
  80. package/plugins/devflow-code-review/skills/frontend-design/references/patterns.md +511 -0
  81. package/plugins/devflow-code-review/skills/frontend-design/references/violations.md +453 -0
  82. package/plugins/devflow-code-review/skills/performance-patterns/SKILL.md +154 -0
  83. package/plugins/devflow-code-review/skills/performance-patterns/references/detection.md +351 -0
  84. package/plugins/devflow-code-review/skills/performance-patterns/references/patterns.md +503 -0
  85. package/plugins/devflow-code-review/skills/performance-patterns/references/violations.md +354 -0
  86. package/plugins/devflow-code-review/skills/react/SKILL.md +276 -0
  87. package/plugins/devflow-code-review/skills/react/references/patterns.md +1331 -0
  88. package/plugins/devflow-code-review/skills/react/references/violations.md +565 -0
  89. package/plugins/devflow-code-review/skills/regression-patterns/SKILL.md +146 -0
  90. package/plugins/devflow-code-review/skills/regression-patterns/references/detection.md +237 -0
  91. package/plugins/devflow-code-review/skills/regression-patterns/references/patterns.md +226 -0
  92. package/plugins/devflow-code-review/skills/regression-patterns/references/violations.md +225 -0
  93. package/plugins/devflow-code-review/skills/review-methodology/SKILL.md +119 -0
  94. package/plugins/devflow-code-review/skills/review-methodology/references/patterns.md +186 -0
  95. package/plugins/devflow-code-review/skills/review-methodology/references/report-template.md +142 -0
  96. package/plugins/devflow-code-review/skills/review-methodology/references/violations.md +125 -0
  97. package/plugins/devflow-code-review/skills/security-patterns/SKILL.md +156 -0
  98. package/plugins/devflow-code-review/skills/security-patterns/references/detection.md +287 -0
  99. package/plugins/devflow-code-review/skills/security-patterns/references/patterns.md +507 -0
  100. package/plugins/devflow-code-review/skills/security-patterns/references/violations.md +237 -0
  101. package/plugins/devflow-code-review/skills/test-patterns/SKILL.md +183 -0
  102. package/plugins/devflow-code-review/skills/test-patterns/references/detection.md +149 -0
  103. package/plugins/devflow-code-review/skills/test-patterns/references/patterns.md +220 -0
  104. package/plugins/devflow-code-review/skills/test-patterns/references/report-template.md +108 -0
  105. package/plugins/devflow-code-review/skills/test-patterns/references/violations.md +221 -0
  106. package/plugins/devflow-core-skills/.claude-plugin/plugin.json +28 -0
  107. package/plugins/devflow-core-skills/README.md +50 -0
  108. package/plugins/devflow-core-skills/skills/accessibility/SKILL.md +229 -0
  109. package/plugins/devflow-core-skills/skills/accessibility/references/detection.md +171 -0
  110. package/plugins/devflow-core-skills/skills/accessibility/references/patterns.md +670 -0
  111. package/plugins/devflow-core-skills/skills/accessibility/references/violations.md +419 -0
  112. package/plugins/devflow-core-skills/skills/core-patterns/SKILL.md +162 -0
  113. package/plugins/devflow-core-skills/skills/core-patterns/references/checklist.md +276 -0
  114. package/plugins/devflow-core-skills/skills/core-patterns/references/code-smell-violations.md +144 -0
  115. package/plugins/devflow-core-skills/skills/core-patterns/references/detection.md +303 -0
  116. package/plugins/devflow-core-skills/skills/core-patterns/references/patterns.md +576 -0
  117. package/plugins/devflow-core-skills/skills/core-patterns/references/violations.md +369 -0
  118. package/plugins/devflow-core-skills/skills/docs-framework/SKILL.md +138 -0
  119. package/plugins/devflow-core-skills/skills/docs-framework/references/patterns.md +346 -0
  120. package/plugins/devflow-core-skills/skills/docs-framework/references/violations.md +221 -0
  121. package/plugins/devflow-core-skills/skills/frontend-design/SKILL.md +254 -0
  122. package/plugins/devflow-core-skills/skills/frontend-design/references/detection.md +184 -0
  123. package/plugins/devflow-core-skills/skills/frontend-design/references/patterns.md +511 -0
  124. package/plugins/devflow-core-skills/skills/frontend-design/references/violations.md +453 -0
  125. package/plugins/devflow-core-skills/skills/git-safety/SKILL.md +122 -0
  126. package/plugins/devflow-core-skills/skills/git-safety/references/detection.md +290 -0
  127. package/plugins/devflow-core-skills/skills/git-safety/references/patterns.md +289 -0
  128. package/plugins/devflow-core-skills/skills/git-safety/references/violations.md +18 -0
  129. package/plugins/devflow-core-skills/skills/git-workflow/SKILL.md +158 -0
  130. package/plugins/devflow-core-skills/skills/git-workflow/references/commit-patterns.md +115 -0
  131. package/plugins/devflow-core-skills/skills/git-workflow/references/commit-violations.md +77 -0
  132. package/plugins/devflow-core-skills/skills/git-workflow/references/pr-patterns.md +127 -0
  133. package/plugins/devflow-core-skills/skills/git-workflow/references/pr-violations.md +96 -0
  134. package/plugins/devflow-core-skills/skills/github-patterns/SKILL.md +153 -0
  135. package/plugins/devflow-core-skills/skills/github-patterns/references/patterns.md +572 -0
  136. package/plugins/devflow-core-skills/skills/github-patterns/references/violations.md +298 -0
  137. package/plugins/devflow-core-skills/skills/input-validation/SKILL.md +148 -0
  138. package/plugins/devflow-core-skills/skills/input-validation/references/detection.md +283 -0
  139. package/plugins/devflow-core-skills/skills/input-validation/references/patterns.md +361 -0
  140. package/plugins/devflow-core-skills/skills/input-validation/references/violations.md +224 -0
  141. package/plugins/devflow-core-skills/skills/react/SKILL.md +276 -0
  142. package/plugins/devflow-core-skills/skills/react/references/patterns.md +1331 -0
  143. package/plugins/devflow-core-skills/skills/react/references/violations.md +565 -0
  144. package/plugins/devflow-core-skills/skills/test-driven-development/SKILL.md +139 -0
  145. package/plugins/devflow-core-skills/skills/test-driven-development/references/rationalization-prevention.md +111 -0
  146. package/plugins/devflow-core-skills/skills/test-patterns/SKILL.md +183 -0
  147. package/plugins/devflow-core-skills/skills/test-patterns/references/detection.md +149 -0
  148. package/plugins/devflow-core-skills/skills/test-patterns/references/patterns.md +220 -0
  149. package/plugins/devflow-core-skills/skills/test-patterns/references/report-template.md +108 -0
  150. package/plugins/devflow-core-skills/skills/test-patterns/references/violations.md +221 -0
  151. package/plugins/devflow-core-skills/skills/typescript/SKILL.md +176 -0
  152. package/plugins/devflow-core-skills/skills/typescript/references/patterns.md +1105 -0
  153. package/plugins/devflow-core-skills/skills/typescript/references/violations.md +433 -0
  154. package/plugins/devflow-debug/.claude-plugin/plugin.json +18 -0
  155. package/plugins/devflow-debug/README.md +65 -0
  156. package/plugins/devflow-debug/agents/git.md +272 -0
  157. package/plugins/devflow-debug/commands/debug-teams.md +231 -0
  158. package/plugins/devflow-debug/commands/debug.md +160 -0
  159. package/plugins/devflow-debug/skills/agent-teams/SKILL.md +124 -0
  160. package/plugins/devflow-debug/skills/agent-teams/references/cleanup.md +104 -0
  161. package/plugins/devflow-debug/skills/agent-teams/references/communication.md +122 -0
  162. package/plugins/devflow-debug/skills/agent-teams/references/team-patterns.md +217 -0
  163. package/plugins/devflow-debug/skills/git-safety/SKILL.md +122 -0
  164. package/plugins/devflow-debug/skills/git-safety/references/detection.md +290 -0
  165. package/plugins/devflow-debug/skills/git-safety/references/patterns.md +289 -0
  166. package/plugins/devflow-debug/skills/git-safety/references/violations.md +18 -0
  167. package/plugins/devflow-implement/.claude-plugin/plugin.json +21 -0
  168. package/plugins/devflow-implement/README.md +71 -0
  169. package/plugins/devflow-implement/agents/coder.md +122 -0
  170. package/plugins/devflow-implement/agents/git.md +272 -0
  171. package/plugins/devflow-implement/agents/scrutinizer.md +80 -0
  172. package/plugins/devflow-implement/agents/shepherd.md +94 -0
  173. package/plugins/devflow-implement/agents/simplifier.md +62 -0
  174. package/plugins/devflow-implement/agents/skimmer.md +88 -0
  175. package/plugins/devflow-implement/agents/synthesizer.md +204 -0
  176. package/plugins/devflow-implement/agents/validator.md +86 -0
  177. package/plugins/devflow-implement/commands/implement-teams.md +608 -0
  178. package/plugins/devflow-implement/commands/implement.md +426 -0
  179. package/plugins/devflow-implement/skills/accessibility/SKILL.md +229 -0
  180. package/plugins/devflow-implement/skills/accessibility/references/detection.md +171 -0
  181. package/plugins/devflow-implement/skills/accessibility/references/patterns.md +670 -0
  182. package/plugins/devflow-implement/skills/accessibility/references/violations.md +419 -0
  183. package/plugins/devflow-implement/skills/agent-teams/SKILL.md +124 -0
  184. package/plugins/devflow-implement/skills/agent-teams/references/cleanup.md +104 -0
  185. package/plugins/devflow-implement/skills/agent-teams/references/communication.md +122 -0
  186. package/plugins/devflow-implement/skills/agent-teams/references/team-patterns.md +217 -0
  187. package/plugins/devflow-implement/skills/frontend-design/SKILL.md +254 -0
  188. package/plugins/devflow-implement/skills/frontend-design/references/detection.md +184 -0
  189. package/plugins/devflow-implement/skills/frontend-design/references/patterns.md +511 -0
  190. package/plugins/devflow-implement/skills/frontend-design/references/violations.md +453 -0
  191. package/plugins/devflow-implement/skills/implementation-patterns/SKILL.md +162 -0
  192. package/plugins/devflow-implement/skills/implementation-patterns/references/patterns.md +1063 -0
  193. package/plugins/devflow-implement/skills/implementation-patterns/references/violations.md +483 -0
  194. package/plugins/devflow-implement/skills/self-review/SKILL.md +149 -0
  195. package/plugins/devflow-implement/skills/self-review/references/patterns.md +405 -0
  196. package/plugins/devflow-implement/skills/self-review/references/report-template.md +253 -0
  197. package/plugins/devflow-implement/skills/self-review/references/violations.md +308 -0
  198. package/plugins/devflow-resolve/.claude-plugin/plugin.json +19 -0
  199. package/plugins/devflow-resolve/README.md +65 -0
  200. package/plugins/devflow-resolve/agents/git.md +272 -0
  201. package/plugins/devflow-resolve/agents/resolver.md +131 -0
  202. package/plugins/devflow-resolve/agents/simplifier.md +62 -0
  203. package/plugins/devflow-resolve/commands/resolve-teams.md +298 -0
  204. package/plugins/devflow-resolve/commands/resolve.md +237 -0
  205. package/plugins/devflow-resolve/skills/agent-teams/SKILL.md +124 -0
  206. package/plugins/devflow-resolve/skills/agent-teams/references/cleanup.md +104 -0
  207. package/plugins/devflow-resolve/skills/agent-teams/references/communication.md +122 -0
  208. package/plugins/devflow-resolve/skills/agent-teams/references/team-patterns.md +217 -0
  209. package/plugins/devflow-resolve/skills/implementation-patterns/SKILL.md +162 -0
  210. package/plugins/devflow-resolve/skills/implementation-patterns/references/patterns.md +1063 -0
  211. package/plugins/devflow-resolve/skills/implementation-patterns/references/violations.md +483 -0
  212. package/plugins/devflow-resolve/skills/security-patterns/SKILL.md +156 -0
  213. package/plugins/devflow-resolve/skills/security-patterns/references/detection.md +287 -0
  214. package/plugins/devflow-resolve/skills/security-patterns/references/patterns.md +507 -0
  215. package/plugins/devflow-resolve/skills/security-patterns/references/violations.md +237 -0
  216. package/plugins/devflow-self-review/.claude-plugin/plugin.json +7 -0
  217. package/plugins/devflow-self-review/README.md +38 -0
  218. package/plugins/devflow-self-review/agents/scrutinizer.md +80 -0
  219. package/plugins/devflow-self-review/agents/simplifier.md +62 -0
  220. package/plugins/devflow-self-review/agents/validator.md +86 -0
  221. package/plugins/devflow-self-review/commands/self-review.md +126 -0
  222. package/plugins/devflow-self-review/skills/core-patterns/SKILL.md +162 -0
  223. package/plugins/devflow-self-review/skills/core-patterns/references/checklist.md +276 -0
  224. package/plugins/devflow-self-review/skills/core-patterns/references/code-smell-violations.md +144 -0
  225. package/plugins/devflow-self-review/skills/core-patterns/references/detection.md +303 -0
  226. package/plugins/devflow-self-review/skills/core-patterns/references/patterns.md +576 -0
  227. package/plugins/devflow-self-review/skills/core-patterns/references/violations.md +369 -0
  228. package/plugins/devflow-self-review/skills/self-review/SKILL.md +149 -0
  229. package/plugins/devflow-self-review/skills/self-review/references/patterns.md +405 -0
  230. package/plugins/devflow-self-review/skills/self-review/references/report-template.md +253 -0
  231. package/plugins/devflow-self-review/skills/self-review/references/violations.md +308 -0
  232. package/plugins/devflow-specify/.claude-plugin/plugin.json +15 -0
  233. package/plugins/devflow-specify/README.md +46 -0
  234. package/plugins/devflow-specify/agents/skimmer.md +88 -0
  235. package/plugins/devflow-specify/agents/synthesizer.md +204 -0
  236. package/plugins/devflow-specify/commands/specify-teams.md +314 -0
  237. package/plugins/devflow-specify/commands/specify.md +179 -0
  238. package/plugins/devflow-specify/skills/agent-teams/SKILL.md +124 -0
  239. package/plugins/devflow-specify/skills/agent-teams/references/cleanup.md +104 -0
  240. package/plugins/devflow-specify/skills/agent-teams/references/communication.md +122 -0
  241. package/plugins/devflow-specify/skills/agent-teams/references/team-patterns.md +217 -0
  242. package/scripts/hooks/ambient-prompt.sh +48 -0
  243. package/scripts/hooks/background-memory-update.sh +208 -0
  244. package/scripts/hooks/ensure-memory-gitignore.sh +17 -0
  245. package/scripts/hooks/pre-compact-memory.sh +87 -0
  246. package/scripts/hooks/session-start-memory.sh +126 -0
  247. package/scripts/hooks/stop-update-memory.sh +85 -0
  248. package/shared/agents/coder.md +122 -0
  249. package/shared/agents/git.md +272 -0
  250. package/shared/agents/resolver.md +131 -0
  251. package/shared/agents/reviewer.md +119 -0
  252. package/shared/agents/scrutinizer.md +80 -0
  253. package/shared/agents/shepherd.md +94 -0
  254. package/shared/agents/simplifier.md +62 -0
  255. package/shared/agents/skimmer.md +88 -0
  256. package/shared/agents/synthesizer.md +204 -0
  257. package/shared/agents/validator.md +86 -0
  258. package/shared/skills/accessibility/SKILL.md +229 -0
  259. package/shared/skills/accessibility/references/detection.md +171 -0
  260. package/shared/skills/accessibility/references/patterns.md +670 -0
  261. package/shared/skills/accessibility/references/violations.md +419 -0
  262. package/shared/skills/agent-teams/SKILL.md +124 -0
  263. package/shared/skills/agent-teams/references/cleanup.md +104 -0
  264. package/shared/skills/agent-teams/references/communication.md +122 -0
  265. package/shared/skills/agent-teams/references/team-patterns.md +217 -0
  266. package/shared/skills/ambient-router/SKILL.md +89 -0
  267. package/shared/skills/ambient-router/references/skill-catalog.md +64 -0
  268. package/shared/skills/architecture-patterns/SKILL.md +153 -0
  269. package/shared/skills/architecture-patterns/references/detection.md +337 -0
  270. package/shared/skills/architecture-patterns/references/patterns.md +873 -0
  271. package/shared/skills/architecture-patterns/references/violations.md +575 -0
  272. package/shared/skills/complexity-patterns/SKILL.md +143 -0
  273. package/shared/skills/complexity-patterns/references/detection.md +264 -0
  274. package/shared/skills/complexity-patterns/references/patterns.md +487 -0
  275. package/shared/skills/complexity-patterns/references/violations.md +361 -0
  276. package/shared/skills/consistency-patterns/SKILL.md +140 -0
  277. package/shared/skills/consistency-patterns/references/detection.md +207 -0
  278. package/shared/skills/consistency-patterns/references/patterns.md +202 -0
  279. package/shared/skills/consistency-patterns/references/violations.md +213 -0
  280. package/shared/skills/core-patterns/SKILL.md +162 -0
  281. package/shared/skills/core-patterns/references/checklist.md +276 -0
  282. package/shared/skills/core-patterns/references/code-smell-violations.md +144 -0
  283. package/shared/skills/core-patterns/references/detection.md +303 -0
  284. package/shared/skills/core-patterns/references/patterns.md +576 -0
  285. package/shared/skills/core-patterns/references/violations.md +369 -0
  286. package/shared/skills/database-patterns/SKILL.md +134 -0
  287. package/shared/skills/database-patterns/references/detection.md +208 -0
  288. package/shared/skills/database-patterns/references/patterns.md +394 -0
  289. package/shared/skills/database-patterns/references/violations.md +332 -0
  290. package/shared/skills/dependencies-patterns/SKILL.md +141 -0
  291. package/shared/skills/dependencies-patterns/references/detection.md +181 -0
  292. package/shared/skills/dependencies-patterns/references/patterns.md +225 -0
  293. package/shared/skills/dependencies-patterns/references/violations.md +247 -0
  294. package/shared/skills/docs-framework/SKILL.md +138 -0
  295. package/shared/skills/docs-framework/references/patterns.md +346 -0
  296. package/shared/skills/docs-framework/references/violations.md +221 -0
  297. package/shared/skills/documentation-patterns/SKILL.md +125 -0
  298. package/shared/skills/documentation-patterns/references/detection.md +190 -0
  299. package/shared/skills/documentation-patterns/references/patterns.md +189 -0
  300. package/shared/skills/documentation-patterns/references/violations.md +163 -0
  301. package/shared/skills/frontend-design/SKILL.md +254 -0
  302. package/shared/skills/frontend-design/references/detection.md +184 -0
  303. package/shared/skills/frontend-design/references/patterns.md +511 -0
  304. package/shared/skills/frontend-design/references/violations.md +453 -0
  305. package/shared/skills/git-safety/SKILL.md +122 -0
  306. package/shared/skills/git-safety/references/detection.md +290 -0
  307. package/shared/skills/git-safety/references/patterns.md +289 -0
  308. package/shared/skills/git-safety/references/violations.md +18 -0
  309. package/shared/skills/git-workflow/SKILL.md +158 -0
  310. package/shared/skills/git-workflow/references/commit-patterns.md +115 -0
  311. package/shared/skills/git-workflow/references/commit-violations.md +77 -0
  312. package/shared/skills/git-workflow/references/pr-patterns.md +127 -0
  313. package/shared/skills/git-workflow/references/pr-violations.md +96 -0
  314. package/shared/skills/github-patterns/SKILL.md +153 -0
  315. package/shared/skills/github-patterns/references/patterns.md +572 -0
  316. package/shared/skills/github-patterns/references/violations.md +298 -0
  317. package/shared/skills/implementation-patterns/SKILL.md +162 -0
  318. package/shared/skills/implementation-patterns/references/patterns.md +1063 -0
  319. package/shared/skills/implementation-patterns/references/violations.md +483 -0
  320. package/shared/skills/input-validation/SKILL.md +148 -0
  321. package/shared/skills/input-validation/references/detection.md +283 -0
  322. package/shared/skills/input-validation/references/patterns.md +361 -0
  323. package/shared/skills/input-validation/references/violations.md +224 -0
  324. package/shared/skills/performance-patterns/SKILL.md +154 -0
  325. package/shared/skills/performance-patterns/references/detection.md +351 -0
  326. package/shared/skills/performance-patterns/references/patterns.md +503 -0
  327. package/shared/skills/performance-patterns/references/violations.md +354 -0
  328. package/shared/skills/react/SKILL.md +276 -0
  329. package/shared/skills/react/references/patterns.md +1331 -0
  330. package/shared/skills/react/references/violations.md +565 -0
  331. package/shared/skills/regression-patterns/SKILL.md +146 -0
  332. package/shared/skills/regression-patterns/references/detection.md +237 -0
  333. package/shared/skills/regression-patterns/references/patterns.md +226 -0
  334. package/shared/skills/regression-patterns/references/violations.md +225 -0
  335. package/shared/skills/review-methodology/SKILL.md +119 -0
  336. package/shared/skills/review-methodology/references/patterns.md +186 -0
  337. package/shared/skills/review-methodology/references/report-template.md +142 -0
  338. package/shared/skills/review-methodology/references/violations.md +125 -0
  339. package/shared/skills/security-patterns/SKILL.md +156 -0
  340. package/shared/skills/security-patterns/references/detection.md +287 -0
  341. package/shared/skills/security-patterns/references/patterns.md +507 -0
  342. package/shared/skills/security-patterns/references/violations.md +237 -0
  343. package/shared/skills/self-review/SKILL.md +149 -0
  344. package/shared/skills/self-review/references/patterns.md +405 -0
  345. package/shared/skills/self-review/references/report-template.md +253 -0
  346. package/shared/skills/self-review/references/violations.md +308 -0
  347. package/shared/skills/test-driven-development/SKILL.md +139 -0
  348. package/shared/skills/test-driven-development/references/rationalization-prevention.md +111 -0
  349. package/shared/skills/test-patterns/SKILL.md +183 -0
  350. package/shared/skills/test-patterns/references/detection.md +149 -0
  351. package/shared/skills/test-patterns/references/patterns.md +220 -0
  352. package/shared/skills/test-patterns/references/report-template.md +108 -0
  353. package/shared/skills/test-patterns/references/violations.md +221 -0
  354. package/shared/skills/typescript/SKILL.md +176 -0
  355. package/shared/skills/typescript/references/patterns.md +1105 -0
  356. package/shared/skills/typescript/references/violations.md +433 -0
  357. package/src/templates/claudeignore.template +188 -0
  358. package/src/templates/managed-settings.json +160 -0
  359. package/src/templates/settings.json +59 -0
  360. package/dist/cli.d.ts.map +0 -1
  361. package/dist/cli.js.map +0 -1
  362. package/dist/commands/init.d.ts.map +0 -1
  363. package/dist/commands/init.js.map +0 -1
  364. package/dist/commands/uninstall.d.ts.map +0 -1
  365. package/dist/commands/uninstall.js.map +0 -1
  366. package/dist/utils/git.d.ts.map +0 -1
  367. package/dist/utils/git.js.map +0 -1
  368. package/dist/utils/paths.d.ts.map +0 -1
  369. package/dist/utils/paths.js.map +0 -1
  370. package/src/claude/CLAUDE.md +0 -400
  371. package/src/claude/agents/devflow/audit-architecture.md +0 -132
  372. package/src/claude/agents/devflow/audit-complexity.md +0 -132
  373. package/src/claude/agents/devflow/audit-database.md +0 -132
  374. package/src/claude/agents/devflow/audit-dependencies.md +0 -132
  375. package/src/claude/agents/devflow/audit-documentation.md +0 -132
  376. package/src/claude/agents/devflow/audit-performance.md +0 -256
  377. package/src/claude/agents/devflow/audit-security.md +0 -259
  378. package/src/claude/agents/devflow/audit-tests.md +0 -132
  379. package/src/claude/agents/devflow/audit-typescript.md +0 -132
  380. package/src/claude/agents/devflow/brainstorm.md +0 -279
  381. package/src/claude/agents/devflow/catch-up.md +0 -345
  382. package/src/claude/agents/devflow/code-review.md +0 -307
  383. package/src/claude/agents/devflow/commit.md +0 -380
  384. package/src/claude/agents/devflow/debug.md +0 -476
  385. package/src/claude/agents/devflow/design.md +0 -491
  386. package/src/claude/agents/devflow/get-issue.md +0 -286
  387. package/src/claude/agents/devflow/pr-comments.md +0 -285
  388. package/src/claude/agents/devflow/project-state.md +0 -419
  389. package/src/claude/agents/devflow/pull-request.md +0 -493
  390. package/src/claude/agents/devflow/release.md +0 -1137
  391. package/src/claude/agents/devflow/tech-debt.md +0 -338
  392. package/src/claude/commands/devflow/brainstorm.md +0 -68
  393. package/src/claude/commands/devflow/breakdown.md +0 -125
  394. package/src/claude/commands/devflow/catch-up.md +0 -29
  395. package/src/claude/commands/devflow/code-review.md +0 -237
  396. package/src/claude/commands/devflow/commit.md +0 -17
  397. package/src/claude/commands/devflow/debug.md +0 -56
  398. package/src/claude/commands/devflow/design.md +0 -82
  399. package/src/claude/commands/devflow/devlog.md +0 -408
  400. package/src/claude/commands/devflow/get-issue.md +0 -16
  401. package/src/claude/commands/devflow/implement.md +0 -100
  402. package/src/claude/commands/devflow/plan.md +0 -223
  403. package/src/claude/commands/devflow/pull-request.md +0 -20
  404. package/src/claude/commands/devflow/release.md +0 -251
  405. package/src/claude/commands/devflow/resolve-comments.md +0 -583
  406. package/src/claude/scripts/statusline.sh +0 -47
  407. package/src/claude/settings.json +0 -6
  408. package/src/claude/skills/devflow/code-smell/SKILL.md +0 -428
  409. package/src/claude/skills/devflow/debug/SKILL.md +0 -119
  410. package/src/claude/skills/devflow/error-handling/SKILL.md +0 -597
  411. package/src/claude/skills/devflow/input-validation/SKILL.md +0 -514
  412. package/src/claude/skills/devflow/pattern-check/SKILL.md +0 -238
  413. package/src/claude/skills/devflow/research/SKILL.md +0 -138
  414. package/src/claude/skills/devflow/test-design/SKILL.md +0 -384
@@ -0,0 +1,354 @@
1
+ # Performance Violation Examples
2
+
3
+ Extended violation patterns for performance reviews. Reference from main SKILL.md.
4
+
5
+ ## Algorithmic Violations
6
+
7
+ ### N+1 Query Variants
8
+
9
+ **ORM Eager Loading Missing**
10
+ ```typescript
11
+ // VIOLATION: Lazy loading triggers N queries
12
+ const posts = await Post.findAll();
13
+ for (const post of posts) {
14
+ console.log(post.author.name); // N additional queries
15
+ }
16
+ ```
17
+
18
+ **GraphQL Resolver N+1**
19
+ ```typescript
20
+ // VIOLATION: Resolver called per item
21
+ const resolvers = {
22
+ Post: {
23
+ author: async (post) => {
24
+ return db.users.findById(post.authorId); // N queries
25
+ }
26
+ }
27
+ };
28
+ ```
29
+
30
+ **Nested Loop Queries**
31
+ ```typescript
32
+ // VIOLATION: Query inside nested loop
33
+ for (const category of categories) {
34
+ for (const product of category.products) {
35
+ const reviews = await db.reviews.findByProductId(product.id); // N*M queries
36
+ }
37
+ }
38
+ ```
39
+
40
+ ### O(n^2) or Worse Patterns
41
+
42
+ **Array.includes in Loop**
43
+ ```typescript
44
+ // VIOLATION: O(n^2) - includes is O(n)
45
+ function removeDuplicates(items: Item[]) {
46
+ const unique: Item[] = [];
47
+ for (const item of items) {
48
+ if (!unique.some(u => u.id === item.id)) { // O(n) check each time
49
+ unique.push(item);
50
+ }
51
+ }
52
+ return unique;
53
+ }
54
+ ```
55
+
56
+ **Nested Array Methods**
57
+ ```typescript
58
+ // VIOLATION: O(n*m) - filter inside map
59
+ function matchItems(list1: Item[], list2: Item[]) {
60
+ return list1.map(item => ({
61
+ ...item,
62
+ matches: list2.filter(i => i.category === item.category) // O(m) per item
63
+ }));
64
+ }
65
+ ```
66
+
67
+ **String Concatenation in Loop**
68
+ ```typescript
69
+ // VIOLATION: O(n^2) string copies
70
+ function buildCsv(rows: string[][]): string {
71
+ let csv = '';
72
+ for (const row of rows) {
73
+ csv += row.join(',') + '\n'; // Creates new string each time
74
+ }
75
+ return csv;
76
+ }
77
+ ```
78
+
79
+ ### Inefficient Data Structure Usage
80
+
81
+ **Object.keys/values/entries in Hot Path**
82
+ ```typescript
83
+ // VIOLATION: Creates new array on each call
84
+ function findInObject(obj: Record<string, Item>, predicate: (item: Item) => boolean) {
85
+ for (const key of Object.keys(obj)) { // Allocates array
86
+ if (predicate(obj[key])) {
87
+ return obj[key];
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ **Array as Queue/Stack**
94
+ ```typescript
95
+ // VIOLATION: shift() is O(n)
96
+ class Queue<T> {
97
+ private items: T[] = [];
98
+
99
+ dequeue(): T | undefined {
100
+ return this.items.shift(); // O(n) - reindexes entire array
101
+ }
102
+ }
103
+ ```
104
+
105
+ ---
106
+
107
+ ## Database Violations
108
+
109
+ ### Missing Index Patterns
110
+
111
+ **Unindexed Foreign Key**
112
+ ```sql
113
+ -- VIOLATION: Joins without index
114
+ SELECT * FROM orders o
115
+ JOIN order_items oi ON o.id = oi.order_id -- order_id likely unindexed
116
+ WHERE o.customer_id = 123;
117
+ ```
118
+
119
+ **Unindexed Filter Column**
120
+ ```typescript
121
+ // VIOLATION: Filters on unindexed column
122
+ const activeUsers = await db.query(
123
+ 'SELECT * FROM users WHERE last_login > ?', // last_login probably unindexed
124
+ [thirtyDaysAgo]
125
+ );
126
+ ```
127
+
128
+ **Composite Index Order Wrong**
129
+ ```sql
130
+ -- Index exists: (customer_id, status)
131
+ -- VIOLATION: Query doesn't use index efficiently
132
+ SELECT * FROM orders WHERE status = 'pending'; -- Can't use composite index
133
+ ```
134
+
135
+ ### Inefficient Queries
136
+
137
+ **LIKE with Leading Wildcard**
138
+ ```typescript
139
+ // VIOLATION: Can't use index
140
+ const results = await db.query(
141
+ 'SELECT * FROM products WHERE name LIKE ?',
142
+ ['%laptop%'] // Leading % prevents index usage
143
+ );
144
+ ```
145
+
146
+ **OR Instead of IN**
147
+ ```typescript
148
+ // VIOLATION: OR conditions often slower
149
+ const users = await db.query(
150
+ 'SELECT * FROM users WHERE status = ? OR status = ? OR status = ?',
151
+ ['active', 'pending', 'trial']
152
+ );
153
+
154
+ // Better: Use IN clause
155
+ const users = await db.query(
156
+ 'SELECT * FROM users WHERE status IN (?, ?, ?)',
157
+ ['active', 'pending', 'trial']
158
+ );
159
+ ```
160
+
161
+ **Sorting Without Index**
162
+ ```typescript
163
+ // VIOLATION: ORDER BY on unindexed column causes filesort
164
+ const recent = await db.query(
165
+ 'SELECT * FROM logs ORDER BY created_at DESC LIMIT 100' // No index on created_at
166
+ );
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Memory Violations
172
+
173
+ ### Memory Leak Patterns
174
+
175
+ **Closure Retaining Large Object**
176
+ ```typescript
177
+ // VIOLATION: Closure keeps entire large object alive
178
+ function processLargeData(data: LargeObject) {
179
+ return () => {
180
+ console.log(data.id); // Only needs id, but retains entire data object
181
+ };
182
+ }
183
+ ```
184
+
185
+ **Timer Without Cleanup**
186
+ ```typescript
187
+ // VIOLATION: Interval never cleared
188
+ class Poller {
189
+ start() {
190
+ setInterval(() => this.poll(), 1000); // Runs forever
191
+ }
192
+ }
193
+ ```
194
+
195
+ **Observable Without Unsubscribe**
196
+ ```typescript
197
+ // VIOLATION: Subscription never cleaned up
198
+ class Component {
199
+ init() {
200
+ eventBus.subscribe('update', this.handleUpdate); // Memory leak
201
+ }
202
+ // Missing cleanup method
203
+ }
204
+ ```
205
+
206
+ ### Large Allocation Patterns
207
+
208
+ **Spreading in Reduce**
209
+ ```typescript
210
+ // VIOLATION: Creates new object on each iteration
211
+ const merged = items.reduce((acc, item) => ({
212
+ ...acc, // Copies entire accumulator each time
213
+ [item.id]: item
214
+ }), {});
215
+ ```
216
+
217
+ **Array.concat in Loop**
218
+ ```typescript
219
+ // VIOLATION: Creates new array each iteration
220
+ let all: Item[] = [];
221
+ for (const batch of batches) {
222
+ all = all.concat(batch); // O(n^2) total allocations
223
+ }
224
+ ```
225
+
226
+ **JSON Clone in Hot Path**
227
+ ```typescript
228
+ // VIOLATION: Full serialization/parsing
229
+ function processItem(item: Item) {
230
+ const copy = JSON.parse(JSON.stringify(item)); // Expensive!
231
+ // ... modify copy
232
+ }
233
+ ```
234
+
235
+ ---
236
+
237
+ ## I/O Violations
238
+
239
+ ### Blocking Operations
240
+
241
+ **Sync File Operations in Request Handler**
242
+ ```typescript
243
+ // VIOLATION: Blocks event loop
244
+ app.get('/config', (req, res) => {
245
+ const config = fs.readFileSync('./config.json'); // Blocks!
246
+ res.json(JSON.parse(config));
247
+ });
248
+ ```
249
+
250
+ **Sync Crypto Operations**
251
+ ```typescript
252
+ // VIOLATION: CPU-intensive sync operation
253
+ function hashPassword(password: string): string {
254
+ return crypto.pbkdf2Sync(password, salt, 100000, 64, 'sha512'); // Blocks!
255
+ }
256
+ ```
257
+
258
+ ### Sequential vs Parallel
259
+
260
+ **await in forEach (No Parallelism)**
261
+ ```typescript
262
+ // VIOLATION: forEach doesn't wait, unpredictable behavior
263
+ ids.forEach(async (id) => {
264
+ await processItem(id); // Fire and forget!
265
+ });
266
+ ```
267
+
268
+ **Sequential Processing When Order Doesn't Matter**
269
+ ```typescript
270
+ // VIOLATION: Could be parallel
271
+ async function validateAll(items: Item[]) {
272
+ const results = [];
273
+ for (const item of items) {
274
+ results.push(await validate(item)); // Sequential but independent
275
+ }
276
+ return results;
277
+ }
278
+ ```
279
+
280
+ ### Redundant Operations
281
+
282
+ **Same Data Fetched Multiple Times**
283
+ ```typescript
284
+ // VIOLATION: Duplicate API calls
285
+ async function buildReport(userId: string) {
286
+ const user = await getUser(userId);
287
+ const profile = await getUserProfile(userId); // Probably same data
288
+ const permissions = await getUserPermissions(userId); // Another call
289
+ }
290
+ ```
291
+
292
+ **Cache Miss on Every Request**
293
+ ```typescript
294
+ // VIOLATION: No caching strategy
295
+ async function getConfig() {
296
+ return await fetchFromRemote('/config'); // Network call every time
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Frontend Violations
303
+
304
+ ### Re-render Patterns
305
+
306
+ **Inline Object/Array in JSX**
307
+ ```tsx
308
+ // VIOLATION: New reference every render
309
+ <Component
310
+ options={{ show: true, animate: false }} // New object each render
311
+ items={[1, 2, 3]} // New array each render
312
+ />
313
+ ```
314
+
315
+ **Inline Arrow in JSX**
316
+ ```tsx
317
+ // VIOLATION: New function every render
318
+ <Button onClick={() => handleClick(item.id)} /> // New function each render
319
+ ```
320
+
321
+ **Missing Key or Index as Key**
322
+ ```tsx
323
+ // VIOLATION: Index as key breaks reconciliation
324
+ {items.map((item, index) => (
325
+ <Item key={index} {...item} /> // Index key causes issues on reorder
326
+ ))}
327
+ ```
328
+
329
+ ### Missing Optimization
330
+
331
+ **Expensive Computation Every Render**
332
+ ```tsx
333
+ // VIOLATION: Recalculates on every render
334
+ function Dashboard({ data }) {
335
+ const stats = computeExpensiveStats(data); // Runs every render
336
+ return <Stats data={stats} />;
337
+ }
338
+ ```
339
+
340
+ **Unthrottled Event Handler**
341
+ ```tsx
342
+ // VIOLATION: Fires on every scroll pixel
343
+ window.addEventListener('scroll', () => {
344
+ updateParallax(); // 60+ calls per second
345
+ });
346
+ ```
347
+
348
+ **Large Component Tree Without Code Splitting**
349
+ ```tsx
350
+ // VIOLATION: Loads everything upfront
351
+ import HugeChartLibrary from 'huge-chart-lib';
352
+ import RarelyUsedFeature from './RarelyUsedFeature';
353
+ // All loaded even if not used
354
+ ```
@@ -0,0 +1,276 @@
1
+ ---
2
+ name: react
3
+ description: This skill should be used when the user works with React components (.tsx/.jsx), asks about "hooks", "state management", "context providers", "memo optimization", "useEffect", or discusses component composition and rendering performance. Provides patterns for hooks, state, effects, memoization, and React-specific architecture.
4
+ user-invocable: false
5
+ allowed-tools: Read, Grep, Glob
6
+ activation:
7
+ file-patterns:
8
+ - "**/*.tsx"
9
+ - "**/*.jsx"
10
+ exclude:
11
+ - "node_modules/**"
12
+ - "**/*.test.*"
13
+ - "**/*.spec.*"
14
+ ---
15
+
16
+ # React Patterns
17
+
18
+ Reference for React-specific patterns, component design, hooks, and performance optimization.
19
+
20
+ ## Iron Law
21
+
22
+ > **COMPOSITION OVER PROPS**
23
+ >
24
+ > Use children and compound components, not prop drilling. If a component has >5 props,
25
+ > it's doing too much. Split it. If you're passing data through 3+ levels, use context
26
+ > or composition. Props are for configuration, not data plumbing.
27
+
28
+ ## When This Skill Activates
29
+
30
+ - Working with React codebases
31
+ - Creating components and hooks
32
+ - Managing state and side effects
33
+ - Optimizing render performance
34
+
35
+ ---
36
+
37
+ ## Component Patterns
38
+
39
+ ### Functional Component Structure
40
+
41
+ ```tsx
42
+ export function UserCard({ user, className }: UserCardProps) {
43
+ const [isExpanded, setIsExpanded] = useState(false); // 1. Hooks first
44
+ const displayName = user.firstName + ' ' + user.lastName; // 2. Derived state
45
+ const handleToggle = () => setIsExpanded((prev) => !prev); // 3. Handlers
46
+ return ( // 4. Render
47
+ <div className={cn('user-card', className)}>
48
+ <h3>{displayName}</h3>
49
+ {isExpanded && <UserDetails user={user} />}
50
+ <button onClick={handleToggle}>{isExpanded ? 'Collapse' : 'Expand'}</button>
51
+ </div>
52
+ );
53
+ }
54
+ ```
55
+
56
+ ### Composition Over Props
57
+
58
+ ```tsx
59
+ function Card({ children }: { children: React.ReactNode }) {
60
+ return <div className="card">{children}</div>;
61
+ }
62
+ Card.Header = ({ children }) => <div className="card-header">{children}</div>;
63
+ Card.Body = ({ children }) => <div className="card-body">{children}</div>;
64
+
65
+ // Usage - flexible, not rigid props
66
+ <Card>
67
+ <Card.Header><h2>Title</h2></Card.Header>
68
+ <Card.Body><p>Content</p></Card.Body>
69
+ </Card>
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Hook Patterns
75
+
76
+ ```tsx
77
+ function useLocalStorage<T>(key: string, initialValue: T) {
78
+ const [value, setValue] = useState<T>(() => {
79
+ const stored = localStorage.getItem(key);
80
+ return stored ? JSON.parse(stored) : initialValue;
81
+ });
82
+ useEffect(() => localStorage.setItem(key, JSON.stringify(value)), [key, value]);
83
+ return [value, setValue] as const;
84
+ }
85
+ ```
86
+
87
+ ---
88
+
89
+ ## State Management
90
+
91
+ ```tsx
92
+ const AuthContext = createContext<AuthContextValue | null>(null);
93
+
94
+ export function AuthProvider({ children }: { children: React.ReactNode }) {
95
+ const [user, setUser] = useState<User | null>(null);
96
+ const login = async (creds: Credentials) => setUser(await authApi.login(creds));
97
+ const logout = () => { authApi.logout(); setUser(null); };
98
+ return <AuthContext.Provider value={{ user, login, logout }}>{children}</AuthContext.Provider>;
99
+ }
100
+
101
+ export function useAuth() {
102
+ const ctx = useContext(AuthContext);
103
+ if (!ctx) throw new Error('useAuth must be used within AuthProvider');
104
+ return ctx;
105
+ }
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Performance
111
+
112
+ ```tsx
113
+ function UserList({ users, filter }: { users: User[]; filter: string }) {
114
+ const filtered = useMemo(() => users.filter((u) => u.name.includes(filter)), [users, filter]);
115
+ const onClick = useCallback(() => console.log('Clicked'), []);
116
+ return <ul>{filtered.map((u) => <MemoItem key={u.id} user={u} onClick={onClick} />)}</ul>;
117
+ }
118
+ const MemoItem = memo(({ user }: { user: User }) => <li>{user.name}</li>);
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Async Parallelization
124
+
125
+ ```tsx
126
+ // CORRECT: Independent fetches run in parallel
127
+ async function loadDashboard(userId: string) {
128
+ const [user, orders, preferences] = await Promise.all([
129
+ fetchUser(userId),
130
+ fetchOrders(userId),
131
+ fetchPreferences(userId),
132
+ ]);
133
+ return { user, orders, preferences };
134
+ }
135
+
136
+ // VIOLATION: Sequential fetches (3x slower)
137
+ async function loadDashboardSlow(userId: string) {
138
+ const user = await fetchUser(userId);
139
+ const orders = await fetchOrders(userId);
140
+ const preferences = await fetchPreferences(userId);
141
+ return { user, orders, preferences };
142
+ }
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Bundle Size
148
+
149
+ ```tsx
150
+ // CORRECT: Direct imports (tree-shakable)
151
+ import { Button } from '@/components/Button';
152
+ import { Card } from '@/components/Card';
153
+
154
+ // VIOLATION: Barrel imports (imports entire library)
155
+ import { Button, Card } from '@/components';
156
+
157
+ // CORRECT: Dynamic import for heavy components
158
+ const Chart = lazy(() => import('./Chart'));
159
+ const Editor = lazy(() => import('./Editor'));
160
+
161
+ function Dashboard() {
162
+ return (
163
+ <Suspense fallback={<Skeleton />}>
164
+ {showChart && <Chart data={data} />}
165
+ </Suspense>
166
+ );
167
+ }
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Re-render Optimization
173
+
174
+ ```tsx
175
+ // CORRECT: Primitive deps (stable references)
176
+ useEffect(() => {
177
+ fetchData(userId, isActive);
178
+ }, [userId, isActive]); // primitives don't cause unnecessary runs
179
+
180
+ // VIOLATION: Object/array deps (new reference every render)
181
+ useEffect(() => {
182
+ fetchData(options);
183
+ }, [options]); // { page: 1 } !== { page: 1 }
184
+
185
+ // CORRECT: Stable callback with useCallback
186
+ const handleClick = useCallback((id: string) => {
187
+ setSelected(id);
188
+ }, []); // no deps = stable reference
189
+
190
+ // VIOLATION: Inline function (new reference every render)
191
+ <List onItemClick={(id) => setSelected(id)} />
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Image Optimization
197
+
198
+ ```tsx
199
+ // CORRECT: Optimized image with all attributes
200
+ <img
201
+ src={url}
202
+ alt={description}
203
+ width={400}
204
+ height={300}
205
+ loading="lazy"
206
+ decoding="async"
207
+ style={{ aspectRatio: '4/3' }}
208
+ />
209
+
210
+ // VIOLATION: Unoptimized image
211
+ <img src={url} /> // No dimensions, no lazy loading, layout shift
212
+ ```
213
+
214
+ ---
215
+
216
+ ## Data Structure Performance
217
+
218
+ ```tsx
219
+ // CORRECT: Set for O(1) membership checks
220
+ const selectedIds = new Set(selected);
221
+ const isSelected = (id: string) => selectedIds.has(id);
222
+
223
+ // VIOLATION: Array.includes is O(n)
224
+ const isSelected = (id: string) => selected.includes(id);
225
+
226
+ // CORRECT: Map for key-value lookups
227
+ const usersById = new Map(users.map(u => [u.id, u]));
228
+ const getUser = (id: string) => usersById.get(id);
229
+
230
+ // VIOLATION: Array.find is O(n)
231
+ const getUser = (id: string) => users.find(u => u.id === id);
232
+ ```
233
+
234
+ ---
235
+
236
+ ## Anti-Patterns
237
+
238
+ ```tsx
239
+ // BAD: Derived state in useState | GOOD: useMemo
240
+ const filtered = useMemo(() => items.filter(i => i.active), [items]);
241
+
242
+ // BAD: Missing dependency | GOOD: Include all deps
243
+ useEffect(() => { fetchData(userId); }, [userId]);
244
+
245
+ // BAD: State update in render | GOOD: Use effect
246
+ useEffect(() => { setState(value); }, [value]);
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Extended References
252
+
253
+ - `references/patterns.md` - Render props, reducers, virtualization, lazy loading
254
+ - `references/hooks.md` - useQuery, useDebouncedValue, usePrevious, useClickOutside
255
+ - `references/forms.md` - Controlled forms, validation hooks, multi-step forms
256
+ - `references/error-handling.md` - Error boundaries, async error handling
257
+
258
+ ---
259
+
260
+ ## Checklist
261
+
262
+ - [ ] Hooks at top level only
263
+ - [ ] All useEffect deps included
264
+ - [ ] useCallback for handlers passed to children
265
+ - [ ] useMemo for expensive computations
266
+ - [ ] Context at appropriate level
267
+ - [ ] Error boundaries around risky components
268
+ - [ ] Keys on list items (not index)
269
+ - [ ] Loading/error states handled
270
+ - [ ] Accessibility (aria-*, role)
271
+ - [ ] Independent fetches parallelized with Promise.all
272
+ - [ ] No barrel imports (direct imports for tree-shaking)
273
+ - [ ] Large components lazy-loaded
274
+ - [ ] Object/array deps avoided in useEffect (use primitives)
275
+ - [ ] Set/Map used for lookups instead of Array.includes/find
276
+ - [ ] Images have dimensions, lazy loading, and aspect-ratio