codehava-agent-kit 1.0.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 (235) hide show
  1. package/README.md +56 -0
  2. package/bin/cli.js +56 -0
  3. package/package.json +26 -0
  4. package/templates/.agent/.shared/ui-ux-pro-max/data/charts.csv +26 -0
  5. package/templates/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
  6. package/templates/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
  7. package/templates/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
  8. package/templates/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
  9. package/templates/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
  10. package/templates/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
  11. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  12. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  13. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  14. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  15. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  16. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  17. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  18. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
  19. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  20. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  21. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  22. package/templates/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  23. package/templates/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
  24. package/templates/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
  25. package/templates/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  26. package/templates/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  27. package/templates/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
  28. package/templates/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
  29. package/templates/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
  30. package/templates/.agent/.shared/ui-ux-pro-max/scripts/core.py +258 -0
  31. package/templates/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
  32. package/templates/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
  33. package/templates/.agent/agents/backend-specialist.md +263 -0
  34. package/templates/.agent/agents/code-archaeologist.md +106 -0
  35. package/templates/.agent/agents/database-architect.md +226 -0
  36. package/templates/.agent/agents/debugger.md +225 -0
  37. package/templates/.agent/agents/devops-engineer.md +242 -0
  38. package/templates/.agent/agents/documentation-writer.md +104 -0
  39. package/templates/.agent/agents/explorer-agent.md +73 -0
  40. package/templates/.agent/agents/frontend-specialist.md +593 -0
  41. package/templates/.agent/agents/game-developer.md +162 -0
  42. package/templates/.agent/agents/mobile-developer.md +377 -0
  43. package/templates/.agent/agents/orchestrator.md +416 -0
  44. package/templates/.agent/agents/penetration-tester.md +188 -0
  45. package/templates/.agent/agents/performance-optimizer.md +187 -0
  46. package/templates/.agent/agents/product-manager.md +112 -0
  47. package/templates/.agent/agents/product-owner.md +95 -0
  48. package/templates/.agent/agents/project-planner.md +406 -0
  49. package/templates/.agent/agents/qa-automation-engineer.md +103 -0
  50. package/templates/.agent/agents/security-auditor.md +170 -0
  51. package/templates/.agent/agents/seo-specialist.md +111 -0
  52. package/templates/.agent/agents/test-engineer.md +158 -0
  53. package/templates/.agent/mcp_config.json +129 -0
  54. package/templates/.agent/rules/GEMINI.md +273 -0
  55. package/templates/.agent/scripts/auto_preview.py +148 -0
  56. package/templates/.agent/scripts/checklist.py +217 -0
  57. package/templates/.agent/scripts/session_manager.py +120 -0
  58. package/templates/.agent/scripts/verify_all.py +327 -0
  59. package/templates/.agent/skills/api-patterns/SKILL.md +81 -0
  60. package/templates/.agent/skills/api-patterns/api-style.md +42 -0
  61. package/templates/.agent/skills/api-patterns/auth.md +24 -0
  62. package/templates/.agent/skills/api-patterns/documentation.md +26 -0
  63. package/templates/.agent/skills/api-patterns/graphql.md +41 -0
  64. package/templates/.agent/skills/api-patterns/rate-limiting.md +31 -0
  65. package/templates/.agent/skills/api-patterns/response.md +37 -0
  66. package/templates/.agent/skills/api-patterns/rest.md +40 -0
  67. package/templates/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  68. package/templates/.agent/skills/api-patterns/security-testing.md +122 -0
  69. package/templates/.agent/skills/api-patterns/trpc.md +41 -0
  70. package/templates/.agent/skills/api-patterns/versioning.md +22 -0
  71. package/templates/.agent/skills/app-builder/SKILL.md +75 -0
  72. package/templates/.agent/skills/app-builder/agent-coordination.md +71 -0
  73. package/templates/.agent/skills/app-builder/feature-building.md +53 -0
  74. package/templates/.agent/skills/app-builder/project-detection.md +34 -0
  75. package/templates/.agent/skills/app-builder/scaffolding.md +118 -0
  76. package/templates/.agent/skills/app-builder/tech-stack.md +41 -0
  77. package/templates/.agent/skills/app-builder/templates/SKILL.md +39 -0
  78. package/templates/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  79. package/templates/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  80. package/templates/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  81. package/templates/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  82. package/templates/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  83. package/templates/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  84. package/templates/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  85. package/templates/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  86. package/templates/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  87. package/templates/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  88. package/templates/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  89. package/templates/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  90. package/templates/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  91. package/templates/.agent/skills/architecture/SKILL.md +55 -0
  92. package/templates/.agent/skills/architecture/context-discovery.md +43 -0
  93. package/templates/.agent/skills/architecture/examples.md +94 -0
  94. package/templates/.agent/skills/architecture/pattern-selection.md +68 -0
  95. package/templates/.agent/skills/architecture/patterns-reference.md +50 -0
  96. package/templates/.agent/skills/architecture/trade-off-analysis.md +77 -0
  97. package/templates/.agent/skills/bash-linux/SKILL.md +199 -0
  98. package/templates/.agent/skills/behavioral-modes/SKILL.md +242 -0
  99. package/templates/.agent/skills/better-auth-patterns/SKILL.md +121 -0
  100. package/templates/.agent/skills/brainstorming/SKILL.md +163 -0
  101. package/templates/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  102. package/templates/.agent/skills/bullmq-worker/SKILL.md +124 -0
  103. package/templates/.agent/skills/clean-code/SKILL.md +201 -0
  104. package/templates/.agent/skills/code-review-checklist/SKILL.md +109 -0
  105. package/templates/.agent/skills/database-design/SKILL.md +52 -0
  106. package/templates/.agent/skills/database-design/database-selection.md +43 -0
  107. package/templates/.agent/skills/database-design/indexing.md +39 -0
  108. package/templates/.agent/skills/database-design/migrations.md +48 -0
  109. package/templates/.agent/skills/database-design/optimization.md +36 -0
  110. package/templates/.agent/skills/database-design/orm-selection.md +30 -0
  111. package/templates/.agent/skills/database-design/schema-design.md +56 -0
  112. package/templates/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  113. package/templates/.agent/skills/deployment-procedures/SKILL.md +241 -0
  114. package/templates/.agent/skills/doc.md +177 -0
  115. package/templates/.agent/skills/documentation-templates/SKILL.md +194 -0
  116. package/templates/.agent/skills/feature-spec-writer/SKILL.md +76 -0
  117. package/templates/.agent/skills/frontend-design/SKILL.md +452 -0
  118. package/templates/.agent/skills/frontend-design/animation-guide.md +331 -0
  119. package/templates/.agent/skills/frontend-design/color-system.md +311 -0
  120. package/templates/.agent/skills/frontend-design/decision-trees.md +418 -0
  121. package/templates/.agent/skills/frontend-design/motion-graphics.md +306 -0
  122. package/templates/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  123. package/templates/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  124. package/templates/.agent/skills/frontend-design/typography-system.md +345 -0
  125. package/templates/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  126. package/templates/.agent/skills/frontend-design/visual-effects.md +383 -0
  127. package/templates/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  128. package/templates/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  129. package/templates/.agent/skills/game-development/SKILL.md +167 -0
  130. package/templates/.agent/skills/game-development/game-art/SKILL.md +185 -0
  131. package/templates/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  132. package/templates/.agent/skills/game-development/game-design/SKILL.md +129 -0
  133. package/templates/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  134. package/templates/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  135. package/templates/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  136. package/templates/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  137. package/templates/.agent/skills/game-development/web-games/SKILL.md +150 -0
  138. package/templates/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  139. package/templates/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  140. package/templates/.agent/skills/i18n-localization/SKILL.md +154 -0
  141. package/templates/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  142. package/templates/.agent/skills/intelligent-routing/SKILL.md +335 -0
  143. package/templates/.agent/skills/lint-and-validate/SKILL.md +45 -0
  144. package/templates/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  145. package/templates/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  146. package/templates/.agent/skills/mcp-builder/SKILL.md +176 -0
  147. package/templates/.agent/skills/mobile-design/SKILL.md +394 -0
  148. package/templates/.agent/skills/mobile-design/decision-trees.md +516 -0
  149. package/templates/.agent/skills/mobile-design/mobile-backend.md +491 -0
  150. package/templates/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  151. package/templates/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  152. package/templates/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  153. package/templates/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  154. package/templates/.agent/skills/mobile-design/mobile-performance.md +767 -0
  155. package/templates/.agent/skills/mobile-design/mobile-testing.md +356 -0
  156. package/templates/.agent/skills/mobile-design/mobile-typography.md +433 -0
  157. package/templates/.agent/skills/mobile-design/platform-android.md +666 -0
  158. package/templates/.agent/skills/mobile-design/platform-ios.md +561 -0
  159. package/templates/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  160. package/templates/.agent/skills/mobile-design/touch-psychology.md +537 -0
  161. package/templates/.agent/skills/neo-storage/SKILL.md +115 -0
  162. package/templates/.agent/skills/nextjs-api-route/SKILL.md +134 -0
  163. package/templates/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
  164. package/templates/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  165. package/templates/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  166. package/templates/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  167. package/templates/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  168. package/templates/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  169. package/templates/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  170. package/templates/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  171. package/templates/.agent/skills/nextjs-react-expert/9-cache-components.md +103 -0
  172. package/templates/.agent/skills/nextjs-react-expert/SKILL.md +293 -0
  173. package/templates/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  174. package/templates/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  175. package/templates/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  176. package/templates/.agent/skills/parallel-agents/SKILL.md +175 -0
  177. package/templates/.agent/skills/performance-profiling/SKILL.md +143 -0
  178. package/templates/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  179. package/templates/.agent/skills/plan-writing/SKILL.md +152 -0
  180. package/templates/.agent/skills/powershell-windows/SKILL.md +167 -0
  181. package/templates/.agent/skills/prisma-7-patterns/SKILL.md +91 -0
  182. package/templates/.agent/skills/python-patterns/SKILL.md +441 -0
  183. package/templates/.agent/skills/red-team-tactics/SKILL.md +199 -0
  184. package/templates/.agent/skills/rust-pro/SKILL.md +176 -0
  185. package/templates/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  186. package/templates/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  187. package/templates/.agent/skills/server-management/SKILL.md +161 -0
  188. package/templates/.agent/skills/systematic-debugging/SKILL.md +109 -0
  189. package/templates/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  190. package/templates/.agent/skills/tdd-workflow/SKILL.md +149 -0
  191. package/templates/.agent/skills/testing-patterns/SKILL.md +178 -0
  192. package/templates/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  193. package/templates/.agent/skills/uu-pdp-feature-check/SKILL.md +116 -0
  194. package/templates/.agent/skills/vibe-buildplan/SKILL.md +232 -0
  195. package/templates/.agent/skills/vibe-prd/SKILL.md +226 -0
  196. package/templates/.agent/skills/vibe-research/SKILL.md +162 -0
  197. package/templates/.agent/skills/vibe-techdesign/SKILL.md +195 -0
  198. package/templates/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  199. package/templates/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  200. package/templates/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  201. package/templates/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  202. package/templates/.agent/skills/webapp-testing/SKILL.md +187 -0
  203. package/templates/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  204. package/templates/.agent/skills/xendit-integration/SKILL.md +100 -0
  205. package/templates/.agent/snippets/@react-component-template.tsx +29 -0
  206. package/templates/.agent/workflows/brainstorm.md +113 -0
  207. package/templates/.agent/workflows/create.md +59 -0
  208. package/templates/.agent/workflows/db-migrate.md +26 -0
  209. package/templates/.agent/workflows/debug.md +103 -0
  210. package/templates/.agent/workflows/deploy.md +35 -0
  211. package/templates/.agent/workflows/dev-reset.md +40 -0
  212. package/templates/.agent/workflows/enhance.md +63 -0
  213. package/templates/.agent/workflows/git-commit.md +24 -0
  214. package/templates/.agent/workflows/health-check.md +34 -0
  215. package/templates/.agent/workflows/new-feature.md +32 -0
  216. package/templates/.agent/workflows/orchestrate.md +237 -0
  217. package/templates/.agent/workflows/plan.md +89 -0
  218. package/templates/.agent/workflows/preview.md +81 -0
  219. package/templates/.agent/workflows/status.md +86 -0
  220. package/templates/.agent/workflows/test.md +144 -0
  221. package/templates/.agent/workflows/ui-ux-pro-max.md +296 -0
  222. package/templates/.agent/workflows/vibe-plan.md +133 -0
  223. package/templates/.agent/workflows/vibe-recap.md +17 -0
  224. package/templates/.antigravity/rules.md +64 -0
  225. package/templates/AGENTS.md +268 -0
  226. package/templates/docs/00A-PROJECT-CHARTER.md +33 -0
  227. package/templates/docs/00B-BRD.md +25 -0
  228. package/templates/docs/01-PRD.md +122 -0
  229. package/templates/docs/01B-SRS-LENGKAP.md +60 -0
  230. package/templates/docs/02-TECH-DESIGN.md +491 -0
  231. package/templates/docs/03-UI-GUIDELINES.md +301 -0
  232. package/templates/docs/04-BACKLOG.md +127 -0
  233. package/templates/docs/05-DEPLOYMENT.md +363 -0
  234. package/templates/docs/06-DEVELOPMENT-LOG.md +78 -0
  235. package/templates/specs/README.md +54 -0
@@ -0,0 +1,333 @@
1
+ ---
2
+ name: nodejs-best-practices
3
+ description: Node.js development principles and decision-making. Framework selection, async patterns, security, and architecture. Teaches thinking, not copying.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ ---
6
+
7
+ # Node.js Best Practices
8
+
9
+ > Principles and decision-making for Node.js development in 2025.
10
+ > **Learn to THINK, not memorize code patterns.**
11
+
12
+ ---
13
+
14
+ ## ⚠️ How to Use This Skill
15
+
16
+ This skill teaches **decision-making principles**, not fixed code to copy.
17
+
18
+ - ASK user for preferences when unclear
19
+ - Choose framework/pattern based on CONTEXT
20
+ - Don't default to same solution every time
21
+
22
+ ---
23
+
24
+ ## 1. Framework Selection (2025)
25
+
26
+ ### Decision Tree
27
+
28
+ ```
29
+ What are you building?
30
+
31
+ ├── Edge/Serverless (Cloudflare, Vercel)
32
+ │ └── Hono (zero-dependency, ultra-fast cold starts)
33
+
34
+ ├── High Performance API
35
+ │ └── Fastify (2-3x faster than Express)
36
+
37
+ ├── Enterprise/Team familiarity
38
+ │ └── NestJS (structured, DI, decorators)
39
+
40
+ ├── Legacy/Stable/Maximum ecosystem
41
+ │ └── Express (mature, most middleware)
42
+
43
+ └── Full-stack with frontend
44
+ └── Next.js API Routes or tRPC
45
+ ```
46
+
47
+ ### Comparison Principles
48
+
49
+ | Factor | Hono | Fastify | Express |
50
+ |--------|------|---------|---------|
51
+ | **Best for** | Edge, serverless | Performance | Legacy, learning |
52
+ | **Cold start** | Fastest | Fast | Moderate |
53
+ | **Ecosystem** | Growing | Good | Largest |
54
+ | **TypeScript** | Native | Excellent | Good |
55
+ | **Learning curve** | Low | Medium | Low |
56
+
57
+ ### Selection Questions to Ask:
58
+ 1. What's the deployment target?
59
+ 2. Is cold start time critical?
60
+ 3. Does team have existing experience?
61
+ 4. Is there legacy code to maintain?
62
+
63
+ ---
64
+
65
+ ## 2. Runtime Considerations (2025)
66
+
67
+ ### Native TypeScript
68
+
69
+ ```
70
+ Node.js 22+: --experimental-strip-types
71
+ ├── Run .ts files directly
72
+ ├── No build step needed for simple projects
73
+ └── Consider for: scripts, simple APIs
74
+ ```
75
+
76
+ ### Module System Decision
77
+
78
+ ```
79
+ ESM (import/export)
80
+ ├── Modern standard
81
+ ├── Better tree-shaking
82
+ ├── Async module loading
83
+ └── Use for: new projects
84
+
85
+ CommonJS (require)
86
+ ├── Legacy compatibility
87
+ ├── More npm packages support
88
+ └── Use for: existing codebases, some edge cases
89
+ ```
90
+
91
+ ### Runtime Selection
92
+
93
+ | Runtime | Best For |
94
+ |---------|----------|
95
+ | **Node.js** | General purpose, largest ecosystem |
96
+ | **Bun** | Performance, built-in bundler |
97
+ | **Deno** | Security-first, built-in TypeScript |
98
+
99
+ ---
100
+
101
+ ## 3. Architecture Principles
102
+
103
+ ### Layered Structure Concept
104
+
105
+ ```
106
+ Request Flow:
107
+
108
+ ├── Controller/Route Layer
109
+ │ ├── Handles HTTP specifics
110
+ │ ├── Input validation at boundary
111
+ │ └── Calls service layer
112
+
113
+ ├── Service Layer
114
+ │ ├── Business logic
115
+ │ ├── Framework-agnostic
116
+ │ └── Calls repository layer
117
+
118
+ └── Repository Layer
119
+ ├── Data access only
120
+ ├── Database queries
121
+ └── ORM interactions
122
+ ```
123
+
124
+ ### Why This Matters:
125
+ - **Testability**: Mock layers independently
126
+ - **Flexibility**: Swap database without touching business logic
127
+ - **Clarity**: Each layer has single responsibility
128
+
129
+ ### When to Simplify:
130
+ - Small scripts → Single file OK
131
+ - Prototypes → Less structure acceptable
132
+ - Always ask: "Will this grow?"
133
+
134
+ ---
135
+
136
+ ## 4. Error Handling Principles
137
+
138
+ ### Centralized Error Handling
139
+
140
+ ```
141
+ Pattern:
142
+ ├── Create custom error classes
143
+ ├── Throw from any layer
144
+ ├── Catch at top level (middleware)
145
+ └── Format consistent response
146
+ ```
147
+
148
+ ### Error Response Philosophy
149
+
150
+ ```
151
+ Client gets:
152
+ ├── Appropriate HTTP status
153
+ ├── Error code for programmatic handling
154
+ ├── User-friendly message
155
+ └── NO internal details (security!)
156
+
157
+ Logs get:
158
+ ├── Full stack trace
159
+ ├── Request context
160
+ ├── User ID (if applicable)
161
+ └── Timestamp
162
+ ```
163
+
164
+ ### Status Code Selection
165
+
166
+ | Situation | Status | When |
167
+ |-----------|--------|------|
168
+ | Bad input | 400 | Client sent invalid data |
169
+ | No auth | 401 | Missing or invalid credentials |
170
+ | No permission | 403 | Valid auth, but not allowed |
171
+ | Not found | 404 | Resource doesn't exist |
172
+ | Conflict | 409 | Duplicate or state conflict |
173
+ | Validation | 422 | Schema valid but business rules fail |
174
+ | Server error | 500 | Our fault, log everything |
175
+
176
+ ---
177
+
178
+ ## 5. Async Patterns Principles
179
+
180
+ ### When to Use Each
181
+
182
+ | Pattern | Use When |
183
+ |---------|----------|
184
+ | `async/await` | Sequential async operations |
185
+ | `Promise.all` | Parallel independent operations |
186
+ | `Promise.allSettled` | Parallel where some can fail |
187
+ | `Promise.race` | Timeout or first response wins |
188
+
189
+ ### Event Loop Awareness
190
+
191
+ ```
192
+ I/O-bound (async helps):
193
+ ├── Database queries
194
+ ├── HTTP requests
195
+ ├── File system
196
+ └── Network operations
197
+
198
+ CPU-bound (async doesn't help):
199
+ ├── Crypto operations
200
+ ├── Image processing
201
+ ├── Complex calculations
202
+ └── → Use worker threads or offload
203
+ ```
204
+
205
+ ### Avoiding Event Loop Blocking
206
+
207
+ - Never use sync methods in production (fs.readFileSync, etc.)
208
+ - Offload CPU-intensive work
209
+ - Use streaming for large data
210
+
211
+ ---
212
+
213
+ ## 6. Validation Principles
214
+
215
+ ### Validate at Boundaries
216
+
217
+ ```
218
+ Where to validate:
219
+ ├── API entry point (request body/params)
220
+ ├── Before database operations
221
+ ├── External data (API responses, file uploads)
222
+ └── Environment variables (startup)
223
+ ```
224
+
225
+ ### Validation Library Selection
226
+
227
+ | Library | Best For |
228
+ |---------|----------|
229
+ | **Zod** | TypeScript first, inference |
230
+ | **Valibot** | Smaller bundle (tree-shakeable) |
231
+ | **ArkType** | Performance critical |
232
+ | **Yup** | Existing React Form usage |
233
+
234
+ ### Validation Philosophy
235
+
236
+ - Fail fast: Validate early
237
+ - Be specific: Clear error messages
238
+ - Don't trust: Even "internal" data
239
+
240
+ ---
241
+
242
+ ## 7. Security Principles
243
+
244
+ ### Security Checklist (Not Code)
245
+
246
+ - [ ] **Input validation**: All inputs validated
247
+ - [ ] **Parameterized queries**: No string concatenation for SQL
248
+ - [ ] **Password hashing**: bcrypt or argon2
249
+ - [ ] **JWT verification**: Always verify signature and expiry
250
+ - [ ] **Rate limiting**: Protect from abuse
251
+ - [ ] **Security headers**: Helmet.js or equivalent
252
+ - [ ] **HTTPS**: Everywhere in production
253
+ - [ ] **CORS**: Properly configured
254
+ - [ ] **Secrets**: Environment variables only
255
+ - [ ] **Dependencies**: Regularly audited
256
+
257
+ ### Security Mindset
258
+
259
+ ```
260
+ Trust nothing:
261
+ ├── Query params → validate
262
+ ├── Request body → validate
263
+ ├── Headers → verify
264
+ ├── Cookies → validate
265
+ ├── File uploads → scan
266
+ └── External APIs → validate response
267
+ ```
268
+
269
+ ---
270
+
271
+ ## 8. Testing Principles
272
+
273
+ ### Test Strategy Selection
274
+
275
+ | Type | Purpose | Tools |
276
+ |------|---------|-------|
277
+ | **Unit** | Business logic | node:test, Vitest |
278
+ | **Integration** | API endpoints | Supertest |
279
+ | **E2E** | Full flows | Playwright |
280
+
281
+ ### What to Test (Priorities)
282
+
283
+ 1. **Critical paths**: Auth, payments, core business
284
+ 2. **Edge cases**: Empty inputs, boundaries
285
+ 3. **Error handling**: What happens when things fail?
286
+ 4. **Not worth testing**: Framework code, trivial getters
287
+
288
+ ### Built-in Test Runner (Node.js 22+)
289
+
290
+ ```
291
+ node --test src/**/*.test.ts
292
+ ├── No external dependency
293
+ ├── Good coverage reporting
294
+ └── Watch mode available
295
+ ```
296
+
297
+ ---
298
+
299
+ ## 10. Anti-Patterns to Avoid
300
+
301
+ ### ❌ DON'T:
302
+ - Use Express for new edge projects (use Hono)
303
+ - Use sync methods in production code
304
+ - Put business logic in controllers
305
+ - Skip input validation
306
+ - Hardcode secrets
307
+ - Trust external data without validation
308
+ - Block event loop with CPU work
309
+
310
+ ### ✅ DO:
311
+ - Choose framework based on context
312
+ - Ask user for preferences when unclear
313
+ - Use layered architecture for growing projects
314
+ - Validate all inputs
315
+ - Use environment variables for secrets
316
+ - Profile before optimizing
317
+
318
+ ---
319
+
320
+ ## 11. Decision Checklist
321
+
322
+ Before implementing:
323
+
324
+ - [ ] **Asked user about stack preference?**
325
+ - [ ] **Chosen framework for THIS context?** (not just default)
326
+ - [ ] **Considered deployment target?**
327
+ - [ ] **Planned error handling strategy?**
328
+ - [ ] **Identified validation points?**
329
+ - [ ] **Considered security requirements?**
330
+
331
+ ---
332
+
333
+ > **Remember**: Node.js best practices are about decision-making, not memorizing patterns. Every project deserves fresh consideration based on its requirements.
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: parallel-agents
3
+ description: Multi-agent orchestration patterns. Use when multiple independent tasks can run with different domain expertise or when comprehensive analysis requires multiple perspectives.
4
+ allowed-tools: Read, Glob, Grep
5
+ ---
6
+
7
+ # Native Parallel Agents
8
+
9
+ > Orchestration through Antigravity's built-in Agent Tool
10
+
11
+ ## Overview
12
+
13
+ This skill enables coordinating multiple specialized agents through Antigravity's native agent system. Unlike external scripts, this approach keeps all orchestration within Antigravity's control.
14
+
15
+ ## When to Use Orchestration
16
+
17
+ ✅ **Good for:**
18
+ - Complex tasks requiring multiple expertise domains
19
+ - Code analysis from security, performance, and quality perspectives
20
+ - Comprehensive reviews (architecture + security + testing)
21
+ - Feature implementation needing backend + frontend + database work
22
+
23
+ ❌ **Not for:**
24
+ - Simple, single-domain tasks
25
+ - Quick fixes or small changes
26
+ - Tasks where one agent suffices
27
+
28
+ ---
29
+
30
+ ## Native Agent Invocation
31
+
32
+ ### Single Agent
33
+ ```
34
+ Use the security-auditor agent to review authentication
35
+ ```
36
+
37
+ ### Sequential Chain
38
+ ```
39
+ First, use the explorer-agent to discover project structure.
40
+ Then, use the backend-specialist to review API endpoints.
41
+ Finally, use the test-engineer to identify test gaps.
42
+ ```
43
+
44
+ ### With Context Passing
45
+ ```
46
+ Use the frontend-specialist to analyze React components.
47
+ Based on those findings, have the test-engineer generate component tests.
48
+ ```
49
+
50
+ ### Resume Previous Work
51
+ ```
52
+ Resume agent [agentId] and continue with additional requirements.
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Orchestration Patterns
58
+
59
+ ### Pattern 1: Comprehensive Analysis
60
+ ```
61
+ Agents: explorer-agent → [domain-agents] → synthesis
62
+
63
+ 1. explorer-agent: Map codebase structure
64
+ 2. security-auditor: Security posture
65
+ 3. backend-specialist: API quality
66
+ 4. frontend-specialist: UI/UX patterns
67
+ 5. test-engineer: Test coverage
68
+ 6. Synthesize all findings
69
+ ```
70
+
71
+ ### Pattern 2: Feature Review
72
+ ```
73
+ Agents: affected-domain-agents → test-engineer
74
+
75
+ 1. Identify affected domains (backend? frontend? both?)
76
+ 2. Invoke relevant domain agents
77
+ 3. test-engineer verifies changes
78
+ 4. Synthesize recommendations
79
+ ```
80
+
81
+ ### Pattern 3: Security Audit
82
+ ```
83
+ Agents: security-auditor → penetration-tester → synthesis
84
+
85
+ 1. security-auditor: Configuration and code review
86
+ 2. penetration-tester: Active vulnerability testing
87
+ 3. Synthesize with prioritized remediation
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Available Agents
93
+
94
+ | Agent | Expertise | Trigger Phrases |
95
+ |-------|-----------|-----------------|
96
+ | `orchestrator` | Coordination | "comprehensive", "multi-perspective" |
97
+ | `security-auditor` | Security | "security", "auth", "vulnerabilities" |
98
+ | `penetration-tester` | Security Testing | "pentest", "red team", "exploit" |
99
+ | `backend-specialist` | Backend | "API", "server", "Node.js", "Express" |
100
+ | `frontend-specialist` | Frontend | "React", "UI", "components", "Next.js" |
101
+ | `test-engineer` | Testing | "tests", "coverage", "TDD" |
102
+ | `devops-engineer` | DevOps | "deploy", "CI/CD", "infrastructure" |
103
+ | `database-architect` | Database | "schema", "Prisma", "migrations" |
104
+ | `mobile-developer` | Mobile | "React Native", "Flutter", "mobile" |
105
+ | `api-designer` | API Design | "REST", "GraphQL", "OpenAPI" |
106
+ | `debugger` | Debugging | "bug", "error", "not working" |
107
+ | `explorer-agent` | Discovery | "explore", "map", "structure" |
108
+ | `documentation-writer` | Documentation | "write docs", "create README", "generate API docs" |
109
+ | `performance-optimizer` | Performance | "slow", "optimize", "profiling" |
110
+ | `project-planner` | Planning | "plan", "roadmap", "milestones" |
111
+ | `seo-specialist` | SEO | "SEO", "meta tags", "search ranking" |
112
+ | `game-developer` | Game Development | "game", "Unity", "Godot", "Phaser" |
113
+
114
+ ---
115
+
116
+ ## Antigravity Built-in Agents
117
+
118
+ These work alongside custom agents:
119
+
120
+ | Agent | Model | Purpose |
121
+ |-------|-------|---------|
122
+ | **Explore** | Haiku | Fast read-only codebase search |
123
+ | **Plan** | Sonnet | Research during plan mode |
124
+ | **General-purpose** | Sonnet | Complex multi-step modifications |
125
+
126
+ Use **Explore** for quick searches, **custom agents** for domain expertise.
127
+
128
+ ---
129
+
130
+ ## Synthesis Protocol
131
+
132
+ After all agents complete, synthesize:
133
+
134
+ ```markdown
135
+ ## Orchestration Synthesis
136
+
137
+ ### Task Summary
138
+ [What was accomplished]
139
+
140
+ ### Agent Contributions
141
+ | Agent | Finding |
142
+ |-------|---------|
143
+ | security-auditor | Found X |
144
+ | backend-specialist | Identified Y |
145
+
146
+ ### Consolidated Recommendations
147
+ 1. **Critical**: [Issue from Agent A]
148
+ 2. **Important**: [Issue from Agent B]
149
+ 3. **Nice-to-have**: [Enhancement from Agent C]
150
+
151
+ ### Action Items
152
+ - [ ] Fix critical security issue
153
+ - [ ] Refactor API endpoint
154
+ - [ ] Add missing tests
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Best Practices
160
+
161
+ 1. **Available agents** - 17 specialized agents can be orchestrated
162
+ 2. **Logical order** - Discovery → Analysis → Implementation → Testing
163
+ 3. **Share context** - Pass relevant findings to subsequent agents
164
+ 4. **Single synthesis** - One unified report, not separate outputs
165
+ 5. **Verify changes** - Always include test-engineer for code modifications
166
+
167
+ ---
168
+
169
+ ## Key Benefits
170
+
171
+ - ✅ **Single session** - All agents share context
172
+ - ✅ **AI-controlled** - Claude orchestrates autonomously
173
+ - ✅ **Native integration** - Works with built-in Explore, Plan agents
174
+ - ✅ **Resume support** - Can continue previous agent work
175
+ - ✅ **Context passing** - Findings flow between agents
@@ -0,0 +1,143 @@
1
+ ---
2
+ name: performance-profiling
3
+ description: Performance profiling principles. Measurement, analysis, and optimization techniques.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Performance Profiling
8
+
9
+ > Measure, analyze, optimize - in that order.
10
+
11
+ ## 🔧 Runtime Scripts
12
+
13
+ **Execute these for automated profiling:**
14
+
15
+ | Script | Purpose | Usage |
16
+ |--------|---------|-------|
17
+ | `scripts/lighthouse_audit.py` | Lighthouse performance audit | `python scripts/lighthouse_audit.py https://example.com` |
18
+
19
+ ---
20
+
21
+ ## 1. Core Web Vitals
22
+
23
+ ### Targets
24
+
25
+ | Metric | Good | Poor | Measures |
26
+ |--------|------|------|----------|
27
+ | **LCP** | < 2.5s | > 4.0s | Loading |
28
+ | **INP** | < 200ms | > 500ms | Interactivity |
29
+ | **CLS** | < 0.1 | > 0.25 | Stability |
30
+
31
+ ### When to Measure
32
+
33
+ | Stage | Tool |
34
+ |-------|------|
35
+ | Development | Local Lighthouse |
36
+ | CI/CD | Lighthouse CI |
37
+ | Production | RUM (Real User Monitoring) |
38
+
39
+ ---
40
+
41
+ ## 2. Profiling Workflow
42
+
43
+ ### The 4-Step Process
44
+
45
+ ```
46
+ 1. BASELINE → Measure current state
47
+ 2. IDENTIFY → Find the bottleneck
48
+ 3. FIX → Make targeted change
49
+ 4. VALIDATE → Confirm improvement
50
+ ```
51
+
52
+ ### Profiling Tool Selection
53
+
54
+ | Problem | Tool |
55
+ |---------|------|
56
+ | Page load | Lighthouse |
57
+ | Bundle size | Bundle analyzer |
58
+ | Runtime | DevTools Performance |
59
+ | Memory | DevTools Memory |
60
+ | Network | DevTools Network |
61
+
62
+ ---
63
+
64
+ ## 3. Bundle Analysis
65
+
66
+ ### What to Look For
67
+
68
+ | Issue | Indicator |
69
+ |-------|-----------|
70
+ | Large dependencies | Top of bundle |
71
+ | Duplicate code | Multiple chunks |
72
+ | Unused code | Low coverage |
73
+ | Missing splits | Single large chunk |
74
+
75
+ ### Optimization Actions
76
+
77
+ | Finding | Action |
78
+ |---------|--------|
79
+ | Big library | Import specific modules |
80
+ | Duplicate deps | Dedupe, update versions |
81
+ | Route in main | Code split |
82
+ | Unused exports | Tree shake |
83
+
84
+ ---
85
+
86
+ ## 4. Runtime Profiling
87
+
88
+ ### Performance Tab Analysis
89
+
90
+ | Pattern | Meaning |
91
+ |---------|---------|
92
+ | Long tasks (>50ms) | UI blocking |
93
+ | Many small tasks | Possible batching opportunity |
94
+ | Layout/paint | Rendering bottleneck |
95
+ | Script | JavaScript execution |
96
+
97
+ ### Memory Tab Analysis
98
+
99
+ | Pattern | Meaning |
100
+ |---------|---------|
101
+ | Growing heap | Possible leak |
102
+ | Large retained | Check references |
103
+ | Detached DOM | Not cleaned up |
104
+
105
+ ---
106
+
107
+ ## 5. Common Bottlenecks
108
+
109
+ ### By Symptom
110
+
111
+ | Symptom | Likely Cause |
112
+ |---------|--------------|
113
+ | Slow initial load | Large JS, render blocking |
114
+ | Slow interactions | Heavy event handlers |
115
+ | Jank during scroll | Layout thrashing |
116
+ | Growing memory | Leaks, retained refs |
117
+
118
+ ---
119
+
120
+ ## 6. Quick Win Priorities
121
+
122
+ | Priority | Action | Impact |
123
+ |----------|--------|--------|
124
+ | 1 | Enable compression | High |
125
+ | 2 | Lazy load images | High |
126
+ | 3 | Code split routes | High |
127
+ | 4 | Cache static assets | Medium |
128
+ | 5 | Optimize images | Medium |
129
+
130
+ ---
131
+
132
+ ## 7. Anti-Patterns
133
+
134
+ | ❌ Don't | ✅ Do |
135
+ |----------|-------|
136
+ | Guess at problems | Profile first |
137
+ | Micro-optimize | Fix biggest issue |
138
+ | Optimize early | Optimize when needed |
139
+ | Ignore real users | Use RUM data |
140
+
141
+ ---
142
+
143
+ > **Remember:** The fastest code is code that doesn't run. Remove before optimizing.