opencodekit 0.18.0 → 0.18.2
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/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +57 -0
- package/dist/template/.opencode/agent/scout.md +0 -37
- package/dist/template/.opencode/command/resume.md +1 -1
- package/dist/template/.opencode/command/status.md +7 -14
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/plugin/README.md +37 -25
- package/dist/template/.opencode/skill/accessibility-audit/SKILL.md +11 -5
- package/dist/template/.opencode/skill/agent-browser/SKILL.md +55 -18
- package/dist/template/.opencode/skill/agent-teams/SKILL.md +12 -1
- package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +11 -1
- package/dist/template/.opencode/skill/beads/SKILL.md +57 -390
- package/dist/template/.opencode/skill/beads/references/BEST_PRACTICES.md +27 -0
- package/dist/template/.opencode/skill/beads/references/EXAMPLES.md +45 -0
- package/dist/template/.opencode/skill/beads/references/FILE_CLAIMING.md +101 -0
- package/dist/template/.opencode/skill/beads/references/GIT_SYNC.md +25 -0
- package/dist/template/.opencode/skill/beads/references/HIERARCHY.md +71 -0
- package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +40 -0
- package/dist/template/.opencode/skill/beads/references/SESSION_PROTOCOL.md +61 -0
- package/dist/template/.opencode/skill/beads/references/TASK_CREATION.md +38 -0
- package/dist/template/.opencode/skill/beads/references/TROUBLESHOOTING.md +13 -0
- package/dist/template/.opencode/skill/beads-bridge/SKILL.md +10 -10
- package/dist/template/.opencode/skill/brainstorming/SKILL.md +13 -0
- package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +11 -1
- package/dist/template/.opencode/skill/cloudflare/SKILL.md +87 -67
- package/dist/template/.opencode/skill/compaction/SKILL.md +11 -3
- package/dist/template/.opencode/skill/condition-based-waiting/SKILL.md +11 -25
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +13 -2
- package/dist/template/.opencode/skill/context-initialization/SKILL.md +11 -1
- package/dist/template/.opencode/skill/context-management/SKILL.md +13 -1
- package/dist/template/.opencode/skill/core-data-expert/SKILL.md +13 -2
- package/dist/template/.opencode/skill/deep-research/SKILL.md +5 -8
- package/dist/template/.opencode/skill/defense-in-depth/SKILL.md +13 -0
- package/dist/template/.opencode/skill/design-system-audit/SKILL.md +9 -3
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +51 -0
- package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +19 -30
- package/dist/template/.opencode/skill/executing-plans/SKILL.md +36 -0
- package/dist/template/.opencode/skill/figma/SKILL.md +11 -1
- package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +31 -0
- package/dist/template/.opencode/skill/frontend-design/SKILL.md +13 -3
- package/dist/template/.opencode/skill/gemini-large-context/SKILL.md +11 -0
- package/dist/template/.opencode/skill/index-knowledge/SKILL.md +11 -1
- package/dist/template/.opencode/skill/jira/SKILL.md +11 -1
- package/dist/template/.opencode/skill/memory-system/SKILL.md +115 -60
- package/dist/template/.opencode/skill/mockup-to-code/SKILL.md +9 -3
- package/dist/template/.opencode/skill/mqdh/SKILL.md +11 -1
- package/dist/template/.opencode/skill/obsidian/SKILL.md +11 -1
- package/dist/template/.opencode/skill/opensrc/SKILL.md +18 -6
- package/dist/template/.opencode/skill/pdf-extract/SKILL.md +11 -1
- package/dist/template/.opencode/skill/playwright/SKILL.md +11 -1
- package/dist/template/.opencode/skill/playwriter/SKILL.md +11 -1
- package/dist/template/.opencode/skill/polar/SKILL.md +11 -1
- package/dist/template/.opencode/skill/prd/SKILL.md +13 -4
- package/dist/template/.opencode/skill/prd-task/SKILL.md +13 -3
- package/dist/template/.opencode/skill/ralph/SKILL.md +4 -8
- package/dist/template/.opencode/skill/react-best-practices/SKILL.md +24 -16
- package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +22 -0
- package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +30 -2
- package/dist/template/.opencode/skill/resend/SKILL.md +11 -1
- package/dist/template/.opencode/skill/root-cause-tracing/SKILL.md +12 -23
- package/dist/template/.opencode/skill/session-management/SKILL.md +33 -36
- package/dist/template/.opencode/skill/sharing-skills/SKILL.md +11 -0
- package/dist/template/.opencode/skill/skill-creator/SKILL.md +12 -11
- package/dist/template/.opencode/skill/source-code-research/SKILL.md +20 -266
- package/dist/template/.opencode/skill/source-code-research/references/analysis-tips.md +43 -0
- package/dist/template/.opencode/skill/source-code-research/references/anti-patterns.md +36 -0
- package/dist/template/.opencode/skill/source-code-research/references/common-patterns.md +57 -0
- package/dist/template/.opencode/skill/source-code-research/references/example-workflow.md +60 -0
- package/dist/template/.opencode/skill/source-code-research/references/further-reading.md +5 -0
- package/dist/template/.opencode/skill/source-code-research/references/source-structure.md +45 -0
- package/dist/template/.opencode/skill/stitch/SKILL.md +11 -1
- package/dist/template/.opencode/skill/structured-edit/SKILL.md +13 -0
- package/dist/template/.opencode/skill/subagent-driven-development/SKILL.md +13 -14
- package/dist/template/.opencode/skill/supabase/SKILL.md +11 -1
- package/dist/template/.opencode/skill/supabase-postgres-best-practices/SKILL.md +23 -15
- package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +23 -923
- package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +39 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +145 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +50 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +90 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +20 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +186 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +172 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +78 -0
- package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +134 -0
- package/dist/template/.opencode/skill/swift-concurrency/SKILL.md +22 -2
- package/dist/template/.opencode/skill/swiftui-expert-skill/SKILL.md +58 -19
- package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +25 -25
- package/dist/template/.opencode/skill/test-driven-development/SKILL.md +19 -15
- package/dist/template/.opencode/skill/testing-anti-patterns/SKILL.md +13 -0
- package/dist/template/.opencode/skill/testing-skills-with-subagents/SKILL.md +13 -15
- package/dist/template/.opencode/skill/tool-priority/SKILL.md +13 -0
- package/dist/template/.opencode/skill/ui-ux-research/SKILL.md +9 -3
- package/dist/template/.opencode/skill/using-git-worktrees/SKILL.md +11 -0
- package/dist/template/.opencode/skill/using-skills/SKILL.md +13 -0
- package/dist/template/.opencode/skill/v0/SKILL.md +11 -1
- package/dist/template/.opencode/skill/v1-run/SKILL.md +11 -1
- package/dist/template/.opencode/skill/vercel-deploy-claimable/SKILL.md +14 -2
- package/dist/template/.opencode/skill/verification-before-completion/SKILL.md +22 -0
- package/dist/template/.opencode/skill/visual-analysis/SKILL.md +9 -3
- package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +12 -5
- package/dist/template/.opencode/skill/writing-plans/SKILL.md +13 -0
- package/dist/template/.opencode/skill/writing-skills/SKILL.md +26 -421
- package/dist/template/.opencode/skill/writing-skills/references/anti-patterns.md +25 -0
- package/dist/template/.opencode/skill/writing-skills/references/claude-search-optimization.md +140 -0
- package/dist/template/.opencode/skill/writing-skills/references/discovery-workflow.md +11 -0
- package/dist/template/.opencode/skill/writing-skills/references/file-organization.md +32 -0
- package/dist/template/.opencode/skill/writing-skills/references/flowcharts-and-examples.md +57 -0
- package/dist/template/.opencode/skill/writing-skills/references/rationalization-hardening.md +75 -0
- package/dist/template/.opencode/skill/writing-skills/references/testing-skill-types.md +52 -0
- package/package.json +15 -4
- package/dist/template/.opencode/plugin/compaction.ts +0 -190
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: source-code-research
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
version: "1.0.0"
|
|
8
|
-
license: MIT
|
|
3
|
+
description: "Use when researching library implementation details beyond API docs. Fetches package source code using opensrc to understand internals, edge cases, and implementation patterns. Complements documentation-based research with actual code inspection."
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [research, code-quality]
|
|
6
|
+
dependencies: [opensrc]
|
|
9
7
|
---
|
|
10
8
|
|
|
11
9
|
# Source Code Research - Deep Library Investigation
|
|
12
10
|
|
|
13
11
|
Fetch and analyze package source code when documentation is insufficient.
|
|
14
12
|
|
|
15
|
-
## When to Use
|
|
13
|
+
## When to Use
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
- Documentation gaps — API docs don't explain behavior clearly
|
|
16
|
+
- Edge cases — need to understand how library handles corner cases
|
|
17
|
+
- Implementation details — need to see actual code, not just interfaces
|
|
18
|
+
- Debugging — library behaving unexpectedly, need to trace internals
|
|
19
|
+
- Evaluation — deciding if library fits requirements, need to assess quality
|
|
20
|
+
- Type definitions — TypeScript types exist but implementation unclear
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
- **Edge cases**: Need to understand how library handles corner cases
|
|
21
|
-
- **Implementation details**: Need to see actual code, not just interfaces
|
|
22
|
-
- **Debugging**: Library behaving unexpectedly, need to trace internals
|
|
23
|
-
- **Evaluation**: Deciding if library fits requirements, need to assess quality
|
|
24
|
-
- **Type definitions**: TypeScript types exist but implementation unclear
|
|
25
|
-
|
|
26
|
-
**Don't use when:**
|
|
22
|
+
## When NOT to Use
|
|
27
23
|
|
|
28
24
|
- Official docs answer your question (check Context7 first)
|
|
29
25
|
- You only need API syntax (codesearch is faster)
|
|
@@ -192,154 +188,6 @@ Based on source analysis:
|
|
|
192
188
|
|
|
193
189
|
````
|
|
194
190
|
|
|
195
|
-
## Common Patterns
|
|
196
|
-
|
|
197
|
-
### Pattern 1: Understanding Error Handling
|
|
198
|
-
|
|
199
|
-
```typescript
|
|
200
|
-
// 1. Fetch package
|
|
201
|
-
// bash: npx opensrc zod
|
|
202
|
-
|
|
203
|
-
// 2. Find error classes
|
|
204
|
-
grep({ pattern: "class.*Error", path: "opensrc/", include: "*.ts" });
|
|
205
|
-
|
|
206
|
-
// 3. Read error implementation
|
|
207
|
-
read({ filePath: "opensrc/repos/.../errors.ts" });
|
|
208
|
-
|
|
209
|
-
// 4. Find where errors are thrown
|
|
210
|
-
grep({ pattern: "throw new", path: "opensrc/", include: "*.ts" });
|
|
211
|
-
````
|
|
212
|
-
|
|
213
|
-
### Pattern 2: Tracing Function Behavior
|
|
214
|
-
|
|
215
|
-
```typescript
|
|
216
|
-
// 1. Fetch source
|
|
217
|
-
// bash: npx opensrc react-hook-form
|
|
218
|
-
|
|
219
|
-
// 2. Find function definition
|
|
220
|
-
grep({
|
|
221
|
-
pattern: "export function useForm",
|
|
222
|
-
path: "opensrc/",
|
|
223
|
-
include: "*.ts",
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
// 3. Read implementation
|
|
227
|
-
read({ filePath: "opensrc/.../useForm.ts" });
|
|
228
|
-
|
|
229
|
-
// 4. Find dependencies
|
|
230
|
-
grep({ pattern: "import.*from", path: "opensrc/.../useForm.ts" });
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Pattern 3: Evaluating Library Quality
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
// 1. Fetch source
|
|
237
|
-
// bash: npx opensrc candidate-library
|
|
238
|
-
|
|
239
|
-
// 2. Check test coverage
|
|
240
|
-
glob({ pattern: "opensrc/**/*.test.ts" });
|
|
241
|
-
glob({ pattern: "opensrc/**/*.spec.ts" });
|
|
242
|
-
|
|
243
|
-
// 3. Read tests for usage patterns
|
|
244
|
-
read({ filePath: "opensrc/.../feature.test.ts" });
|
|
245
|
-
|
|
246
|
-
// 4. Check for TypeScript usage
|
|
247
|
-
glob({ pattern: "opensrc/**/tsconfig.json" });
|
|
248
|
-
|
|
249
|
-
// 5. Review package.json for dependencies
|
|
250
|
-
read({ filePath: "opensrc/.../package.json" });
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Source Structure Guide
|
|
254
|
-
|
|
255
|
-
### npm Packages
|
|
256
|
-
|
|
257
|
-
```
|
|
258
|
-
opensrc/
|
|
259
|
-
└── repos/
|
|
260
|
-
└── github.com/ # npm packages resolve to GitHub
|
|
261
|
-
└── owner/
|
|
262
|
-
└── repo/
|
|
263
|
-
├── src/ # Source code (usually)
|
|
264
|
-
├── dist/ # Built output (ignore)
|
|
265
|
-
├── test/ # Tests (useful for examples)
|
|
266
|
-
├── package.json # Dependencies, scripts
|
|
267
|
-
└── README.md # Often has examples
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Python Packages (PyPI)
|
|
271
|
-
|
|
272
|
-
```
|
|
273
|
-
opensrc/
|
|
274
|
-
└── repos/
|
|
275
|
-
└── github.com/ # Most PyPI packages on GitHub
|
|
276
|
-
└── owner/
|
|
277
|
-
└── repo/
|
|
278
|
-
├── src/ # or package_name/
|
|
279
|
-
├── tests/ # Python tests
|
|
280
|
-
├── setup.py # Package config
|
|
281
|
-
└── pyproject.toml
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Rust Crates
|
|
285
|
-
|
|
286
|
-
```
|
|
287
|
-
opensrc/
|
|
288
|
-
└── repos/
|
|
289
|
-
└── github.com/
|
|
290
|
-
└── owner/
|
|
291
|
-
└── repo/
|
|
292
|
-
├── src/
|
|
293
|
-
│ └── lib.rs # Main library file
|
|
294
|
-
├── tests/
|
|
295
|
-
├── Cargo.toml # Dependencies
|
|
296
|
-
└── examples/ # Usage examples
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
## Tips for Efficient Analysis
|
|
300
|
-
|
|
301
|
-
### 1. Start with Tests
|
|
302
|
-
|
|
303
|
-
Tests often show real-world usage better than docs:
|
|
304
|
-
|
|
305
|
-
```typescript
|
|
306
|
-
glob({ pattern: "opensrc/**/*.test.{ts,js}" });
|
|
307
|
-
read({ filePath: "opensrc/.../feature.test.ts" });
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### 2. Check Examples Directory
|
|
311
|
-
|
|
312
|
-
Many repos have `examples/` or `samples/`:
|
|
313
|
-
|
|
314
|
-
```typescript
|
|
315
|
-
glob({ pattern: "opensrc/**/examples/**/*" });
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### 3. Read CHANGELOG for Context
|
|
319
|
-
|
|
320
|
-
Understand recent changes:
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
read({ filePath: "opensrc/.../CHANGELOG.md" });
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### 4. Check TypeScript Definitions
|
|
327
|
-
|
|
328
|
-
Often more accurate than docs:
|
|
329
|
-
|
|
330
|
-
```typescript
|
|
331
|
-
glob({ pattern: "opensrc/**/*.d.ts" });
|
|
332
|
-
read({ filePath: "opensrc/.../index.d.ts" });
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### 5. Use Blame for History (if needed)
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
cd opensrc/repos/github.com/owner/repo
|
|
339
|
-
git log --oneline -- src/file.ts
|
|
340
|
-
git show <commit>:src/file.ts
|
|
341
|
-
```
|
|
342
|
-
|
|
343
191
|
## Limitations
|
|
344
192
|
|
|
345
193
|
### When Source Code Won't Help
|
|
@@ -396,67 +244,6 @@ npx opensrc clean --npm
|
|
|
396
244
|
# (opensrc/ is gitignored, won't be committed)
|
|
397
245
|
```
|
|
398
246
|
|
|
399
|
-
## Example: Complete Workflow
|
|
400
|
-
|
|
401
|
-
**Scenario:** Need to understand how zod handles async refinements.
|
|
402
|
-
|
|
403
|
-
```bash
|
|
404
|
-
# 1. Fetch source
|
|
405
|
-
npx opensrc zod
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
```typescript
|
|
409
|
-
// 2. Find refinement code
|
|
410
|
-
grep({
|
|
411
|
-
pattern: "refine.*async",
|
|
412
|
-
path: "opensrc/",
|
|
413
|
-
include: "*.ts",
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
// 3. Locate implementation
|
|
417
|
-
ast_grep({
|
|
418
|
-
pattern: "refine($$$) { $$$ }",
|
|
419
|
-
path: "opensrc/repos/github.com/colinhacks/zod/",
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
// 4. Read the implementation
|
|
423
|
-
read({
|
|
424
|
-
filePath: "opensrc/repos/github.com/colinhacks/zod/src/types.ts",
|
|
425
|
-
offset: 500,
|
|
426
|
-
limit: 100,
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
// 5. Check tests for usage examples
|
|
430
|
-
glob({
|
|
431
|
-
pattern: "opensrc/**/zod/**/*.test.ts",
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
read({
|
|
435
|
-
filePath: "opensrc/repos/.../async.test.ts",
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
// 6. Document findings
|
|
439
|
-
write({
|
|
440
|
-
filePath: ".beads/artifacts/br-xxx/research.md",
|
|
441
|
-
content: `# Zod Async Refinements
|
|
442
|
-
|
|
443
|
-
**Finding:** Async refinements use \`parseAsync()\` not \`parse()\`
|
|
444
|
-
|
|
445
|
-
**Evidence:** \`src/types.ts:842-856\`
|
|
446
|
-
|
|
447
|
-
Async refinements return Promise<Output> and require:
|
|
448
|
-
- Use \`.parseAsync()\` method
|
|
449
|
-
- Refinement function must return Promise<boolean>
|
|
450
|
-
- Errors handled via Promise rejection
|
|
451
|
-
|
|
452
|
-
**Code snippet:**
|
|
453
|
-
[paste relevant code]
|
|
454
|
-
|
|
455
|
-
**Recommendation:** Use \`.refine(async (val) => {...})\` with \`.parseAsync()\`
|
|
456
|
-
`,
|
|
457
|
-
});
|
|
458
|
-
```
|
|
459
|
-
|
|
460
247
|
## Success Criteria
|
|
461
248
|
|
|
462
249
|
You've successfully used this skill when:
|
|
@@ -468,43 +255,6 @@ You've successfully used this skill when:
|
|
|
468
255
|
- [ ] Answered original research question with high confidence
|
|
469
256
|
- [ ] Provided code evidence for claims
|
|
470
257
|
|
|
471
|
-
## Anti-Patterns
|
|
472
|
-
|
|
473
|
-
### ❌ Don't: Fetch Entire Ecosystem
|
|
474
|
-
|
|
475
|
-
```bash
|
|
476
|
-
# Bad: Fetching everything
|
|
477
|
-
npx opensrc react
|
|
478
|
-
npx opensrc react-dom
|
|
479
|
-
npx opensrc react-router
|
|
480
|
-
npx opensrc react-query
|
|
481
|
-
# ... (too much code)
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
**Do:** Fetch only what you need to answer specific question.
|
|
485
|
-
|
|
486
|
-
### ❌ Don't: Read Random Files
|
|
487
|
-
|
|
488
|
-
```typescript
|
|
489
|
-
// Bad: Reading without purpose
|
|
490
|
-
read({ filePath: "opensrc/.../index.ts" });
|
|
491
|
-
read({ filePath: "opensrc/.../utils.ts" });
|
|
492
|
-
read({ filePath: "opensrc/.../helpers.ts" });
|
|
493
|
-
// ... (unfocused exploration)
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
**Do:** Use grep to find relevant code first, then read.
|
|
497
|
-
|
|
498
|
-
### ❌ Don't: Ignore Version Mismatch
|
|
499
|
-
|
|
500
|
-
```bash
|
|
501
|
-
# Bad: Fetching latest when project uses old version
|
|
502
|
-
npx opensrc zod # Fetches 3.23.x
|
|
503
|
-
# But project uses zod@3.20.0 (different behavior)
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
**Do:** Specify version matching your lockfile, or let opensrc auto-detect.
|
|
507
|
-
|
|
508
258
|
## Quick Reference
|
|
509
259
|
|
|
510
260
|
```bash
|
|
@@ -532,8 +282,12 @@ opensrc/repos/<host>/<owner>/<repo>/
|
|
|
532
282
|
opensrc/sources.json
|
|
533
283
|
```
|
|
534
284
|
|
|
535
|
-
##
|
|
285
|
+
## References
|
|
536
286
|
|
|
537
|
-
-
|
|
538
|
-
-
|
|
539
|
-
-
|
|
287
|
+
- `references/common-patterns.md` - Error handling, tracing behavior, quality evaluation patterns
|
|
288
|
+
- `references/source-structure.md` - npm/PyPI/Rust source layouts
|
|
289
|
+
- `references/analysis-tips.md` - Tests, examples, changelog, types, blame
|
|
290
|
+
- `references/example-workflow.md` - Full zod async refinement workflow
|
|
291
|
+
- `references/anti-patterns.md` - What not to do when researching
|
|
292
|
+
- `references/further-reading.md` - External links
|
|
293
|
+
````
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Tips for Efficient Analysis
|
|
2
|
+
|
|
3
|
+
## 1. Start with Tests
|
|
4
|
+
|
|
5
|
+
Tests often show real-world usage better than docs:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
glob({ pattern: "opensrc/**/*.test.{ts,js}" });
|
|
9
|
+
read({ filePath: "opensrc/.../feature.test.ts" });
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## 2. Check Examples Directory
|
|
13
|
+
|
|
14
|
+
Many repos have `examples/` or `samples/`:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
glob({ pattern: "opensrc/**/examples/**/*" });
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 3. Read CHANGELOG for Context
|
|
21
|
+
|
|
22
|
+
Understand recent changes:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
read({ filePath: "opensrc/.../CHANGELOG.md" });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 4. Check TypeScript Definitions
|
|
29
|
+
|
|
30
|
+
Often more accurate than docs:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
glob({ pattern: "opensrc/**/*.d.ts" });
|
|
34
|
+
read({ filePath: "opensrc/.../index.d.ts" });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 5. Use Blame for History (if needed)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cd opensrc/repos/github.com/owner/repo
|
|
41
|
+
git log --oneline -- src/file.ts
|
|
42
|
+
git show <commit>:src/file.ts
|
|
43
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Anti-Patterns
|
|
2
|
+
|
|
3
|
+
## ❌ Don't: Fetch Entire Ecosystem
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Bad: Fetching everything
|
|
7
|
+
npx opensrc react
|
|
8
|
+
npx opensrc react-dom
|
|
9
|
+
npx opensrc react-router
|
|
10
|
+
npx opensrc react-query
|
|
11
|
+
# ... (too much code)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Do:** Fetch only what you need to answer specific question.
|
|
15
|
+
|
|
16
|
+
## ❌ Don't: Read Random Files
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// Bad: Reading without purpose
|
|
20
|
+
read({ filePath: "opensrc/.../index.ts" });
|
|
21
|
+
read({ filePath: "opensrc/.../utils.ts" });
|
|
22
|
+
read({ filePath: "opensrc/.../helpers.ts" });
|
|
23
|
+
// ... (unfocused exploration)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Do:** Use grep to find relevant code first, then read.
|
|
27
|
+
|
|
28
|
+
## ❌ Don't: Ignore Version Mismatch
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Bad: Fetching latest when project uses old version
|
|
32
|
+
npx opensrc zod # Fetches 3.23.x
|
|
33
|
+
# But project uses zod@3.20.0 (different behavior)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Do:** Specify version matching your lockfile, or let opensrc auto-detect.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Common Patterns
|
|
2
|
+
|
|
3
|
+
## Pattern 1: Understanding Error Handling
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
// 1. Fetch package
|
|
7
|
+
// bash: npx opensrc zod
|
|
8
|
+
|
|
9
|
+
// 2. Find error classes
|
|
10
|
+
grep({ pattern: "class.*Error", path: "opensrc/", include: "*.ts" });
|
|
11
|
+
|
|
12
|
+
// 3. Read error implementation
|
|
13
|
+
read({ filePath: "opensrc/repos/.../errors.ts" });
|
|
14
|
+
|
|
15
|
+
// 4. Find where errors are thrown
|
|
16
|
+
grep({ pattern: "throw new", path: "opensrc/", include: "*.ts" });
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Pattern 2: Tracing Function Behavior
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// 1. Fetch source
|
|
23
|
+
// bash: npx opensrc react-hook-form
|
|
24
|
+
|
|
25
|
+
// 2. Find function definition
|
|
26
|
+
grep({
|
|
27
|
+
pattern: "export function useForm",
|
|
28
|
+
path: "opensrc/",
|
|
29
|
+
include: "*.ts",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// 3. Read implementation
|
|
33
|
+
read({ filePath: "opensrc/.../useForm.ts" });
|
|
34
|
+
|
|
35
|
+
// 4. Find dependencies
|
|
36
|
+
grep({ pattern: "import.*from", path: "opensrc/.../useForm.ts" });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Pattern 3: Evaluating Library Quality
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// 1. Fetch source
|
|
43
|
+
// bash: npx opensrc candidate-library
|
|
44
|
+
|
|
45
|
+
// 2. Check test coverage
|
|
46
|
+
glob({ pattern: "opensrc/**/*.test.ts" });
|
|
47
|
+
glob({ pattern: "opensrc/**/*.spec.ts" });
|
|
48
|
+
|
|
49
|
+
// 3. Read tests for usage patterns
|
|
50
|
+
read({ filePath: "opensrc/.../feature.test.ts" });
|
|
51
|
+
|
|
52
|
+
// 4. Check for TypeScript usage
|
|
53
|
+
glob({ pattern: "opensrc/**/tsconfig.json" });
|
|
54
|
+
|
|
55
|
+
// 5. Review package.json for dependencies
|
|
56
|
+
read({ filePath: "opensrc/.../package.json" });
|
|
57
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Example: Complete Workflow
|
|
2
|
+
|
|
3
|
+
**Scenario:** Need to understand how zod handles async refinements.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# 1. Fetch source
|
|
7
|
+
npx opensrc zod
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
// 2. Find refinement code
|
|
12
|
+
grep({
|
|
13
|
+
pattern: "refine.*async",
|
|
14
|
+
path: "opensrc/",
|
|
15
|
+
include: "*.ts",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// 3. Locate implementation
|
|
19
|
+
ast_grep({
|
|
20
|
+
pattern: "refine($$$) { $$$ }",
|
|
21
|
+
path: "opensrc/repos/github.com/colinhacks/zod/",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 4. Read the implementation
|
|
25
|
+
read({
|
|
26
|
+
filePath: "opensrc/repos/github.com/colinhacks/zod/src/types.ts",
|
|
27
|
+
offset: 500,
|
|
28
|
+
limit: 100,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// 5. Check tests for usage examples
|
|
32
|
+
glob({
|
|
33
|
+
pattern: "opensrc/**/zod/**/*.test.ts",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
read({
|
|
37
|
+
filePath: "opensrc/repos/.../async.test.ts",
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// 6. Document findings
|
|
41
|
+
write({
|
|
42
|
+
filePath: ".beads/artifacts/br-xxx/research.md",
|
|
43
|
+
content: `# Zod Async Refinements
|
|
44
|
+
|
|
45
|
+
**Finding:** Async refinements use \`parseAsync()\` not \`parse()\`
|
|
46
|
+
|
|
47
|
+
**Evidence:** \`src/types.ts:842-856\`
|
|
48
|
+
|
|
49
|
+
Async refinements return Promise<Output> and require:
|
|
50
|
+
- Use \`.parseAsync()\` method
|
|
51
|
+
- Refinement function must return Promise<boolean>
|
|
52
|
+
- Errors handled via Promise rejection
|
|
53
|
+
|
|
54
|
+
**Code snippet:**
|
|
55
|
+
[paste relevant code]
|
|
56
|
+
|
|
57
|
+
**Recommendation:** Use \`.refine(async (val) => {...})\` with \`.parseAsync()\`
|
|
58
|
+
`,
|
|
59
|
+
});
|
|
60
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Source Structure Guide
|
|
2
|
+
|
|
3
|
+
## npm Packages
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
opensrc/
|
|
7
|
+
└── repos/
|
|
8
|
+
└── github.com/ # npm packages resolve to GitHub
|
|
9
|
+
└── owner/
|
|
10
|
+
└── repo/
|
|
11
|
+
├── src/ # Source code (usually)
|
|
12
|
+
├── dist/ # Built output (ignore)
|
|
13
|
+
├── test/ # Tests (useful for examples)
|
|
14
|
+
├── package.json # Dependencies, scripts
|
|
15
|
+
└── README.md # Often has examples
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Python Packages (PyPI)
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
opensrc/
|
|
22
|
+
└── repos/
|
|
23
|
+
└── github.com/ # Most PyPI packages on GitHub
|
|
24
|
+
└── owner/
|
|
25
|
+
└── repo/
|
|
26
|
+
├── src/ # or package_name/
|
|
27
|
+
├── tests/ # Python tests
|
|
28
|
+
├── setup.py # Package config
|
|
29
|
+
└── pyproject.toml
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Rust Crates
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
opensrc/
|
|
36
|
+
└── repos/
|
|
37
|
+
└── github.com/
|
|
38
|
+
└── owner/
|
|
39
|
+
└── repo/
|
|
40
|
+
├── src/
|
|
41
|
+
│ └── lib.rs # Main library file
|
|
42
|
+
├── tests/
|
|
43
|
+
├── Cargo.toml # Dependencies
|
|
44
|
+
└── examples/ # Usage examples
|
|
45
|
+
```
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: stitch
|
|
3
3
|
description: Google Stitch MCP for AI-powered UI design. Extract design context, generate code from designs, and create screens from descriptions. Use when working with Stitch designs and UI generation.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [design, mcp, ui]
|
|
6
|
+
dependencies: []
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# Google Stitch MCP
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- When you need to generate or inspect Google Stitch UI designs via MCP.
|
|
14
|
+
|
|
15
|
+
## When NOT to Use
|
|
16
|
+
|
|
17
|
+
- When you don't have Stitch access or don't need Stitch-generated UI.
|
|
18
|
+
|
|
9
19
|
|
|
10
20
|
## Overview
|
|
11
21
|
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: structured-edit
|
|
3
3
|
description: Use when editing files to reduce str_replace failures - combines LSP location with read-verify-edit pattern for reliable edits
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [code-quality, workflow]
|
|
6
|
+
dependencies: []
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# Structured Edit Protocol
|
|
7
10
|
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Editing files where exact string matches are error-prone (e.g., str_replace failures)
|
|
14
|
+
- Making targeted changes that require precise location and verification
|
|
15
|
+
|
|
16
|
+
## When NOT to Use
|
|
17
|
+
|
|
18
|
+
- One-line edits where a direct edit is safe and unambiguous
|
|
19
|
+
- Large refactors better served by full rewrites or file splits
|
|
20
|
+
|
|
8
21
|
## Overview
|
|
9
22
|
|
|
10
23
|
The `str_replace` edit tool is the #1 source of failures in LLM coding. Models reproduce content with subtle differences (whitespace, encoding, line endings) causing "string not found" errors.
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: subagent-driven-development
|
|
3
3
|
description: Use when executing implementation plans with independent tasks in the current session - dispatches fresh subagent for each task with code review between tasks, enabling fast iteration with quality gates
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [workflow, agent-coordination]
|
|
6
|
+
dependencies: [executing-plans]
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# Subagent-Driven Development
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Executing a plan with mostly independent tasks in the same session
|
|
14
|
+
- You want a fresh subagent per task plus review checkpoints
|
|
15
|
+
|
|
16
|
+
## When NOT to Use
|
|
17
|
+
|
|
18
|
+
- The plan requires review or revisions first (use executing-plans)
|
|
19
|
+
- Tasks are tightly coupled and need manual sequencing
|
|
20
|
+
|
|
9
21
|
|
|
10
|
-
**Core principle:** Fresh subagent per task + review between tasks = high quality, fast iteration
|
|
11
22
|
|
|
12
23
|
## Overview
|
|
13
24
|
|
|
@@ -18,18 +29,6 @@ Execute plan by dispatching fresh subagent per task, with code review after each
|
|
|
18
29
|
- Code review after each task (catch issues early)
|
|
19
30
|
- Faster iteration (no human-in-loop between tasks)
|
|
20
31
|
|
|
21
|
-
**When to use:**
|
|
22
|
-
|
|
23
|
-
- Staying in this session
|
|
24
|
-
- Tasks are mostly independent
|
|
25
|
-
- Want continuous progress with quality gates
|
|
26
|
-
|
|
27
|
-
**When NOT to use:**
|
|
28
|
-
|
|
29
|
-
- Need to review plan first (use executing-plans)
|
|
30
|
-
- Tasks are tightly coupled (manual execution better)
|
|
31
|
-
- Plan needs revision (brainstorm first)
|
|
32
|
-
|
|
33
32
|
## The Process
|
|
34
33
|
|
|
35
34
|
### 1. Load Plan
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: supabase
|
|
3
3
|
description: Comprehensive Supabase platform MCP for database operations, edge functions, development tools, debugging, and project management. Use when working with Supabase projects, databases, or APIs.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags: [integration, mcp]
|
|
6
|
+
dependencies: []
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# Supabase Platform (MCP)
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- When you need to manage Supabase projects, databases, or edge functions via MCP.
|
|
14
|
+
|
|
15
|
+
## When NOT to Use
|
|
16
|
+
|
|
17
|
+
- When the backend is not Supabase or MCP access is unavailable.
|
|
18
|
+
|
|
9
19
|
|
|
10
20
|
## Available Tools
|
|
11
21
|
|