@neyugn/agent-kits 0.5.0 → 0.5.3
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/README.md +66 -81
- package/README.vi.md +79 -52
- package/README.zh.md +69 -88
- package/common/skills/filter-agent/SKILL.md +33 -45
- package/common/skills/filter-skill/SKILL.md +51 -73
- package/common/skills/scan-techstack/SKILL.md +30 -36
- package/dist/cli.js +85 -0
- package/kits/coder/agents/ai-engineer.md +27 -39
- package/kits/coder/agents/backend-specialist.md +31 -45
- package/kits/coder/agents/cloud-architect.md +31 -45
- package/kits/coder/agents/code-reviewer.md +45 -67
- package/kits/coder/agents/data-engineer.md +22 -32
- package/kits/coder/agents/database-specialist.md +30 -44
- package/kits/coder/agents/debugger.md +28 -42
- package/kits/coder/agents/devops-engineer.md +35 -53
- package/kits/coder/agents/documentation-writer.md +48 -68
- package/kits/coder/agents/frontend-specialist.md +30 -46
- package/kits/coder/agents/i18n-specialist.md +37 -51
- package/kits/coder/agents/integration-specialist.md +38 -54
- package/kits/coder/agents/mobile-developer.md +37 -53
- package/kits/coder/agents/multi-tenant-architect.md +25 -37
- package/kits/coder/agents/orchestrator.md +20 -32
- package/kits/coder/agents/performance-analyst.md +43 -65
- package/kits/coder/agents/project-planner.md +25 -39
- package/kits/coder/agents/queue-specialist.md +26 -38
- package/kits/coder/agents/realtime-specialist.md +44 -64
- package/kits/coder/agents/security-auditor.md +44 -64
- package/kits/coder/agents/test-engineer.md +30 -44
- package/kits/coder/agents/ux-researcher.md +26 -38
- package/kits/coder/rules/sections/classifier.md +11 -7
- package/kits/coder/rules/sections/code.md +5 -4
- package/kits/coder/skills/accessibility-patterns/SKILL.md +67 -81
- package/kits/coder/skills/ai-rag-patterns/SKILL.md +27 -23
- package/kits/coder/skills/api-patterns/SKILL.md +40 -43
- package/kits/coder/skills/auth-patterns/SKILL.md +47 -51
- package/kits/coder/skills/aws-patterns/SKILL.md +52 -57
- package/kits/coder/skills/brainstorming/SKILL.md +26 -23
- package/kits/coder/skills/clean-code/SKILL.md +74 -90
- package/kits/coder/skills/database-design/SKILL.md +32 -31
- package/kits/coder/skills/docker-patterns/SKILL.md +46 -49
- package/kits/coder/skills/documentation-templates/SKILL.md +21 -13
- package/kits/coder/skills/e2e-testing/SKILL.md +52 -58
- package/kits/coder/skills/flutter-patterns/SKILL.md +44 -46
- package/kits/coder/skills/frontend-design/SKILL.md +28 -24
- package/kits/coder/skills/github-actions/SKILL.md +43 -45
- package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +35 -33
- package/kits/coder/skills/graphql-patterns/SKILL.md +35 -33
- package/kits/coder/skills/i18n-localization/SKILL.md +37 -35
- package/kits/coder/skills/kubernetes-patterns/SKILL.md +35 -33
- package/kits/coder/skills/mermaid-diagrams/SKILL.md +54 -60
- package/kits/coder/skills/mobile-design/SKILL.md +51 -61
- package/kits/coder/skills/monitoring-observability/SKILL.md +32 -30
- package/kits/coder/skills/multi-tenancy/SKILL.md +16 -8
- package/kits/coder/skills/nodejs-best-practices/SKILL.md +19 -14
- package/kits/coder/skills/performance-profiling/SKILL.md +31 -29
- package/kits/coder/skills/plan-writing/SKILL.md +52 -59
- package/kits/coder/skills/postgres-patterns/SKILL.md +39 -39
- package/kits/coder/skills/prompt-engineering/SKILL.md +40 -42
- package/kits/coder/skills/queue-patterns/SKILL.md +22 -16
- package/kits/coder/skills/react-native-patterns/SKILL.md +35 -33
- package/kits/coder/skills/react-patterns/SKILL.md +46 -52
- package/kits/coder/skills/realtime-patterns/SKILL.md +44 -46
- package/kits/coder/skills/redis-patterns/SKILL.md +35 -33
- package/kits/coder/skills/security-fundamentals/SKILL.md +45 -46
- package/kits/coder/skills/seo-patterns/SKILL.md +56 -62
- package/kits/coder/skills/systematic-debugging/SKILL.md +38 -39
- package/kits/coder/skills/tailwind-patterns/SKILL.md +21 -13
- package/kits/coder/skills/terraform-patterns/SKILL.md +53 -57
- package/kits/coder/skills/testing-patterns/SKILL.md +42 -47
- package/kits/coder/skills/typescript-patterns/SKILL.md +54 -68
- package/kits/coder/skills/ui-ux-pro-max/SKILL.md +362 -364
- package/package.json +1 -1
|
@@ -7,7 +7,16 @@ version: 2.0
|
|
|
7
7
|
|
|
8
8
|
# Testing Patterns - Principles & Best Practices
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## ⚡ Quick Reference
|
|
11
|
+
|
|
12
|
+
- **Pyramid**: Unit (fast/many) > Integration (medium) > E2E (slow/few) · 70/20/10 ratio
|
|
13
|
+
- **AAA pattern**: Arrange (setup) → Act (execute) → Assert (verify) · 1 assertion per concern
|
|
14
|
+
- **Naming**: `describe('UserService')` / `it('should throw when email invalid')` · behavior not implementation
|
|
15
|
+
- **Mocking**: Mock external deps (DB/API/time) · Don't mock internals · Use MSW for HTTP
|
|
16
|
+
- **Coverage**: 80%+ meaningful coverage · 100% for critical paths · Coverage ≠ quality
|
|
17
|
+
- **Avoid**: `expect(true).toBe(true)` · Tests that test mocks · Snapshot tests for logic
|
|
18
|
+
|
|
19
|
+
---
|
|
11
20
|
|
|
12
21
|
---
|
|
13
22
|
|
|
@@ -85,13 +94,11 @@ describe("UserService", () => {
|
|
|
85
94
|
|
|
86
95
|
### What to Unit Test
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
| Calculations | Constructor-only classes |
|
|
94
|
-
| Validations | Private methods directly |
|
|
97
|
+
- Business logic: Framework code
|
|
98
|
+
- Edge cases: Third-party libraries
|
|
99
|
+
- Error handling: Simple getters/setters
|
|
100
|
+
- Calculations: Constructor-only classes
|
|
101
|
+
- Validations: Private methods directly
|
|
95
102
|
|
|
96
103
|
---
|
|
97
104
|
|
|
@@ -139,13 +146,11 @@ describe("UserAPI", () => {
|
|
|
139
146
|
|
|
140
147
|
### When to Mock
|
|
141
148
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
| Network calls | In-memory stores |
|
|
148
|
-
| Third-party services | Internal modules |
|
|
149
|
+
- External APIs: Code under test
|
|
150
|
+
- Database (in unit tests): Simple dependencies
|
|
151
|
+
- Time/Date: Pure functions
|
|
152
|
+
- Network calls: In-memory stores
|
|
153
|
+
- Third-party services: Internal modules
|
|
149
154
|
|
|
150
155
|
### Mock Types
|
|
151
156
|
|
|
@@ -213,12 +218,10 @@ const user = createUser({ role: "admin" });
|
|
|
213
218
|
|
|
214
219
|
## Test Naming Conventions
|
|
215
220
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
| **given_when_then** | `givenValidInput_whenSubmit_thenSuccess` |
|
|
221
|
-
| **methodName_condition_expected** | `getUser_withInvalidId_returnsNull` |
|
|
221
|
+
- **should_behavior**: `should returnErrorWhenUserNotFound`
|
|
222
|
+
- **when_condition**: `whenUserIsNull_throwsError`
|
|
223
|
+
- **given_when_then**: `givenValidInput_whenSubmit_thenSuccess`
|
|
224
|
+
- **methodName_condition_expected**: `getUser_withInvalidId_returnsNull`
|
|
222
225
|
|
|
223
226
|
**Rule:** Test names should describe behavior, not implementation.
|
|
224
227
|
|
|
@@ -226,34 +229,28 @@ const user = createUser({ role: "admin" });
|
|
|
226
229
|
|
|
227
230
|
## Coverage Guidelines
|
|
228
231
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
| **90%+** | High coverage, critical systems |
|
|
233
|
-
| **100%** | Often impractical, may waste effort |
|
|
232
|
+
- **80%+**: Good coverage for most projects
|
|
233
|
+
- **90%+**: High coverage, critical systems
|
|
234
|
+
- **100%**: Often impractical, may waste effort
|
|
234
235
|
|
|
235
236
|
### What to Cover
|
|
236
237
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
| **Medium** | Error paths, edge cases |
|
|
241
|
-
| **Low** | Simple getters, boilerplate |
|
|
238
|
+
- **High**: Business logic, calculations
|
|
239
|
+
- **Medium**: Error paths, edge cases
|
|
240
|
+
- **Low**: Simple getters, boilerplate
|
|
242
241
|
|
|
243
242
|
---
|
|
244
243
|
|
|
245
244
|
## Anti-Patterns
|
|
246
245
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
| Hard-code test data | Use factories |
|
|
256
|
-
| Rely on test order | Make tests independent |
|
|
246
|
+
- Test implementation details: Test behavior/outcomes
|
|
247
|
+
- Duplicate test code: Use factories/helpers
|
|
248
|
+
- Complex test setup: Simplify or split tests
|
|
249
|
+
- Ignore flaky tests: Fix root cause immediately
|
|
250
|
+
- Skip cleanup: Reset state every test
|
|
251
|
+
- Test multiple things: One assertion per test
|
|
252
|
+
- Hard-code test data: Use factories
|
|
253
|
+
- Rely on test order: Make tests independent
|
|
257
254
|
|
|
258
255
|
---
|
|
259
256
|
|
|
@@ -273,12 +270,10 @@ Before pushing code:
|
|
|
273
270
|
|
|
274
271
|
## Related Skills
|
|
275
272
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
| E2E testing | `webapp-testing` |
|
|
281
|
-
| Performance testing | `performance-profiling` |
|
|
273
|
+
- Clean code: `clean-code`
|
|
274
|
+
- API testing: `api-patterns`
|
|
275
|
+
- E2E testing: `webapp-testing`
|
|
276
|
+
- Performance testing: `performance-profiling`
|
|
282
277
|
|
|
283
278
|
---
|
|
284
279
|
|
|
@@ -6,17 +6,25 @@ allowed-tools: Read, Write, Edit, Glob, Grep
|
|
|
6
6
|
|
|
7
7
|
# TypeScript Patterns
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## ⚡ Quick Reference
|
|
10
|
+
|
|
11
|
+
- **Strict mode**: Always `"strict": true` · `noUncheckedIndexedAccess` · `exactOptionalPropertyTypes`
|
|
12
|
+
- **No `any`**: Use `unknown` for unknowns · type narrowing with guards · `as` only as last resort
|
|
13
|
+
- **Utilities**: `Partial<T>` · `Required<T>` · `Pick<T,K>` · `Omit<T,K>` · `Record<K,V>` · `ReturnType<F>`
|
|
14
|
+
- **Type vs Interface**: `interface` for objects/classes (extendable) · `type` for unions/intersections
|
|
15
|
+
- **Async**: Always type return `Promise<T>` · use `try/catch` with typed errors · avoid `void` for important returns
|
|
16
|
+
- **Inference**: Let TS infer when obvious · explicit types for API boundaries and function params
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
10
20
|
|
|
11
21
|
---
|
|
12
22
|
|
|
13
23
|
## 📑 Content Map
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| `references/error-patterns.md` | Debugging type errors |
|
|
19
|
-
| `references/migration-guide.md` | JS to TS migration |
|
|
25
|
+
- `references/advanced-types.md`: Complex type gymnastics
|
|
26
|
+
- `references/error-patterns.md`: Debugging type errors
|
|
27
|
+
- `references/migration-guide.md`: JS to TS migration
|
|
20
28
|
|
|
21
29
|
---
|
|
22
30
|
|
|
@@ -144,12 +152,10 @@ type GetUserParams = Parameters<typeof getUser>;
|
|
|
144
152
|
}
|
|
145
153
|
```
|
|
146
154
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
| `noImplicitOverride` | Require `override` keyword |
|
|
152
|
-
| `exactOptionalPropertyTypes` | Distinguish `undefined` vs missing |
|
|
155
|
+
- `strict`: Enables all strict type checking
|
|
156
|
+
- `noUncheckedIndexedAccess`: Array/object access returns `T \
|
|
157
|
+
- `noImplicitOverride`: Require `override` keyword
|
|
158
|
+
- `exactOptionalPropertyTypes`: Distinguish `undefined` vs missing
|
|
153
159
|
|
|
154
160
|
---
|
|
155
161
|
|
|
@@ -162,12 +168,10 @@ type GetUserParams = Parameters<typeof getUser>;
|
|
|
162
168
|
npx tsc --extendedDiagnostics --incremental false | grep -E "Check time|Files:|Lines:|Nodes:"
|
|
163
169
|
```
|
|
164
170
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
| Large codebase | Use Project References |
|
|
170
|
-
| "Type instantiation too deep" | See fixes below |
|
|
171
|
+
- Slow type checking: Enable `skipLibCheck: true`
|
|
172
|
+
- Rebuilding everything: Enable `incremental: true`
|
|
173
|
+
- Large codebase: Use Project References
|
|
174
|
+
- "Type instantiation too deep": See fixes below
|
|
171
175
|
|
|
172
176
|
### Fixing "Type instantiation is excessively deep"
|
|
173
177
|
|
|
@@ -194,20 +198,16 @@ type Prev = [never, 0, 1, 2, 3, 4];
|
|
|
194
198
|
|
|
195
199
|
### "The inferred type of X cannot be named"
|
|
196
200
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
| Circular dependency | Use type-only imports: `import type` |
|
|
201
|
-
| Complex inference | Use `ReturnType<typeof fn>` |
|
|
201
|
+
- Missing type export: Export the required type explicitly
|
|
202
|
+
- Circular dependency: Use type-only imports: `import type`
|
|
203
|
+
- Complex inference: Use `ReturnType<typeof fn>`
|
|
202
204
|
|
|
203
205
|
### "Cannot find module"
|
|
204
206
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
| Monorepo setup | Use workspace protocol (workspace:\*) |
|
|
210
|
-
| Cache issues | `rm -rf node_modules/.cache .tsbuildinfo` |
|
|
207
|
+
- Wrong moduleResolution: Match your bundler (node, bundler)
|
|
208
|
+
- Missing baseUrl: Check tsconfig paths alignment
|
|
209
|
+
- Monorepo setup: Use workspace protocol (workspace:\*)
|
|
210
|
+
- Cache issues: `rm -rf node_modules/.cache .tsbuildinfo`
|
|
211
211
|
|
|
212
212
|
### Missing Type Declarations
|
|
213
213
|
|
|
@@ -231,11 +231,9 @@ declare module "cjs-package" {
|
|
|
231
231
|
|
|
232
232
|
### ESM-First Approach
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
| moduleResolution | `"bundler"` or `"node16"` |
|
|
238
|
-
| module | `"esnext"` or `"node16"` |
|
|
234
|
+
- package.json `type`: `"module"`
|
|
235
|
+
- moduleResolution: `"bundler"` or `"node16"`
|
|
236
|
+
- module: `"esnext"` or `"node16"`
|
|
239
237
|
|
|
240
238
|
### CJS Interop
|
|
241
239
|
|
|
@@ -269,10 +267,8 @@ const defaultExport = pkg.default || pkg;
|
|
|
269
267
|
|
|
270
268
|
### Nx vs Turborepo Decision
|
|
271
269
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
| **Turborepo** | Simple structure, speed, <20 packages |
|
|
275
|
-
| **Nx** | Complex deps, visualization, plugins |
|
|
270
|
+
- **Turborepo**: Simple structure, speed, <20 packages
|
|
271
|
+
- **Nx**: Complex deps, visualization, plugins
|
|
276
272
|
|
|
277
273
|
---
|
|
278
274
|
|
|
@@ -280,10 +276,8 @@ const defaultExport = pkg.default || pkg;
|
|
|
280
276
|
|
|
281
277
|
### Biome vs ESLint
|
|
282
278
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
| **Biome** | Speed critical, single tool, TS-first |
|
|
286
|
-
| **ESLint** | Need specific rules, Vue/Angular support |
|
|
279
|
+
- **Biome**: Speed critical, single tool, TS-first
|
|
280
|
+
- **ESLint**: Need specific rules, Vue/Angular support
|
|
287
281
|
|
|
288
282
|
### Type Testing
|
|
289
283
|
|
|
@@ -357,15 +351,13 @@ function handleStatus(status: Status) {
|
|
|
357
351
|
|
|
358
352
|
## 10. Anti-Patterns
|
|
359
353
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
| Type in separate file from impl | Co-locate types with code |
|
|
368
|
-
| Over-complicated generics | Simpler solution first |
|
|
354
|
+
- `any` everywhere: `unknown` with type guards
|
|
355
|
+
- Excessive type assertions (`as`): Proper type inference
|
|
356
|
+
- Ignoring strict mode: Enable all strict flags
|
|
357
|
+
- Complex mapped types in hot paths: Pre-compute, cache types
|
|
358
|
+
- Index as object key without check: `noUncheckedIndexedAccess: true`
|
|
359
|
+
- Type in separate file from impl: Co-locate types with code
|
|
360
|
+
- Over-complicated generics: Simpler solution first
|
|
369
361
|
|
|
370
362
|
---
|
|
371
363
|
|
|
@@ -373,20 +365,16 @@ function handleStatus(status: Status) {
|
|
|
373
365
|
|
|
374
366
|
### JavaScript to TypeScript
|
|
375
367
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
| 3 | Add types file by file |
|
|
381
|
-
| 4 | Enable strict mode progressively |
|
|
368
|
+
- 1: Enable `allowJs`, `checkJs` in tsconfig
|
|
369
|
+
- 2: Rename files `.js` → `.ts` gradually
|
|
370
|
+
- 3: Add types file by file
|
|
371
|
+
- 4: Enable strict mode progressively
|
|
382
372
|
|
|
383
373
|
### Useful Tools
|
|
384
374
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
| `typesync` | Install missing @types |
|
|
389
|
-
| `TypeStat` | Auto-fix TypeScript types |
|
|
375
|
+
- `ts-migrate`: Automated migration from Airbnb
|
|
376
|
+
- `typesync`: Install missing @types
|
|
377
|
+
- `TypeStat`: Auto-fix TypeScript types
|
|
390
378
|
|
|
391
379
|
---
|
|
392
380
|
|
|
@@ -405,12 +393,10 @@ function handleStatus(status: Status) {
|
|
|
405
393
|
|
|
406
394
|
## Related Skills
|
|
407
395
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
| Testing | `testing-patterns` |
|
|
413
|
-
| Performance | `performance-profiling` |
|
|
396
|
+
- React + TypeScript: `react-patterns`
|
|
397
|
+
- API design: `api-patterns`
|
|
398
|
+
- Testing: `testing-patterns`
|
|
399
|
+
- Performance: `performance-profiling`
|
|
414
400
|
|
|
415
401
|
---
|
|
416
402
|
|