What is Code2Prompt ?

Code2Prompt simplifies code ingestion, turning your repository into structured prompts for AI and automation.

Code2prompt transforms any text repositories into meaningful prompts... Check it out !

Codebase 👨‍💻

node_app
├── README.md
├── data
│   └── sample.json
└── src
    ├── index.js
    └── utils.js

Command

$ code2prompt node_app

Output Prompt

Project Path: node_app

Source Tree:

```txt
node_app
├── README.md
├── data
│   └── sample.json
└── src
    ├── index.js
    └── utils.js
```

`node_app/README.md`:

```md
Simple Node.js app to process JSON data.
Feature idea: Add a filter function to sort users by age.
```

`node_app/data/sample.json`:

```json
{
    "users": [
        {
            "name": "Alice",
            "age": 25
        },
        {
            "name": "Bob",
            "age": 30
        }
    ]
}
```

`node_app/src/index.js`:

```js
const { processData } = require("./utils");

console.log("App started");
processData();
```

`node_app/src/utils.js`:

```js
function processData() {
  console.log("Processing data...");
}

module.exports = { processData };
```

Question

Add me a this cool feature

How to use Code2Prompt ?

Code2Prompt comes with different flavors depending on your needs.

Why Code2prompt ?

Code2Prompt introduces a new development workflow, enabling AI and human agents to interact with code efficiently.

Code2Prompt leverages glob patterns to include or exclude only the relevant files.

This allows you to query LLMs without extra noise, thus reducing hallucination and increasing performance.

code2prompt . --include "*.js,*.html" --exclude "node_modules/"
  • Code it
  • Parse it
  • Extract it
  • Format it
  • Analyze it
  • Optimize it
  • Rewrite it
  • Summarize it
  • Filter it
  • Search it
  • Sort it
  • Query it
  • Compare it
  • Deploy it
  • Debug it
  • Refactor it
  • Automate it
  • Run it
  • Monitor it
  • Test it
  • Track it
  • Patch it
  • Secure it
  • Train it
  • Validate it
  • Package it
  • Upgrade it
  • Integrate it
  • Unlock it
LLaMA Grok Qwen Mistral DeepSeek Gemini GPT Claude

Built for creators

Discover the new features

Code2Prompt transforms your codebase into structured prompts for AI models, making it easier to get accurate, context-aware responses.

High-Performance
Written in Rust for speed and efficiency, handling large codebases with minimal resource usage.
Handlebars-Powered
Customizable prompt generation using Handlebars templates, giving you full control over output format.
Smart Filtering
Supports include/exclude patterns with glob matching and smart context for precise code selection (soon).
Multi-Format Support
Exports structured prompts in JSON, Markdown, or XML with different formatting options to suit your workflow.
Git Integration
Includes Git diff and log extraction for better context, making it easier to understand code changes over time.
Open-Source & Community-Driven
Built with developer collaboration under the MIT license, encouraging contributions and extensions.

Join the Community

Code2Prompt is built by and for developers. Contribute, suggest features, and help shape the future of AI-driven code analysis.