compact-agent 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 (324) hide show
  1. package/README.md +394 -0
  2. package/bin/anycode.js +2 -0
  3. package/bin/crowcoder.js +19 -0
  4. package/bin/ecc-hooks.cjs +138 -0
  5. package/dist/agents.d.ts +17 -0
  6. package/dist/agents.js +1603 -0
  7. package/dist/agents.js.map +1 -0
  8. package/dist/api.d.ts +16 -0
  9. package/dist/api.js +115 -0
  10. package/dist/api.js.map +1 -0
  11. package/dist/autonomous-loops.d.ts +108 -0
  12. package/dist/autonomous-loops.js +526 -0
  13. package/dist/autonomous-loops.js.map +1 -0
  14. package/dist/codemaps.d.ts +53 -0
  15. package/dist/codemaps.js +325 -0
  16. package/dist/codemaps.js.map +1 -0
  17. package/dist/compaction.d.ts +30 -0
  18. package/dist/compaction.js +125 -0
  19. package/dist/compaction.js.map +1 -0
  20. package/dist/config.d.ts +5 -0
  21. package/dist/config.js +79 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/content-engine.d.ts +97 -0
  24. package/dist/content-engine.js +721 -0
  25. package/dist/content-engine.js.map +1 -0
  26. package/dist/cost-tracker.d.ts +49 -0
  27. package/dist/cost-tracker.js +150 -0
  28. package/dist/cost-tracker.js.map +1 -0
  29. package/dist/counter-button.d.ts +35 -0
  30. package/dist/counter-button.js +48 -0
  31. package/dist/counter-button.js.map +1 -0
  32. package/dist/counter.d.ts +21 -0
  33. package/dist/counter.js +31 -0
  34. package/dist/counter.js.map +1 -0
  35. package/dist/coverage.d.ts +23 -0
  36. package/dist/coverage.js +215 -0
  37. package/dist/coverage.js.map +1 -0
  38. package/dist/docs-sync.d.ts +23 -0
  39. package/dist/docs-sync.js +266 -0
  40. package/dist/docs-sync.js.map +1 -0
  41. package/dist/ecc.d.ts +41 -0
  42. package/dist/ecc.js +644 -0
  43. package/dist/ecc.js.map +1 -0
  44. package/dist/evaluation.d.ts +24 -0
  45. package/dist/evaluation.js +412 -0
  46. package/dist/evaluation.js.map +1 -0
  47. package/dist/export.d.ts +22 -0
  48. package/dist/export.js +109 -0
  49. package/dist/export.js.map +1 -0
  50. package/dist/git-workflow.d.ts +22 -0
  51. package/dist/git-workflow.js +197 -0
  52. package/dist/git-workflow.js.map +1 -0
  53. package/dist/hook-controls.d.ts +34 -0
  54. package/dist/hook-controls.js +90 -0
  55. package/dist/hook-controls.js.map +1 -0
  56. package/dist/hooks.d.ts +30 -0
  57. package/dist/hooks.js +130 -0
  58. package/dist/hooks.js.map +1 -0
  59. package/dist/html-parser.d.ts +18 -0
  60. package/dist/html-parser.js +101 -0
  61. package/dist/html-parser.js.map +1 -0
  62. package/dist/index.d.ts +12 -0
  63. package/dist/index.js +1230 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/learning.d.ts +35 -0
  66. package/dist/learning.js +238 -0
  67. package/dist/learning.js.map +1 -0
  68. package/dist/login.d.ts +37 -0
  69. package/dist/login.js +191 -0
  70. package/dist/login.js.map +1 -0
  71. package/dist/memory.d.ts +39 -0
  72. package/dist/memory.js +183 -0
  73. package/dist/memory.js.map +1 -0
  74. package/dist/model-router.d.ts +23 -0
  75. package/dist/model-router.js +145 -0
  76. package/dist/model-router.js.map +1 -0
  77. package/dist/modes.d.ts +17 -0
  78. package/dist/modes.js +217 -0
  79. package/dist/modes.js.map +1 -0
  80. package/dist/orchestration.d.ts +37 -0
  81. package/dist/orchestration.js +139 -0
  82. package/dist/orchestration.js.map +1 -0
  83. package/dist/package-detect.d.ts +36 -0
  84. package/dist/package-detect.js +529 -0
  85. package/dist/package-detect.js.map +1 -0
  86. package/dist/permissions.d.ts +25 -0
  87. package/dist/permissions.js +50 -0
  88. package/dist/permissions.js.map +1 -0
  89. package/dist/pm2-manager.d.ts +40 -0
  90. package/dist/pm2-manager.js +127 -0
  91. package/dist/pm2-manager.js.map +1 -0
  92. package/dist/query.d.ts +15 -0
  93. package/dist/query.js +278 -0
  94. package/dist/query.js.map +1 -0
  95. package/dist/refactor.d.ts +22 -0
  96. package/dist/refactor.js +226 -0
  97. package/dist/refactor.js.map +1 -0
  98. package/dist/retry.d.ts +20 -0
  99. package/dist/retry.js +88 -0
  100. package/dist/retry.js.map +1 -0
  101. package/dist/rules.d.ts +34 -0
  102. package/dist/rules.js +942 -0
  103. package/dist/rules.js.map +1 -0
  104. package/dist/schema.d.ts +23 -0
  105. package/dist/schema.js +12 -0
  106. package/dist/schema.js.map +1 -0
  107. package/dist/search-first.d.ts +17 -0
  108. package/dist/search-first.js +301 -0
  109. package/dist/search-first.js.map +1 -0
  110. package/dist/security.d.ts +10 -0
  111. package/dist/security.js +145 -0
  112. package/dist/security.js.map +1 -0
  113. package/dist/sessions.d.ts +21 -0
  114. package/dist/sessions.js +112 -0
  115. package/dist/sessions.js.map +1 -0
  116. package/dist/skill-create.d.ts +38 -0
  117. package/dist/skill-create.js +389 -0
  118. package/dist/skill-create.js.map +1 -0
  119. package/dist/skills.d.ts +34 -0
  120. package/dist/skills.js +161 -0
  121. package/dist/skills.js.map +1 -0
  122. package/dist/strategic-compaction.d.ts +24 -0
  123. package/dist/strategic-compaction.js +144 -0
  124. package/dist/strategic-compaction.js.map +1 -0
  125. package/dist/system-prompt.d.ts +3 -0
  126. package/dist/system-prompt.js +101 -0
  127. package/dist/system-prompt.js.map +1 -0
  128. package/dist/theme.d.ts +60 -0
  129. package/dist/theme.js +220 -0
  130. package/dist/theme.js.map +1 -0
  131. package/dist/tools/bash.d.ts +2 -0
  132. package/dist/tools/bash.js +49 -0
  133. package/dist/tools/bash.js.map +1 -0
  134. package/dist/tools/edit.d.ts +2 -0
  135. package/dist/tools/edit.js +76 -0
  136. package/dist/tools/edit.js.map +1 -0
  137. package/dist/tools/glob.d.ts +2 -0
  138. package/dist/tools/glob.js +54 -0
  139. package/dist/tools/glob.js.map +1 -0
  140. package/dist/tools/grep.d.ts +2 -0
  141. package/dist/tools/grep.js +64 -0
  142. package/dist/tools/grep.js.map +1 -0
  143. package/dist/tools/index.d.ts +5 -0
  144. package/dist/tools/index.js +27 -0
  145. package/dist/tools/index.js.map +1 -0
  146. package/dist/tools/list-dir.d.ts +2 -0
  147. package/dist/tools/list-dir.js +51 -0
  148. package/dist/tools/list-dir.js.map +1 -0
  149. package/dist/tools/read.d.ts +2 -0
  150. package/dist/tools/read.js +56 -0
  151. package/dist/tools/read.js.map +1 -0
  152. package/dist/tools/types.d.ts +45 -0
  153. package/dist/tools/types.js +2 -0
  154. package/dist/tools/types.js.map +1 -0
  155. package/dist/tools/web-fetch.d.ts +2 -0
  156. package/dist/tools/web-fetch.js +41 -0
  157. package/dist/tools/web-fetch.js.map +1 -0
  158. package/dist/tools/web-search.d.ts +27 -0
  159. package/dist/tools/web-search.js +139 -0
  160. package/dist/tools/web-search.js.map +1 -0
  161. package/dist/tools/write.d.ts +2 -0
  162. package/dist/tools/write.js +36 -0
  163. package/dist/tools/write.js.map +1 -0
  164. package/dist/types.d.ts +28 -0
  165. package/dist/types.js +57 -0
  166. package/dist/types.js.map +1 -0
  167. package/dist/users.d.ts +51 -0
  168. package/dist/users.js +193 -0
  169. package/dist/users.js.map +1 -0
  170. package/dist/verification.d.ts +73 -0
  171. package/dist/verification.js +269 -0
  172. package/dist/verification.js.map +1 -0
  173. package/dist/walkthrough.d.ts +10 -0
  174. package/dist/walkthrough.js +121 -0
  175. package/dist/walkthrough.js.map +1 -0
  176. package/package.json +58 -0
  177. package/resources/ecc/agents/architect.json +16 -0
  178. package/resources/ecc/agents/architect.md +212 -0
  179. package/resources/ecc/agents/build-error-resolver.json +17 -0
  180. package/resources/ecc/agents/build-error-resolver.md +116 -0
  181. package/resources/ecc/agents/chief-of-staff.json +17 -0
  182. package/resources/ecc/agents/chief-of-staff.md +153 -0
  183. package/resources/ecc/agents/code-reviewer.json +16 -0
  184. package/resources/ecc/agents/code-reviewer.md +238 -0
  185. package/resources/ecc/agents/database-reviewer.json +16 -0
  186. package/resources/ecc/agents/database-reviewer.md +92 -0
  187. package/resources/ecc/agents/doc-updater.json +16 -0
  188. package/resources/ecc/agents/doc-updater.md +108 -0
  189. package/resources/ecc/agents/e2e-runner.json +17 -0
  190. package/resources/ecc/agents/e2e-runner.md +109 -0
  191. package/resources/ecc/agents/go-build-resolver.json +17 -0
  192. package/resources/ecc/agents/go-build-resolver.md +96 -0
  193. package/resources/ecc/agents/go-reviewer.json +16 -0
  194. package/resources/ecc/agents/go-reviewer.md +77 -0
  195. package/resources/ecc/agents/harness-optimizer.json +15 -0
  196. package/resources/ecc/agents/harness-optimizer.md +34 -0
  197. package/resources/ecc/agents/loop-operator.json +16 -0
  198. package/resources/ecc/agents/loop-operator.md +36 -0
  199. package/resources/ecc/agents/planner.json +15 -0
  200. package/resources/ecc/agents/planner.md +212 -0
  201. package/resources/ecc/agents/python-reviewer.json +16 -0
  202. package/resources/ecc/agents/python-reviewer.md +99 -0
  203. package/resources/ecc/agents/refactor-cleaner.json +17 -0
  204. package/resources/ecc/agents/refactor-cleaner.md +87 -0
  205. package/resources/ecc/agents/security-reviewer.json +16 -0
  206. package/resources/ecc/agents/security-reviewer.md +109 -0
  207. package/resources/ecc/agents/tdd-guide.json +17 -0
  208. package/resources/ecc/agents/tdd-guide.md +93 -0
  209. package/resources/ecc/commands/add-language-rules.md +39 -0
  210. package/resources/ecc/commands/database-migration.md +36 -0
  211. package/resources/ecc/commands/feature-development.md +38 -0
  212. package/resources/ecc/prompts/build-fix.prompt.md +47 -0
  213. package/resources/ecc/prompts/code-review.prompt.md +56 -0
  214. package/resources/ecc/prompts/plan.prompt.md +52 -0
  215. package/resources/ecc/prompts/refactor.prompt.md +50 -0
  216. package/resources/ecc/prompts/security-review.prompt.md +70 -0
  217. package/resources/ecc/prompts/tdd.prompt.md +47 -0
  218. package/resources/ecc/rules/common-agents.md +53 -0
  219. package/resources/ecc/rules/common-coding-style.md +52 -0
  220. package/resources/ecc/rules/common-development-workflow.md +33 -0
  221. package/resources/ecc/rules/common-git-workflow.md +28 -0
  222. package/resources/ecc/rules/common-hooks.md +34 -0
  223. package/resources/ecc/rules/common-patterns.md +35 -0
  224. package/resources/ecc/rules/common-performance.md +59 -0
  225. package/resources/ecc/rules/common-security.md +33 -0
  226. package/resources/ecc/rules/common-testing.md +33 -0
  227. package/resources/ecc/rules/golang-coding-style.md +31 -0
  228. package/resources/ecc/rules/golang-hooks.md +16 -0
  229. package/resources/ecc/rules/golang-patterns.md +44 -0
  230. package/resources/ecc/rules/golang-security.md +33 -0
  231. package/resources/ecc/rules/golang-testing.md +30 -0
  232. package/resources/ecc/rules/kotlin-coding-style.md +39 -0
  233. package/resources/ecc/rules/kotlin-hooks.md +16 -0
  234. package/resources/ecc/rules/kotlin-patterns.md +50 -0
  235. package/resources/ecc/rules/kotlin-security.md +58 -0
  236. package/resources/ecc/rules/kotlin-testing.md +38 -0
  237. package/resources/ecc/rules/php-coding-style.md +25 -0
  238. package/resources/ecc/rules/php-hooks.md +21 -0
  239. package/resources/ecc/rules/php-patterns.md +23 -0
  240. package/resources/ecc/rules/php-security.md +24 -0
  241. package/resources/ecc/rules/php-testing.md +26 -0
  242. package/resources/ecc/rules/python-coding-style.md +42 -0
  243. package/resources/ecc/rules/python-hooks.md +19 -0
  244. package/resources/ecc/rules/python-patterns.md +39 -0
  245. package/resources/ecc/rules/python-security.md +30 -0
  246. package/resources/ecc/rules/python-testing.md +38 -0
  247. package/resources/ecc/rules/swift-coding-style.md +47 -0
  248. package/resources/ecc/rules/swift-hooks.md +20 -0
  249. package/resources/ecc/rules/swift-patterns.md +66 -0
  250. package/resources/ecc/rules/swift-security.md +33 -0
  251. package/resources/ecc/rules/swift-testing.md +45 -0
  252. package/resources/ecc/rules/typescript-coding-style.md +63 -0
  253. package/resources/ecc/rules/typescript-hooks.md +20 -0
  254. package/resources/ecc/rules/typescript-patterns.md +50 -0
  255. package/resources/ecc/rules/typescript-security.md +26 -0
  256. package/resources/ecc/rules/typescript-testing.md +16 -0
  257. package/resources/ecc/skills/agent-introspection-debugging/SKILL.md +152 -0
  258. package/resources/ecc/skills/agent-introspection-debugging/agents/openai.yaml +7 -0
  259. package/resources/ecc/skills/agent-sort/SKILL.md +214 -0
  260. package/resources/ecc/skills/agent-sort/agents/openai.yaml +7 -0
  261. package/resources/ecc/skills/api-design/SKILL.md +522 -0
  262. package/resources/ecc/skills/api-design/agents/openai.yaml +7 -0
  263. package/resources/ecc/skills/article-writing/SKILL.md +78 -0
  264. package/resources/ecc/skills/article-writing/agents/openai.yaml +7 -0
  265. package/resources/ecc/skills/backend-patterns/SKILL.md +597 -0
  266. package/resources/ecc/skills/backend-patterns/agents/openai.yaml +7 -0
  267. package/resources/ecc/skills/brand-voice/SKILL.md +96 -0
  268. package/resources/ecc/skills/brand-voice/agents/openai.yaml +7 -0
  269. package/resources/ecc/skills/brand-voice/references/voice-profile-schema.md +55 -0
  270. package/resources/ecc/skills/bun-runtime/SKILL.md +83 -0
  271. package/resources/ecc/skills/bun-runtime/agents/openai.yaml +7 -0
  272. package/resources/ecc/skills/coding-standards/SKILL.md +548 -0
  273. package/resources/ecc/skills/coding-standards/agents/openai.yaml +7 -0
  274. package/resources/ecc/skills/content-engine/SKILL.md +130 -0
  275. package/resources/ecc/skills/content-engine/agents/openai.yaml +7 -0
  276. package/resources/ecc/skills/crosspost/SKILL.md +110 -0
  277. package/resources/ecc/skills/crosspost/agents/openai.yaml +7 -0
  278. package/resources/ecc/skills/deep-research/SKILL.md +154 -0
  279. package/resources/ecc/skills/deep-research/agents/openai.yaml +7 -0
  280. package/resources/ecc/skills/dmux-workflows/SKILL.md +143 -0
  281. package/resources/ecc/skills/dmux-workflows/agents/openai.yaml +7 -0
  282. package/resources/ecc/skills/documentation-lookup/SKILL.md +89 -0
  283. package/resources/ecc/skills/documentation-lookup/agents/openai.yaml +7 -0
  284. package/resources/ecc/skills/e2e-testing/SKILL.md +325 -0
  285. package/resources/ecc/skills/e2e-testing/agents/openai.yaml +7 -0
  286. package/resources/ecc/skills/eval-harness/SKILL.md +235 -0
  287. package/resources/ecc/skills/eval-harness/agents/openai.yaml +7 -0
  288. package/resources/ecc/skills/everything-claude-code/SKILL.md +442 -0
  289. package/resources/ecc/skills/everything-claude-code/agents/openai.yaml +7 -0
  290. package/resources/ecc/skills/exa-search/SKILL.md +169 -0
  291. package/resources/ecc/skills/exa-search/agents/openai.yaml +7 -0
  292. package/resources/ecc/skills/fal-ai-media/SKILL.md +276 -0
  293. package/resources/ecc/skills/fal-ai-media/agents/openai.yaml +7 -0
  294. package/resources/ecc/skills/frontend-patterns/SKILL.md +647 -0
  295. package/resources/ecc/skills/frontend-patterns/agents/openai.yaml +7 -0
  296. package/resources/ecc/skills/frontend-slides/SKILL.md +183 -0
  297. package/resources/ecc/skills/frontend-slides/STYLE_PRESETS.md +330 -0
  298. package/resources/ecc/skills/frontend-slides/agents/openai.yaml +7 -0
  299. package/resources/ecc/skills/investor-materials/SKILL.md +95 -0
  300. package/resources/ecc/skills/investor-materials/agents/openai.yaml +7 -0
  301. package/resources/ecc/skills/investor-outreach/SKILL.md +90 -0
  302. package/resources/ecc/skills/investor-outreach/agents/openai.yaml +7 -0
  303. package/resources/ecc/skills/market-research/SKILL.md +74 -0
  304. package/resources/ecc/skills/market-research/agents/openai.yaml +7 -0
  305. package/resources/ecc/skills/mcp-server-patterns/SKILL.md +66 -0
  306. package/resources/ecc/skills/mcp-server-patterns/agents/openai.yaml +7 -0
  307. package/resources/ecc/skills/mle-workflow/SKILL.md +346 -0
  308. package/resources/ecc/skills/mle-workflow/agents/openai.yaml +7 -0
  309. package/resources/ecc/skills/nextjs-turbopack/SKILL.md +43 -0
  310. package/resources/ecc/skills/nextjs-turbopack/agents/openai.yaml +7 -0
  311. package/resources/ecc/skills/product-capability/SKILL.md +140 -0
  312. package/resources/ecc/skills/product-capability/agents/openai.yaml +7 -0
  313. package/resources/ecc/skills/security-review/SKILL.md +494 -0
  314. package/resources/ecc/skills/security-review/agents/openai.yaml +7 -0
  315. package/resources/ecc/skills/strategic-compact/SKILL.md +102 -0
  316. package/resources/ecc/skills/strategic-compact/agents/openai.yaml +7 -0
  317. package/resources/ecc/skills/tdd-workflow/SKILL.md +409 -0
  318. package/resources/ecc/skills/tdd-workflow/agents/openai.yaml +7 -0
  319. package/resources/ecc/skills/verification-loop/SKILL.md +125 -0
  320. package/resources/ecc/skills/verification-loop/agents/openai.yaml +7 -0
  321. package/resources/ecc/skills/video-editing/SKILL.md +307 -0
  322. package/resources/ecc/skills/video-editing/agents/openai.yaml +7 -0
  323. package/resources/ecc/skills/x-api/SKILL.md +229 -0
  324. package/resources/ecc/skills/x-api/agents/openai.yaml +7 -0
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: product-capability
3
+ description: Translate PRD intent, roadmap asks, or product discussions into an implementation-ready capability plan that exposes constraints, invariants, interfaces, and unresolved decisions before multi-service work starts. Use when the user needs an ECC-native PRD-to-SRS lane instead of vague planning prose.
4
+ ---
5
+
6
+ # Product Capability
7
+
8
+ This skill turns product intent into explicit engineering constraints.
9
+
10
+ Use it when the gap is not "what should we build?" but "what exactly must be true before implementation starts?"
11
+
12
+ ## When to Use
13
+
14
+ - A PRD, roadmap item, discussion, or founder note exists, but the implementation constraints are still implicit
15
+ - A feature crosses multiple services, repos, or teams and needs a capability contract before coding
16
+ - Product intent is clear, but architecture, data, lifecycle, or policy implications are still fuzzy
17
+ - Senior engineers keep restating the same hidden assumptions during review
18
+ - You need a reusable artifact that can survive across harnesses and sessions
19
+
20
+ ## Canonical Artifact
21
+
22
+ If the repo has a durable product-context file such as `PRODUCT.md`, `docs/product/`, or a program-spec directory, update it there.
23
+
24
+ If no capability manifest exists yet, create one using the template at:
25
+
26
+ - `docs/examples/product-capability-template.md`
27
+
28
+ The goal is not to create another planning stack. The goal is to make hidden capability constraints durable and reusable.
29
+
30
+ ## Non-Negotiable Rules
31
+
32
+ - Do not invent product truth. Mark unresolved questions explicitly.
33
+ - Separate user-visible promises from implementation details.
34
+ - Call out what is fixed policy, what is architecture preference, and what is still open.
35
+ - If the request conflicts with existing repo constraints, say so clearly instead of smoothing it over.
36
+ - Prefer one reusable capability artifact over scattered ad hoc notes.
37
+
38
+ ## Inputs
39
+
40
+ Read only what is needed:
41
+
42
+ 1. Product intent
43
+ - issue, discussion, PRD, roadmap note, founder message
44
+ 2. Current architecture
45
+ - relevant repo docs, contracts, schemas, routes, existing workflows
46
+ 3. Existing capability context
47
+ - `PRODUCT.md`, design docs, RFCs, migration notes, operating-model docs
48
+ 4. Delivery constraints
49
+ - auth, billing, compliance, rollout, backwards compatibility, performance, review policy
50
+
51
+ ## Core Workflow
52
+
53
+ ### 1. Restate the capability
54
+
55
+ Compress the ask into one precise statement:
56
+
57
+ - who the user or operator is
58
+ - what new capability exists after this ships
59
+ - what outcome changes because of it
60
+
61
+ If this statement is weak, the implementation will drift.
62
+
63
+ ### 2. Resolve capability constraints
64
+
65
+ Extract the constraints that must hold before implementation:
66
+
67
+ - business rules
68
+ - scope boundaries
69
+ - invariants
70
+ - trust boundaries
71
+ - data ownership
72
+ - lifecycle transitions
73
+ - rollout / migration requirements
74
+ - failure and recovery expectations
75
+
76
+ These are the things that often live only in senior-engineer memory.
77
+
78
+ ### 3. Define the implementation-facing contract
79
+
80
+ Produce an SRS-style capability plan with:
81
+
82
+ - capability summary
83
+ - explicit non-goals
84
+ - actors and surfaces
85
+ - required states and transitions
86
+ - interfaces / inputs / outputs
87
+ - data model implications
88
+ - security / billing / policy constraints
89
+ - observability and operator requirements
90
+ - open questions blocking implementation
91
+
92
+ ### 4. Translate into execution
93
+
94
+ End with the exact handoff:
95
+
96
+ - ready for direct implementation
97
+ - needs architecture review first
98
+ - needs product clarification first
99
+
100
+ If useful, point to the next ECC-native lane:
101
+
102
+ - `project-flow-ops`
103
+ - `workspace-surface-audit`
104
+ - `api-connector-builder`
105
+ - `dashboard-builder`
106
+ - `tdd-workflow`
107
+ - `verification-loop`
108
+
109
+ ## Output Format
110
+
111
+ Return the result in this order:
112
+
113
+ ```text
114
+ CAPABILITY
115
+ - one-paragraph restatement
116
+
117
+ CONSTRAINTS
118
+ - fixed rules, invariants, and boundaries
119
+
120
+ IMPLEMENTATION CONTRACT
121
+ - actors
122
+ - surfaces
123
+ - states and transitions
124
+ - interface/data implications
125
+
126
+ NON-GOALS
127
+ - what this lane explicitly does not own
128
+
129
+ OPEN QUESTIONS
130
+ - blockers or product decisions still required
131
+
132
+ HANDOFF
133
+ - what should happen next and which ECC lane should take it
134
+ ```
135
+
136
+ ## Good Outcomes
137
+
138
+ - Product intent is now concrete enough to implement without rediscovering hidden constraints mid-PR.
139
+ - Engineering review has a durable artifact instead of relying on memory or Slack context.
140
+ - The resulting plan is reusable across Claude Code, Codex, Cursor, OpenCode, and ECC 2.0 planning surfaces.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Product Capability"
3
+ short_description: "Implementation-ready product capability plans"
4
+ brand_color: "#0EA5E9"
5
+ default_prompt: "Use $product-capability to turn product intent into an implementation plan."
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,494 @@
1
+ ---
2
+ name: security-review
3
+ description: Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
4
+ ---
5
+
6
+ # Security Review Skill
7
+
8
+ This skill ensures all code follows security best practices and identifies potential vulnerabilities.
9
+
10
+ ## When to Activate
11
+
12
+ - Implementing authentication or authorization
13
+ - Handling user input or file uploads
14
+ - Creating new API endpoints
15
+ - Working with secrets or credentials
16
+ - Implementing payment features
17
+ - Storing or transmitting sensitive data
18
+ - Integrating third-party APIs
19
+
20
+ ## Security Checklist
21
+
22
+ ### 1. Secrets Management
23
+
24
+ #### FAIL: NEVER Do This
25
+ ```typescript
26
+ const apiKey = "sk-proj-xxxxx" // Hardcoded secret
27
+ const dbPassword = "password123" // In source code
28
+ ```
29
+
30
+ #### PASS: ALWAYS Do This
31
+ ```typescript
32
+ const apiKey = process.env.OPENAI_API_KEY
33
+ const dbUrl = process.env.DATABASE_URL
34
+
35
+ // Verify secrets exist
36
+ if (!apiKey) {
37
+ throw new Error('OPENAI_API_KEY not configured')
38
+ }
39
+ ```
40
+
41
+ #### Verification Steps
42
+ - [ ] No hardcoded API keys, tokens, or passwords
43
+ - [ ] All secrets in environment variables
44
+ - [ ] `.env.local` in .gitignore
45
+ - [ ] No secrets in git history
46
+ - [ ] Production secrets in hosting platform (Vercel, Railway)
47
+
48
+ ### 2. Input Validation
49
+
50
+ #### Always Validate User Input
51
+ ```typescript
52
+ import { z } from 'zod'
53
+
54
+ // Define validation schema
55
+ const CreateUserSchema = z.object({
56
+ email: z.string().email(),
57
+ name: z.string().min(1).max(100),
58
+ age: z.number().int().min(0).max(150)
59
+ })
60
+
61
+ // Validate before processing
62
+ export async function createUser(input: unknown) {
63
+ try {
64
+ const validated = CreateUserSchema.parse(input)
65
+ return await db.users.create(validated)
66
+ } catch (error) {
67
+ if (error instanceof z.ZodError) {
68
+ return { success: false, errors: error.errors }
69
+ }
70
+ throw error
71
+ }
72
+ }
73
+ ```
74
+
75
+ #### File Upload Validation
76
+ ```typescript
77
+ function validateFileUpload(file: File) {
78
+ // Size check (5MB max)
79
+ const maxSize = 5 * 1024 * 1024
80
+ if (file.size > maxSize) {
81
+ throw new Error('File too large (max 5MB)')
82
+ }
83
+
84
+ // Type check
85
+ const allowedTypes = ['image/jpeg', 'image/png', 'image/gif']
86
+ if (!allowedTypes.includes(file.type)) {
87
+ throw new Error('Invalid file type')
88
+ }
89
+
90
+ // Extension check
91
+ const allowedExtensions = ['.jpg', '.jpeg', '.png', '.gif']
92
+ const extension = file.name.toLowerCase().match(/\.[^.]+$/)?.[0]
93
+ if (!extension || !allowedExtensions.includes(extension)) {
94
+ throw new Error('Invalid file extension')
95
+ }
96
+
97
+ return true
98
+ }
99
+ ```
100
+
101
+ #### Verification Steps
102
+ - [ ] All user inputs validated with schemas
103
+ - [ ] File uploads restricted (size, type, extension)
104
+ - [ ] No direct use of user input in queries
105
+ - [ ] Whitelist validation (not blacklist)
106
+ - [ ] Error messages don't leak sensitive info
107
+
108
+ ### 3. SQL Injection Prevention
109
+
110
+ #### FAIL: NEVER Concatenate SQL
111
+ ```typescript
112
+ // DANGEROUS - SQL Injection vulnerability
113
+ const query = `SELECT * FROM users WHERE email = '${userEmail}'`
114
+ await db.query(query)
115
+ ```
116
+
117
+ #### PASS: ALWAYS Use Parameterized Queries
118
+ ```typescript
119
+ // Safe - parameterized query
120
+ const { data } = await supabase
121
+ .from('users')
122
+ .select('*')
123
+ .eq('email', userEmail)
124
+
125
+ // Or with raw SQL
126
+ await db.query(
127
+ 'SELECT * FROM users WHERE email = $1',
128
+ [userEmail]
129
+ )
130
+ ```
131
+
132
+ #### Verification Steps
133
+ - [ ] All database queries use parameterized queries
134
+ - [ ] No string concatenation in SQL
135
+ - [ ] ORM/query builder used correctly
136
+ - [ ] Supabase queries properly sanitized
137
+
138
+ ### 4. Authentication & Authorization
139
+
140
+ #### JWT Token Handling
141
+ ```typescript
142
+ // FAIL: WRONG: localStorage (vulnerable to XSS)
143
+ localStorage.setItem('token', token)
144
+
145
+ // PASS: CORRECT: httpOnly cookies
146
+ res.setHeader('Set-Cookie',
147
+ `token=${token}; HttpOnly; Secure; SameSite=Strict; Max-Age=3600`)
148
+ ```
149
+
150
+ #### Authorization Checks
151
+ ```typescript
152
+ export async function deleteUser(userId: string, requesterId: string) {
153
+ // ALWAYS verify authorization first
154
+ const requester = await db.users.findUnique({
155
+ where: { id: requesterId }
156
+ })
157
+
158
+ if (requester.role !== 'admin') {
159
+ return NextResponse.json(
160
+ { error: 'Unauthorized' },
161
+ { status: 403 }
162
+ )
163
+ }
164
+
165
+ // Proceed with deletion
166
+ await db.users.delete({ where: { id: userId } })
167
+ }
168
+ ```
169
+
170
+ #### Row Level Security (Supabase)
171
+ ```sql
172
+ -- Enable RLS on all tables
173
+ ALTER TABLE users ENABLE ROW LEVEL SECURITY;
174
+
175
+ -- Users can only view their own data
176
+ CREATE POLICY "Users view own data"
177
+ ON users FOR SELECT
178
+ USING (auth.uid() = id);
179
+
180
+ -- Users can only update their own data
181
+ CREATE POLICY "Users update own data"
182
+ ON users FOR UPDATE
183
+ USING (auth.uid() = id);
184
+ ```
185
+
186
+ #### Verification Steps
187
+ - [ ] Tokens stored in httpOnly cookies (not localStorage)
188
+ - [ ] Authorization checks before sensitive operations
189
+ - [ ] Row Level Security enabled in Supabase
190
+ - [ ] Role-based access control implemented
191
+ - [ ] Session management secure
192
+
193
+ ### 5. XSS Prevention
194
+
195
+ #### Sanitize HTML
196
+ ```typescript
197
+ import DOMPurify from 'isomorphic-dompurify'
198
+
199
+ // ALWAYS sanitize user-provided HTML
200
+ function renderUserContent(html: string) {
201
+ const clean = DOMPurify.sanitize(html, {
202
+ ALLOWED_TAGS: ['b', 'i', 'em', 'strong', 'p'],
203
+ ALLOWED_ATTR: []
204
+ })
205
+ return <div dangerouslySetInnerHTML={{ __html: clean }} />
206
+ }
207
+ ```
208
+
209
+ #### Content Security Policy
210
+ ```typescript
211
+ // next.config.js
212
+ const securityHeaders = [
213
+ {
214
+ key: 'Content-Security-Policy',
215
+ value: `
216
+ default-src 'self';
217
+ script-src 'self' 'unsafe-eval' 'unsafe-inline';
218
+ style-src 'self' 'unsafe-inline';
219
+ img-src 'self' data: https:;
220
+ font-src 'self';
221
+ connect-src 'self' https://api.example.com;
222
+ `.replace(/\s{2,}/g, ' ').trim()
223
+ }
224
+ ]
225
+ ```
226
+
227
+ #### Verification Steps
228
+ - [ ] User-provided HTML sanitized
229
+ - [ ] CSP headers configured
230
+ - [ ] No unvalidated dynamic content rendering
231
+ - [ ] React's built-in XSS protection used
232
+
233
+ ### 6. CSRF Protection
234
+
235
+ #### CSRF Tokens
236
+ ```typescript
237
+ import { csrf } from '@/lib/csrf'
238
+
239
+ export async function POST(request: Request) {
240
+ const token = request.headers.get('X-CSRF-Token')
241
+
242
+ if (!csrf.verify(token)) {
243
+ return NextResponse.json(
244
+ { error: 'Invalid CSRF token' },
245
+ { status: 403 }
246
+ )
247
+ }
248
+
249
+ // Process request
250
+ }
251
+ ```
252
+
253
+ #### SameSite Cookies
254
+ ```typescript
255
+ res.setHeader('Set-Cookie',
256
+ `session=${sessionId}; HttpOnly; Secure; SameSite=Strict`)
257
+ ```
258
+
259
+ #### Verification Steps
260
+ - [ ] CSRF tokens on state-changing operations
261
+ - [ ] SameSite=Strict on all cookies
262
+ - [ ] Double-submit cookie pattern implemented
263
+
264
+ ### 7. Rate Limiting
265
+
266
+ #### API Rate Limiting
267
+ ```typescript
268
+ import rateLimit from 'express-rate-limit'
269
+
270
+ const limiter = rateLimit({
271
+ windowMs: 15 * 60 * 1000, // 15 minutes
272
+ max: 100, // 100 requests per window
273
+ message: 'Too many requests'
274
+ })
275
+
276
+ // Apply to routes
277
+ app.use('/api/', limiter)
278
+ ```
279
+
280
+ #### Expensive Operations
281
+ ```typescript
282
+ // Aggressive rate limiting for searches
283
+ const searchLimiter = rateLimit({
284
+ windowMs: 60 * 1000, // 1 minute
285
+ max: 10, // 10 requests per minute
286
+ message: 'Too many search requests'
287
+ })
288
+
289
+ app.use('/api/search', searchLimiter)
290
+ ```
291
+
292
+ #### Verification Steps
293
+ - [ ] Rate limiting on all API endpoints
294
+ - [ ] Stricter limits on expensive operations
295
+ - [ ] IP-based rate limiting
296
+ - [ ] User-based rate limiting (authenticated)
297
+
298
+ ### 8. Sensitive Data Exposure
299
+
300
+ #### Logging
301
+ ```typescript
302
+ // FAIL: WRONG: Logging sensitive data
303
+ console.log('User login:', { email, password })
304
+ console.log('Payment:', { cardNumber, cvv })
305
+
306
+ // PASS: CORRECT: Redact sensitive data
307
+ console.log('User login:', { email, userId })
308
+ console.log('Payment:', { last4: card.last4, userId })
309
+ ```
310
+
311
+ #### Error Messages
312
+ ```typescript
313
+ // FAIL: WRONG: Exposing internal details
314
+ catch (error) {
315
+ return NextResponse.json(
316
+ { error: error.message, stack: error.stack },
317
+ { status: 500 }
318
+ )
319
+ }
320
+
321
+ // PASS: CORRECT: Generic error messages
322
+ catch (error) {
323
+ console.error('Internal error:', error)
324
+ return NextResponse.json(
325
+ { error: 'An error occurred. Please try again.' },
326
+ { status: 500 }
327
+ )
328
+ }
329
+ ```
330
+
331
+ #### Verification Steps
332
+ - [ ] No passwords, tokens, or secrets in logs
333
+ - [ ] Error messages generic for users
334
+ - [ ] Detailed errors only in server logs
335
+ - [ ] No stack traces exposed to users
336
+
337
+ ### 9. Blockchain Security (Solana)
338
+
339
+ #### Wallet Verification
340
+ ```typescript
341
+ import { verify } from '@solana/web3.js'
342
+
343
+ async function verifyWalletOwnership(
344
+ publicKey: string,
345
+ signature: string,
346
+ message: string
347
+ ) {
348
+ try {
349
+ const isValid = verify(
350
+ Buffer.from(message),
351
+ Buffer.from(signature, 'base64'),
352
+ Buffer.from(publicKey, 'base64')
353
+ )
354
+ return isValid
355
+ } catch (error) {
356
+ return false
357
+ }
358
+ }
359
+ ```
360
+
361
+ #### Transaction Verification
362
+ ```typescript
363
+ async function verifyTransaction(transaction: Transaction) {
364
+ // Verify recipient
365
+ if (transaction.to !== expectedRecipient) {
366
+ throw new Error('Invalid recipient')
367
+ }
368
+
369
+ // Verify amount
370
+ if (transaction.amount > maxAmount) {
371
+ throw new Error('Amount exceeds limit')
372
+ }
373
+
374
+ // Verify user has sufficient balance
375
+ const balance = await getBalance(transaction.from)
376
+ if (balance < transaction.amount) {
377
+ throw new Error('Insufficient balance')
378
+ }
379
+
380
+ return true
381
+ }
382
+ ```
383
+
384
+ #### Verification Steps
385
+ - [ ] Wallet signatures verified
386
+ - [ ] Transaction details validated
387
+ - [ ] Balance checks before transactions
388
+ - [ ] No blind transaction signing
389
+
390
+ ### 10. Dependency Security
391
+
392
+ #### Regular Updates
393
+ ```bash
394
+ # Check for vulnerabilities
395
+ npm audit
396
+
397
+ # Fix automatically fixable issues
398
+ npm audit fix
399
+
400
+ # Update dependencies
401
+ npm update
402
+
403
+ # Check for outdated packages
404
+ npm outdated
405
+ ```
406
+
407
+ #### Lock Files
408
+ ```bash
409
+ # ALWAYS commit lock files
410
+ git add package-lock.json
411
+
412
+ # Use in CI/CD for reproducible builds
413
+ npm ci # Instead of npm install
414
+ ```
415
+
416
+ #### Verification Steps
417
+ - [ ] Dependencies up to date
418
+ - [ ] No known vulnerabilities (npm audit clean)
419
+ - [ ] Lock files committed
420
+ - [ ] Dependabot enabled on GitHub
421
+ - [ ] Regular security updates
422
+
423
+ ## Security Testing
424
+
425
+ ### Automated Security Tests
426
+ ```typescript
427
+ // Test authentication
428
+ test('requires authentication', async () => {
429
+ const response = await fetch('/api/protected')
430
+ expect(response.status).toBe(401)
431
+ })
432
+
433
+ // Test authorization
434
+ test('requires admin role', async () => {
435
+ const response = await fetch('/api/admin', {
436
+ headers: { Authorization: `Bearer ${userToken}` }
437
+ })
438
+ expect(response.status).toBe(403)
439
+ })
440
+
441
+ // Test input validation
442
+ test('rejects invalid input', async () => {
443
+ const response = await fetch('/api/users', {
444
+ method: 'POST',
445
+ body: JSON.stringify({ email: 'not-an-email' })
446
+ })
447
+ expect(response.status).toBe(400)
448
+ })
449
+
450
+ // Test rate limiting
451
+ test('enforces rate limits', async () => {
452
+ const requests = Array(101).fill(null).map(() =>
453
+ fetch('/api/endpoint')
454
+ )
455
+
456
+ const responses = await Promise.all(requests)
457
+ const tooManyRequests = responses.filter(r => r.status === 429)
458
+
459
+ expect(tooManyRequests.length).toBeGreaterThan(0)
460
+ })
461
+ ```
462
+
463
+ ## Pre-Deployment Security Checklist
464
+
465
+ Before ANY production deployment:
466
+
467
+ - [ ] **Secrets**: No hardcoded secrets, all in env vars
468
+ - [ ] **Input Validation**: All user inputs validated
469
+ - [ ] **SQL Injection**: All queries parameterized
470
+ - [ ] **XSS**: User content sanitized
471
+ - [ ] **CSRF**: Protection enabled
472
+ - [ ] **Authentication**: Proper token handling
473
+ - [ ] **Authorization**: Role checks in place
474
+ - [ ] **Rate Limiting**: Enabled on all endpoints
475
+ - [ ] **HTTPS**: Enforced in production
476
+ - [ ] **Security Headers**: CSP, X-Frame-Options configured
477
+ - [ ] **Error Handling**: No sensitive data in errors
478
+ - [ ] **Logging**: No sensitive data logged
479
+ - [ ] **Dependencies**: Up to date, no vulnerabilities
480
+ - [ ] **Row Level Security**: Enabled in Supabase
481
+ - [ ] **CORS**: Properly configured
482
+ - [ ] **File Uploads**: Validated (size, type)
483
+ - [ ] **Wallet Signatures**: Verified (if blockchain)
484
+
485
+ ## Resources
486
+
487
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
488
+ - [Next.js Security](https://nextjs.org/docs/security)
489
+ - [Supabase Security](https://supabase.com/docs/guides/auth)
490
+ - [Web Security Academy](https://portswigger.net/web-security)
491
+
492
+ ---
493
+
494
+ **Remember**: Security is not optional. One vulnerability can compromise the entire platform. When in doubt, err on the side of caution.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Security Review"
3
+ short_description: "Security checklist and vulnerability review"
4
+ brand_color: "#EF4444"
5
+ default_prompt: "Use $security-review to review sensitive code with the security checklist."
6
+ policy:
7
+ allow_implicit_invocation: true