| name | opensrc |
| description | Fetch npm package source code for implementation analysis. Use when types/docs aren't enough and you need to understand HOW a library works internally. |
| allowed-tools | ["Bash","Read","Glob","Grep"] |
opensrc
Fetch npm package source code locally when you need to understand implementation details.
When to Use
- Debugging unexpected library behavior
- Understanding internal patterns before extending a library
- Types/docs are insufficient
Commands
npx opensrc <package>
npx opensrc ai zod @anthropic-ai/sdk
cat opensrc/sources.json
rm -rf opensrc/<package>
Exploration Pattern
npx opensrc ai
ls opensrc/ai/packages/
grep -r "functionName" opensrc/ai/src/
rm -rf opensrc/ai
Tips
- Check
sources.json first - don't re-fetch what's already there
- Target specific files - don't read entire packages
- Monorepos: Check
packages/ directory for subpackages
- Clean up - source code takes disk space, remove when done
Common Packages
| Package | Structure |
|---|
ai | Monorepo: packages/anthropic/, packages/openai/, etc. |
@anthropic-ai/sdk | Single package: src/ |
zod | Single package: src/types/ |