Fetch dependency source code

VerifiedSafe

Fetches and caches source code for npm, PyPI and crates.io dependencies so agents can read real implementations beyond types and docs.

Sby Skills Guide Bot
DevelopmentIntermediate
10/20/2026
Claude CodeCursorCodex
#dependency-source#code-navigation#package-managers#caching#agent-context

Recommended for

Automated summary

A skill that lets the agent fetch and read the actual source code of a dependency (npm, PyPI, crates.io, or a GitHub repo) through the opensrc command, backed by a global cache.

Strengths

  • Exposes real implementations instead of relying only on types and docs
  • Auto-detects the installed npm version from lockfiles, with a --cwd option for other projects
  • Clean stdout/stderr split so `$(opensrc path pkg)` composes directly with rg, cat, and find
  • Explicit cache management: list, remove, and clean with per-ecosystem filters

Limitations

  • Requires the opensrc binary to be installed and a matching Bash permission
  • No lockfile-based version detection for PyPI or crates.io, so you must pin a version or take latest
  • Cloning large repositories can be slow and disk-heavy
When to use it

Use it when the agent needs to understand a library's internal behavior, debug unexpected results, or confirm edge-case handling in the source.

When not to use it

Skip it for straightforward API usage questions that docs or type definitions already answer.

Security analysis

Safe
Quality score85/100

The skill is straightforward documentation for a source-fetching CLI. It contains no destructive filesystem commands, no credential or token handling, no piping to shells, no base64/obfuscated payloads, and no attempts to override agent instructions. The only execution surface is the `opensrc` binary, which clones public dependency repos into a user-scoped cache — a legitimate, low-risk operation. Minor note: illustrative shell snippets reference `rg`/`cat`/`find` beyond the declared allowed-tools scope.

Findings
  • •Example commands use `rg`, `cat`, and `find`, which are outside the declared `Bash(opensrc:*)` tool restriction; an agent following them would need broader bash permissions than declared.
  • •The tool implicitly performs network operations (git clone) and writes to a global cache at `~/.opensrc/`; `opensrc clean` removes cached data, though scoped to that directory only.
  • •Documentation examples invoke `rg`, `cat`, and `find` via command substitution, which fall outside the declared `Bash(opensrc:*)` permission scope; an agent following the examples literally would need broader shell permissions than declared.
  • •The tool performs network access (cloning GitHub repositories / downloading package sources) and writes to a global cache at `~/.opensrc/` — legitimate but worth noting for sandboxed environments.
  • •`opensrc clean` deletes cached source directories under `~/.opensrc/` (or `OPENSRC_HOME`); deletion is scoped to the cache, not arbitrary paths.
How this analysis is made

Examples

Inspect library internals
How does zod's object parser handle unknown keys internally? Fetch the source with opensrc and show me the relevant code.
Debug unexpected behavior
requests is retrying differently than I expect. Fetch pypi:requests source with opensrc and find where the retry logic lives.
Learn from a known repo
Use opensrc to pull facebook/react at v18.2.0 and point me to how the reconciler schedules work.

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

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

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 zod@3.22.0
opensrc path pypi:flask@3.0.0
opensrc path owner/repo@v1.0.0
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:

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).

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.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/fetch-dependency-source-code-mvda86tg' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/fetch-dependency-source-code-mvda86tg/download' --output '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md.part' && mv '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md.part' '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(opensrc:*)

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && test -s '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/opensrc' && cp -R '.skill-downloads/fetch-dependency-source-code-mvda86tg' '.claude/skills/opensrc'

Cursor
test -f '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && test -s '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/opensrc' && cp -R '.skill-downloads/fetch-dependency-source-code-mvda86tg' '.cursor/skills/opensrc'

Codex
test -f '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && test -s '.skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/opensrc' && cp -R '.skill-downloads/fetch-dependency-source-code-mvda86tg' '.agents/skills/opensrc'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/fetch-dependency-source-code-mvda86tg'

openskills read 'fetch-dependency-source-code-mvda86tg'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/fetch-dependency-source-code-mvda86tg/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills