create-raffles-it 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +214 -0
- package/agents/.agents +105 -0
- package/agents/backend-specialist/agent.yaml +21 -0
- package/agents/backend-specialist/prompt.md +255 -0
- package/agents/code-archaeologist/agent.yaml +13 -0
- package/agents/code-archaeologist/prompt.md +98 -0
- package/agents/database-architect/agent.yaml +13 -0
- package/agents/database-architect/prompt.md +218 -0
- package/agents/debugger/agent.yaml +7 -0
- package/agents/debugger/prompt.md +219 -0
- package/agents/devops-engineer/agent.yaml +16 -0
- package/agents/devops-engineer/prompt.md +234 -0
- package/agents/documentation-writer/agent.yaml +13 -0
- package/agents/documentation-writer/prompt.md +96 -0
- package/agents/explorer-agent/agent.yaml +16 -0
- package/agents/explorer-agent/prompt.md +65 -0
- package/agents/frontend-specialist/agent.yaml +17 -0
- package/agents/frontend-specialist/prompt.md +585 -0
- package/agents/orchestrator/agent.yaml +21 -0
- package/agents/orchestrator/prompt.md +408 -0
- package/agents/penetration-tester/agent.yaml +15 -0
- package/agents/penetration-tester/prompt.md +180 -0
- package/agents/performance-optimizer/agent.yaml +13 -0
- package/agents/performance-optimizer/prompt.md +179 -0
- package/agents/product-manager/agent.yaml +12 -0
- package/agents/product-manager/prompt.md +104 -0
- package/agents/product-owner/agent.yaml +12 -0
- package/agents/product-owner/prompt.md +87 -0
- package/agents/project-planner/agent.yaml +13 -0
- package/agents/project-planner/prompt.md +397 -0
- package/agents/qa-automation-engineer/agent.yaml +16 -0
- package/agents/qa-automation-engineer/prompt.md +95 -0
- package/agents/security-auditor/agent.yaml +15 -0
- package/agents/security-auditor/prompt.md +162 -0
- package/agents/seo-specialist/agent.yaml +13 -0
- package/agents/seo-specialist/prompt.md +103 -0
- package/agents/test-engineer/agent.yaml +17 -0
- package/agents/test-engineer/prompt.md +150 -0
- package/bin/commands/help.js +19 -0
- package/bin/commands/init.js +125 -0
- package/bin/commands/list.js +40 -0
- package/bin/index.js +44 -0
- package/bin/utils/logger.js +32 -0
- package/bin/utils/scaffold.js +114 -0
- package/configs/mcp_config.json +24 -0
- package/configs/model.yaml +20 -0
- package/configs/runtime.yaml +22 -0
- package/package.json +56 -0
- package/prompts/planning.md +31 -0
- package/prompts/reflection.md +21 -0
- package/prompts/system.md +24 -0
- package/rules/GEMINI.md +273 -0
- package/skills/api-patterns/SKILL.md +81 -0
- package/skills/api-patterns/api-style.md +42 -0
- package/skills/api-patterns/auth.md +24 -0
- package/skills/api-patterns/documentation.md +26 -0
- package/skills/api-patterns/graphql.md +41 -0
- package/skills/api-patterns/rate-limiting.md +31 -0
- package/skills/api-patterns/response.md +37 -0
- package/skills/api-patterns/rest.md +40 -0
- package/skills/api-patterns/scripts/api_validator.py +211 -0
- package/skills/api-patterns/security-testing.md +122 -0
- package/skills/api-patterns/skill.yaml +3 -0
- package/skills/api-patterns/trpc.md +41 -0
- package/skills/api-patterns/versioning.md +22 -0
- package/skills/architecture/SKILL.md +55 -0
- package/skills/architecture/context-discovery.md +43 -0
- package/skills/architecture/examples.md +94 -0
- package/skills/architecture/pattern-selection.md +68 -0
- package/skills/architecture/patterns-reference.md +50 -0
- package/skills/architecture/skill.yaml +3 -0
- package/skills/architecture/trade-off-analysis.md +77 -0
- package/skills/brainstorming/SKILL.md +163 -0
- package/skills/brainstorming/dynamic-questioning.md +350 -0
- package/skills/brainstorming/skill.yaml +3 -0
- package/skills/clean-code/SKILL.md +201 -0
- package/skills/clean-code/skill.yaml +3 -0
- package/skills/code-review-checklist/SKILL.md +109 -0
- package/skills/code-review-checklist/skill.yaml +3 -0
- package/skills/database-design/SKILL.md +52 -0
- package/skills/database-design/database-selection.md +43 -0
- package/skills/database-design/indexing.md +39 -0
- package/skills/database-design/migrations.md +48 -0
- package/skills/database-design/optimization.md +36 -0
- package/skills/database-design/orm-selection.md +30 -0
- package/skills/database-design/schema-design.md +56 -0
- package/skills/database-design/scripts/schema_validator.py +172 -0
- package/skills/database-design/skill.yaml +3 -0
- package/skills/frontend-design/SKILL.md +452 -0
- package/skills/frontend-design/animation-guide.md +331 -0
- package/skills/frontend-design/color-system.md +311 -0
- package/skills/frontend-design/decision-trees.md +418 -0
- package/skills/frontend-design/motion-graphics.md +306 -0
- package/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/skills/frontend-design/skill.yaml +3 -0
- package/skills/frontend-design/typography-system.md +345 -0
- package/skills/frontend-design/ux-psychology.md +1116 -0
- package/skills/frontend-design/visual-effects.md +383 -0
- package/skills/mcp-builder/SKILL.md +176 -0
- package/skills/mcp-builder/skill.yaml +3 -0
- package/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/skills/nextjs-react-expert/SKILL.md +293 -0
- package/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/skills/nextjs-react-expert/skill.yaml +3 -0
- package/skills/nodejs-best-practices/SKILL.md +333 -0
- package/skills/nodejs-best-practices/skill.yaml +3 -0
- package/skills/parallel-agents/SKILL.md +175 -0
- package/skills/parallel-agents/skill.yaml +3 -0
- package/skills/powershell-windows/SKILL.md +167 -0
- package/skills/powershell-windows/skill.yaml +3 -0
- package/skills/python-patterns/SKILL.md +441 -0
- package/skills/python-patterns/skill.yaml +3 -0
- package/skills/seo-fundamentals/SKILL.md +129 -0
- package/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/skills/seo-fundamentals/skill.yaml +3 -0
- package/skills/systematic-debugging/SKILL.md +109 -0
- package/skills/systematic-debugging/skill.yaml +3 -0
- package/skills/tdd-workflow/SKILL.md +149 -0
- package/skills/tdd-workflow/skill.yaml +3 -0
- package/skills/vulnerability-scanner/SKILL.md +276 -0
- package/skills/vulnerability-scanner/checklists.md +121 -0
- package/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/skills/vulnerability-scanner/skill.yaml +3 -0
- package/skills/web-design-guidelines/SKILL.md +57 -0
- package/skills/web-design-guidelines/skill.yaml +3 -0
- package/skills/webapp-testing/SKILL.md +187 -0
- package/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/skills/webapp-testing/skill.yaml +3 -0
- package/workflows/brainstorm.md +113 -0
- package/workflows/create.md +59 -0
- package/workflows/debug.md +103 -0
- package/workflows/deploy.md +176 -0
- package/workflows/enhance.md +63 -0
- package/workflows/orchestrate.md +237 -0
- package/workflows/plan.md +89 -0
- package/workflows/preview.md +81 -0
- package/workflows/status.md +86 -0
- package/workflows/test.md +144 -0
- package/workflows/ui-ux-pro-max.md +296 -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,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: powershell-windows
|
|
3
|
+
description: PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PowerShell Windows Patterns
|
|
8
|
+
|
|
9
|
+
> Critical patterns and pitfalls for Windows PowerShell.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Operator Syntax Rules
|
|
14
|
+
|
|
15
|
+
### CRITICAL: Parentheses Required
|
|
16
|
+
|
|
17
|
+
| ❌ Wrong | ✅ Correct |
|
|
18
|
+
|----------|-----------|
|
|
19
|
+
| `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` |
|
|
20
|
+
| `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |
|
|
21
|
+
|
|
22
|
+
**Rule:** Each cmdlet call MUST be in parentheses when using logical operators.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. Unicode/Emoji Restriction
|
|
27
|
+
|
|
28
|
+
### CRITICAL: No Unicode in Scripts
|
|
29
|
+
|
|
30
|
+
| Purpose | ❌ Don't Use | ✅ Use |
|
|
31
|
+
|---------|-------------|--------|
|
|
32
|
+
| Success | ✅ ✓ | [OK] [+] |
|
|
33
|
+
| Error | ❌ ✗ 🔴 | [!] [X] |
|
|
34
|
+
| Warning | ⚠️ 🟡 | [*] [WARN] |
|
|
35
|
+
| Info | ℹ️ 🔵 | [i] [INFO] |
|
|
36
|
+
| Progress | ⏳ | [...] |
|
|
37
|
+
|
|
38
|
+
**Rule:** Use ASCII characters only in PowerShell scripts.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. Null Check Patterns
|
|
43
|
+
|
|
44
|
+
### Always Check Before Access
|
|
45
|
+
|
|
46
|
+
| ❌ Wrong | ✅ Correct |
|
|
47
|
+
|----------|-----------|
|
|
48
|
+
| `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |
|
|
49
|
+
| `$text.Length` | `if ($text) { $text.Length }` |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 4. String Interpolation
|
|
54
|
+
|
|
55
|
+
### Complex Expressions
|
|
56
|
+
|
|
57
|
+
| ❌ Wrong | ✅ Correct |
|
|
58
|
+
|----------|-----------|
|
|
59
|
+
| `"Value: $($obj.prop.sub)"` | Store in variable first |
|
|
60
|
+
|
|
61
|
+
**Pattern:**
|
|
62
|
+
```
|
|
63
|
+
$value = $obj.prop.sub
|
|
64
|
+
Write-Output "Value: $value"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 5. Error Handling
|
|
70
|
+
|
|
71
|
+
### ErrorActionPreference
|
|
72
|
+
|
|
73
|
+
| Value | Use |
|
|
74
|
+
|-------|-----|
|
|
75
|
+
| Stop | Development (fail fast) |
|
|
76
|
+
| Continue | Production scripts |
|
|
77
|
+
| SilentlyContinue | When errors expected |
|
|
78
|
+
|
|
79
|
+
### Try/Catch Pattern
|
|
80
|
+
|
|
81
|
+
- Don't return inside try block
|
|
82
|
+
- Use finally for cleanup
|
|
83
|
+
- Return after try/catch
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 6. File Paths
|
|
88
|
+
|
|
89
|
+
### Windows Path Rules
|
|
90
|
+
|
|
91
|
+
| Pattern | Use |
|
|
92
|
+
|---------|-----|
|
|
93
|
+
| Literal path | `C:\Users\User\file.txt` |
|
|
94
|
+
| Variable path | `Join-Path $env:USERPROFILE "file.txt"` |
|
|
95
|
+
| Relative | `Join-Path $ScriptDir "data"` |
|
|
96
|
+
|
|
97
|
+
**Rule:** Use Join-Path for cross-platform safety.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 7. Array Operations
|
|
102
|
+
|
|
103
|
+
### Correct Patterns
|
|
104
|
+
|
|
105
|
+
| Operation | Syntax |
|
|
106
|
+
|-----------|--------|
|
|
107
|
+
| Empty array | `$array = @()` |
|
|
108
|
+
| Add item | `$array += $item` |
|
|
109
|
+
| ArrayList add | `$list.Add($item) | Out-Null` |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 8. JSON Operations
|
|
114
|
+
|
|
115
|
+
### CRITICAL: Depth Parameter
|
|
116
|
+
|
|
117
|
+
| ❌ Wrong | ✅ Correct |
|
|
118
|
+
|----------|-----------|
|
|
119
|
+
| `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |
|
|
120
|
+
|
|
121
|
+
**Rule:** Always specify `-Depth` for nested objects.
|
|
122
|
+
|
|
123
|
+
### File Operations
|
|
124
|
+
|
|
125
|
+
| Operation | Pattern |
|
|
126
|
+
|-----------|---------|
|
|
127
|
+
| Read | `Get-Content "file.json" -Raw | ConvertFrom-Json` |
|
|
128
|
+
| Write | `$data | ConvertTo-Json -Depth 10 | Out-File "file.json" -Encoding UTF8` |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 9. Common Errors
|
|
133
|
+
|
|
134
|
+
| Error Message | Cause | Fix |
|
|
135
|
+
|---------------|-------|-----|
|
|
136
|
+
| "parameter 'or'" | Missing parentheses | Wrap cmdlets in () |
|
|
137
|
+
| "Unexpected token" | Unicode character | Use ASCII only |
|
|
138
|
+
| "Cannot find property" | Null object | Check null first |
|
|
139
|
+
| "Cannot convert" | Type mismatch | Use .ToString() |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 10. Script Template
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
# Strict mode
|
|
147
|
+
Set-StrictMode -Version Latest
|
|
148
|
+
$ErrorActionPreference = "Continue"
|
|
149
|
+
|
|
150
|
+
# Paths
|
|
151
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
152
|
+
|
|
153
|
+
# Main
|
|
154
|
+
try {
|
|
155
|
+
# Logic here
|
|
156
|
+
Write-Output "[OK] Done"
|
|
157
|
+
exit 0
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
Write-Warning "Error: $_"
|
|
161
|
+
exit 1
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
> **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.
|