# AI use cases for Code2prompt (mufeedvh/code2prompt)

Repo: [mufeedvh/code2prompt](https://github.com/mufeedvh/code2prompt) | Use cases: 3 | Page: https://dedupedai.com/use-cases/mufeedvh-code2prompt/

Code2Prompt is a Rust context engineering tool that turns a codebase into one well-structured prompt for large language models. It respects .gitignore, filters files with glob patterns, applies Handlebars templates, estimates token counts, can include git diffs, logs and branch comparisons, and offers a CLI with an interactive TUI, a Python SDK, an MCP server and an agent skill.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Turn a whole repo into one prompt for an LLM: https://dedupedai.com/use-cases/mufeedvh-code2prompt/turn-a-repo-into-one-llm-prompt/
- Help your coding agent find the right files faster: https://dedupedai.com/use-cases/mufeedvh-code2prompt/give-your-coding-agent-scoped-context/
- Build a review prompt from your git changes: https://dedupedai.com/use-cases/mufeedvh-code2prompt/send-only-a-git-diff-for-review/

## How to turn a whole repo into one prompt for an LLM with Code2prompt

Repo: [mufeedvh/code2prompt](https://github.com/mufeedvh/code2prompt) | Difficulty: Beginner | Time: 5 minutes | Basis: From the README

Point Code2prompt at a folder to get a formatted prompt with the source tree and files, copied or saved.

**Who it is for:** A developer who keeps copying files one by one into a chat window to ask about a codebase.

**The problem:** Manually gathering and formatting files for an LLM is slow and you never know how many tokens you are sending.

**The outcome:** One structured prompt of your project, with a token estimate, on your clipboard or in a file.

### Steps

1. Install with `cargo install code2prompt` or `brew install code2prompt`
2. Run `code2prompt .` in your project; output goes to stdout, add -c to copy it to the clipboard
3. Save it instead with `code2prompt path/to/project --output-file prompt.txt`
4. Check the token estimate before pasting so you stay inside your model's context window
5. Paste the prompt into your LLM with your question

### Prompt to paste into your agent

```text
Install mufeedvh/code2prompt and generate a prompt for <project folder> saved to prompt.txt. Tell me the token estimate, and if it is over <limit> tokens, rerun it excluding <folders> with glob filters.
```

### Caveat

The token count is an estimate: the README says the full rendered prompt is not re-tokenized. Check that no secrets are in the files before sending them to a hosted model.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mufeedvh-code2prompt/turn-a-repo-into-one-llm-prompt/

## How to help your coding agent find the right files faster with Code2prompt

Repo: [mufeedvh/code2prompt](https://github.com/mufeedvh/code2prompt) | Difficulty: Beginner | Time: 10 minutes | Basis: From the README

Install the Code2prompt agent skill so your agent maps functions and classes before reading code.

**Who it is for:** A Claude Code or Codex user whose agent burns many turns exploring a large repo.

**The problem:** Agents waste tokens and time opening files one at a time to figure out where things live.

**The outcome:** An agent that inspects a compact map of the codebase and then reads the relevant source and tests together.

### Steps

1. Install the Code2prompt CLI separately, for example with `cargo install code2prompt`
2. Add the skill with `npx skills add mufeedvh/code2prompt`
3. For one agent globally, run `npx skills add mufeedvh/code2prompt --skill code2prompt --agent codex --global`
4. Ask your agent to map the codebase with the skill before making a change
5. Optionally enable the entity-map feature; standard builds fall back to a directory map

### Prompt to paste into your agent

```text
Install the mufeedvh/code2prompt CLI and its agent skill for <agent>, then use it to build a map of <repo> and gather only the files and tests needed to <task>. Show me the context you gathered before editing anything.
```

### Caveat

The skill does not install the CLI; you need both. The installer may clone the repository temporarily to fetch the skill files.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mufeedvh-code2prompt/give-your-coding-agent-scoped-context/

## How to build a review prompt from your git changes with Code2prompt

Repo: [mufeedvh/code2prompt](https://github.com/mufeedvh/code2prompt) | Difficulty: Intermediate | Time: 20 minutes | Basis: From the README

Use Code2prompt's git integration and templates to package diffs or branch comparisons for an LLM review.

**Who it is for:** A developer who wants a quick AI code review of a branch before opening a pull request.

**The problem:** Sending the whole repo for a review wastes tokens and buries the actual change.

**The outcome:** A focused prompt with the diff, log or branch comparison plus your review template.

### Steps

1. Install with `cargo install code2prompt` or `brew install code2prompt`
2. Use the Git Integration options to include diffs, logs or branch comparisons in the prompt
3. Write a Handlebars template with your review checklist so every review asks the same questions
4. Use the TUI to configure options interactively if you do not remember the flags
5. Send the prompt to your LLM and treat its comments as suggestions

### Prompt to paste into your agent

```text
Using mufeedvh/code2prompt, create a prompt for reviewing the changes on my branch <branch> against <base>, using a Handlebars template that asks for bugs, missing tests and security issues. Save it to review.txt and give me the command you used.
```

### Caveat

The README points to the online docs for the exact git and template flags, so check them for your version.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/mufeedvh-code2prompt/send-only-a-git-diff-for-review/
