Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

opensrc — Claude Code skill: what it does, how to install

Gives an agent dependency source code when types and documentation are not enough to inspect internal logic or debug library behaviour.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add vercel-labs/opensrc --skill opensrc -a claude-code
Open on GitHub

What opensrc does

opensrc fetches source code for npm, PyPI and crates.io packages, plus repositories, so an agent can inspect a dependency's implementation. opensrc path <pkg> prints the local source path and fetches it when needed. It can request multiple packages, versions, branches, tags and commits.

For npm packages, opensrc detects the installed version from package-lock.json, pnpm-lock.yaml or yarn.lock. Use --cwd to resolve a version from another project. Sources are stored globally in ~/.opensrc/, and OPENSRC_HOME changes that location.

The cache can be listed, removed by package or cleaned by source type. Treat opensrc clean carefully because it removes every cached source. For a basic API question, docs or types may already be enough.

What it helps with

  • inspect a dependency implementation beyond its types
  • trace how a library handles an edge case
  • debug unexpected behaviour against package source
  • fetch the version selected by a lockfile
  • remove cached package sources

Example prompts for the agent

  • “Fetch the source for `zod` and find how `parse` is handled.”
  • “Read the implementation of `pypi:requests` to inspect its internal behaviour.”
  • “Find tests in the source for `facebook/react`.”

How to install opensrc

1Skills CLI (Vercel)

npx skills add vercel-labs/opensrc --skill opensrc -a claude-code

2Manually: put the files in place

~/.claude/skills/opensrc/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/opensrc/

Similar

unfreeze garrytan Clears the freeze boundary set by /freeze, allowing edits to all directories again. Use it when you need to unlock restricted folders or return to unrestricted editing. Claude Code CX Codex Cursor +1 327installs deep-agents-memory langchain-ai A skill that maps where a Deep Agent keeps its files: thread state, a persistent store, or the real disk. Useful once the agent starts dropping context. Claude Code CX Codex Cursor +1 19,000installs cli-developer https://github.com/Jeffallan Skill for command-line development: guides you through building CLI tools with argument parsing, interactive prompts, progress bars and shell completions. Works with commander, click, typer and cobra. Claude Code CX Codex Cursor +1 4,800installs golang-gopls samber Semantic navigation and refactoring for Go code through gopls, the official language server. Use it when grep finds text but you need types, call graphs, and build structure. Claude Code CX Codex Cursor +1 10,900installs ralplan Yeachan-Heo A skill that runs iterative planning with three agents (Planner, Architect, Critic) until consensus. Blocks vague requests before execution, never runs changes without your approval. Claude Code CX Codex Cursor +1 1,200installs verified-agent-identity BillionsNetwork This skill gives an agent an Ethereum DID on the Billions Network and a way through 402 Payment Required responses. Use it when an agent has to prove who owns it or pay for API access. Claude Code CX Codex Cursor +1 8,200installs setup-matt-pocock-skills Matt Pocock This skill configures a repository for Matt Pocock's engineering skills by setting its issue tracker, triage labels, and domain docs layout. Run it before using the other skills. Claude Code 1,052,851installs to-tickets Matt Pocock Turns a plan, spec, or conversation into small end-to-end tickets with explicit blockers. Use it to agree on the work breakdown before tickets go to a tracker. Claude Code 711,230installs

Questions about opensrc

How do I install opensrc in Claude Code?

Run npx skills add vercel-labs/opensrc --skill opensrc -a claude-code, then run npx skills add vercel-labs/opensrc --skill opensrc -a claude-code again. The skill file is at ~/.claude/skills/opensrc/SKILL.md.

What does opensrc do?

It fetches and caches dependency source code so an agent can inspect implementations. It supports npm, PyPI, crates.io and repositories.

How does opensrc resolve an npm package version?

It detects the installed version from package-lock.json, pnpm-lock.yaml or yarn.lock. Use --cwd to resolve it from another project.

Source text

SKILL.md · Apache-2.0
---
name: opensrc
description: Fetch dependency source code to give AI agents deeper implementation context. Use when the agent needs to understand how a library works internally, read source code for a package, fetch implementation details for a dependency, or explore how an npm/PyPI/crates.io package is built. Triggers include "fetch source for", "read the source of", "how does X work internally", "get the implementation of", "opensrc path", or any task requiring access to dependency source code beyond types and docs.
allowed-tools: Bash(opensrc:*)
---

# Source Code Fetching with opensrc

Fetches dependency source code so agents can read implementations, not just types. Clones repositories at the correct version tag and caches them globally at `~/.opensrc/`.

## Core Pattern

```bash
rg "parse" $(opensrc path zod)
cat $(opensrc path zod)/src/types.ts
find $(opensrc path zod) -name "*.test.ts"
```

`opensrc path <pkg>` prints the absolute path to cached source. If not cached, it fetches automatically. Progress goes to stderr, path to stdout, so `$(opensrc path ...)` works in subshells.

## Fetching Source Code

```bash
opensrc path zod
opensrc path pypi:requests
opensrc path crates:serde
opensrc path facebook/react

# Multiple packages at once
opensrc path zod react next
opensrc path pypi:requests pypi:flask
opensrc path crates:serde crates:tokio

# Specific versions
opensrc path [email protected]
opensrc path pypi:[email protected]
opensrc path owner/[email protected]
opensrc path owner/repo#main
```

### Version Resolution

For npm packages, opensrc auto-detects the installed version from lockfiles (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`). Use `--cwd` to resolve from a different project:

```bash
opensrc path zod --cwd /path/to/project
```

For PyPI and crates.io, explicit versions or latest are used. For repos, use `@ref` or `#ref` to pin a branch, tag, or commit.

## Managing the Cache

Source is cached globally at `~/.opensrc/` (override with `OPENSRC_HOME`).

```bash
opensrc list                     # show all cached sources
opensrc list --json              # JSON output

opensrc remove zod               # remove a package
opensrc remove facebook/react    # remove a repo

opensrc clean                    # remove everything
opensrc clean --npm              # only npm packages
opensrc clean --pypi             # only PyPI packages
opensrc clean --crates           # only crates.io packages
opensrc clean --packages         # all packages, keep repos
opensrc clean --repos            # all repos, keep packages
```

## When to Fetch Source

Fetch source when you need to:
- Understand internal behavior that types don't reveal
- Debug unexpected library behavior
- Learn patterns from well-known implementations
- Verify how a function handles edge cases

Don't fetch source for simple API usage questions that docs or types can answer.

© vercel-labs · Apache-2.0 · vercel-labs/opensrc

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor