opensrc
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.
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- opensrc
- metadata
- { "internal": true }
- 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:*)
03 SKILL.md 正文
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.
04 同仓库更多 Skills
xtarterize
Apply production-grade conformance configurations (linting, type checking, CI, editor settings, AI skills, release tooling) to JS/TS projects. Scans package.json and config files to auto-detect framework, bundler, and styling, then resolves applicable tasks. Use when user mentions "xtarterize", "conformance", "setup linting", "add CI", "configure project", "init xtarterize", or any task name like "lint/biome", "ts/strict", or "ci/workflow".
create-xtarter-app
Scaffold new JS/TS projects from curated starter templates pre-configured with Biome, TypeScript strict mode, Git hooks, GitHub Actions workflows, VS Code settings, and AI agent skills. Use when user wants to create a new project, scaffold an app from a template, or mentions "create-xtarter-app", "npx create-xtarter-app", "scaffold", "starter template", or a template name like "next-tailwind", "vite-chakra", "vite-tailwind", or "next-chakra".
write-a-skill
Create new agent skills with proper structure, progressive disclosure, and bundled resources. Use when user wants to create, write, or build a new skill.
template-skill
Replace with description of the skill and when Claude should use it.
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
improve-codebase-architecture
Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.