# Opensrc

> 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. Use when this capability is needed.

- Skill: `tomevault-io/opensrc-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/opensrc-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/opensrc-2/raw
- Safety review: pending (external: skill-scanner PASS, skillspector CAUTION)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/opensrc-2

---


# 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

```bash
# Fetch package(s)
npx opensrc <package>
npx opensrc ai zod @anthropic-ai/sdk

# Check what's fetched
cat opensrc/sources.json

# Clean up when done
rm -rf opensrc/<package>
```

## Exploration Pattern

```bash
# 1. Fetch
npx opensrc ai

# 2. Check structure (many are monorepos)
ls opensrc/ai/packages/

# 3. Find what you need
grep -r "functionName" opensrc/ai/src/

# 4. Read the implementation
# (use Read tool)

# 5. Clean up
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/` |

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/andreasasprou) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-11 -->

