code2prompt
This skill installs and uses code2prompt, a CLI tool that maps code entities and reads grouped source files to reduce agent round trips.
Community author
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- 6658513pinned Oct 9, 2026
- Context cost
- about 1,600 tokenswhen the skill loads
- GitHub stars
- 7,722on mufeedvh/code2prompt
- Scripts
- None found
What it does
“Explore codebases efficiently with code2prompt, using sem-backed entity maps and grouped source reads to reduce agent round trips. Use when understanding an unfamiliar repository, locating implementations, gathering context for changes or reviews, or installing code2prompt.”
Generated summary from the skill's own text
This skill installs and uses code2prompt, a CLI tool that maps code entities and reads grouped source files to reduce agent round trips. It helps the agent explore unfamiliar repositories, locate implementations, and gather context for code changes by using semantic entity maps and structured file selections instead of repeated searches.
When to use it
- Understanding an unfamiliar codebase structure and layout
- Locating specific function or class implementations across files
- Gathering implementation and test code together for context
- Exploring a repository area before making changes or reviews
When not to
- Finding exact text matches in files; use text search instead
- Querying specific line ranges within very large files
- When code2prompt CLI is unavailable and cannot be installed
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add mufeedvh/code2prompt --skill code2promptInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install mufeedvh/code2prompt code2prompt@66585136062c04275ddd5a01c5518a4d78c4aa76Installs the commit we checked (6658513).
Copy by hand
Download the folder at 6658513 and put it in .claude/skills/code2prompt for Claude Code and in .agents/skills/code2prompt for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "code2prompt" by mufeedvh. Source, pinned to commit 66585136062c04275ddd5a01c5518a4d78c4aa76: https://github.com/mufeedvh/code2prompt/tree/66585136062c04275ddd5a01c5518a4d78c4aa76/skills/code2prompt 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/code2prompt/ for Claude Code and .agents/skills/code2prompt/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/mufeedvh/code2prompt
SKILL.md at the pin
--- name: code2prompt description: Explore codebases efficiently with code2prompt, using sem-backed entity maps and grouped source reads to reduce agent round trips. Use when understanding an unfamiliar repository, locating implementations, gathering context for changes or reviews, or installing code2prompt. --- # Code2Prompt Let code2prompt traverse, filter, parse, and assemble repository context locally. Use compact structural maps to choose relevant files, then read the implementation and its tests together. Prefer this over repeated `find`, `rg --files`, and individual file reads for broad exploration. Choose the shortest useful workflow: - If the relevant paths are known, go directly to a grouped source read. - For an unfamiliar area, request one entity map, then use its paths and symbols to select a grouped read. Reuse the map until relevant source files change. - For a small area, reading its source directly can be cheaper than mapping it. - If entity extraction is unavailable, use the directory map as a fallback. Adapt the scope to the task and context budget. Avoid scanning the whole repository again for each question or dumping all source before identifying the relevant area. ## Install the CLI Check availability once per environment, not before every read: ```sh code2prompt --version code2prompt --help ``` For the sem-backed entity map, use a CLI built with the optional `entity-map` feature. With Rust/Cargo available, build it from the code2prompt repository: ```sh cargo install --git https://github.com/mufeedvh/code2prompt \ --locked --features entity-map code2prompt ``` For ordinary directory maps and source reads, a standard installation is enough: ```sh # Choose one available package manager: cargo install code2prompt --locked brew install code2prompt ``` An existing CLI may list `--entity-map` in its help even when built without the feature; in that case extraction returns no entities. If building with the feature is unavailable or unnecessary for the task, continue with ordinary source reads. There is no separate `sem` executable or service to configure: code2prompt uses `sem-core` internally. Prebuilt binaries are available from the [GitHub releases](https://github.com/mufeedvh/code2prompt/releases). Installing this skill adds instructions; the CLI is installed separately. `pip install code2prompt-rs` installs the Python SDK, not the CLI. ## Map an unfamiliar area Run from the repository you want to inspect. Replace the example paths and patterns below with its actual layout. Set `CODE2PROMPT_SKILL_DIR` to the absolute directory containing this installed `SKILL.md`; the bundled template is [assets/code-map.hbs](assets/code-map.hbs). It is a skill resource, not a file in the repository being analyzed. For a source area and its tests: ```sh code2prompt . --include 'src/**' --include 'tests/**' \ --exclude '**/*.snap' --entity-map \ --template "$CODE2PROMPT_SKILL_DIR/assets/code-map.hbs" \ --output-file - --quiet ``` For an unknown layout, omit the includes and exclude generated/vendor paths, or get a directory map first. The template lists selected file paths and extracted entities: names, kinds, declaration snippets, parent names, and line ranges. It does not render full file contents; `--entity-map` with the default template does. Declaration snippets are the first line of an entity and can contain inline code; exclude generated/minified files to keep the map useful. Do not combine entity extraction with `--exclude '**'` or `--deselected`: files must be selected for code2prompt to parse them. `(no extracted entities)` means extraction returned nothing or the binary lacks the feature. Some files yield generic `chunk` entries instead of declarations; the template shows their ranges without content snippets. Neither case means the file is irrelevant. Read manifests, documentation, or other such files directly as needed. This map is not a dependency graph or semantic text search. Fallback directory map, without file contents: ```sh code2prompt . --full-directory-tree --exclude '**' --output-file - --quiet ``` The full tree keeps excluded paths visible while respecting ignore rules and skipping hidden entries by default. To reduce this tree, analyze a subdirectory; include/exclude patterns do not prune a full directory tree. ## Read the selected context together Load the relevant implementation and tests together with line numbers: ```sh code2prompt . --include 'src/auth/**' --include 'tests/auth/**' \ --exclude '**/*.snap' --line-numbers --output-file - --quiet ``` Read a small set of specific files when their paths are known: ```sh code2prompt . --include 'README.md' --include 'src/auth/session.ts' \ --line-numbers --output-file - --quiet ``` Use the map to collect the likely implementation, its callers or interfaces, and related tests in one request. Add another batch only when the returned source reveals a missing dependency or leaves a concrete question unresolved. Narrow the selection if output is too large or truncated. For an exact content match or a small line range within a very large file, use an appropriate text search or file-reading tool. code2prompt selects whole files by path; it does not offer a symbol-query or line-range CLI selector. ## Useful controls - Quote glob patterns so the shell does not expand them. Patterns are relative to the analyzed directory; repeat `--include` and `--exclude` for multiple patterns. Use `**/*.rs` for a language or `src/**` for a subtree. - Use `--output-file -` to explicitly send the prompt to stdout, including when configuration defaults to clipboard output. `--quiet` suppresses progress and summary messages. Avoid `--tui` in automated agent workflows. - For structured output, add `--output-format json`. For a larger result, use `--output-file` with a temporary file outside the analyzed directory, then read that file. Omit `--quiet` to see the estimated token count on stderr. The current estimate includes selected file contents even for a template that omits their bodies; do not interpret it as the compact map's actual token size. - Hidden files require `--hidden`. Ignored files require `--no-ignore`; keep the default ignore behavior for ordinary exploration and target any extra files explicitly with include patterns. - If output differs from the requested scope, rerun without `--quiet` to see which configuration was loaded. The CLI reads `.c2pconfig` from the working directory, then falls back to the platform's user configuration directory. Supplying any CLI include/exclude patterns replaces both configured pattern lists; a configured `path` can override the positional directory. See the [CLI guide](https://code2prompt.dev/docs/how_to/cli/) for more options.
From mufeedvh/code2prompt at 6658513, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 6658513Files
- SKILL.md6.8 KB · 8f2d45547a26
- assets/
- code-map.hbs390 B · 06c4efbf8676
2 files, 7.2 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 6658513Related in Coding workflow
planning
This skill orchestrates multi-workflow projects with dependencies and shared data tables by creating a task graph in the orchestrator via the create-tasks tool.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.4K tokens · pinned 6 days ago
progressive-building
This skill implements incremental workflow development for agents building or extending workflows.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.4K tokens · pinned 6 days ago
workflow-builder
Builds and edits n8n workflows using the TypeScript SDK.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 14.2K tokens · pinned 6 days ago
remotion-upgrade
This skill upgrades Remotion and its related packages to the latest stable version.
by RemotionOfficial publisher
Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 6 days ago
remotion-upgrade
This skill upgrades Remotion and related packages across a project, automatically detecting the package manager and workspaces.
by RemotionOfficial publisher
Claude Code, Codex, Cursor +3 · about 460 tokens · pinned 6 days ago
final-release-review
Audits Python SDK release candidates or plans against the previous release, comparing diffs for regressions, API changes, and version compatibility.
by OpenAIOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 5.4K tokens · pinned 6 days ago