GeezerVison is showing code2prompt.dev — Code2Prompt Code2Prompt
Transform Your Code into AI-Optimized Prompts in Seconds
What is Code2Prompt ?
Code2Prompt is a context engineering tool that ingests your codebase, turning your repository into structured, AI-ready prompts.
Transform any repository into meaningful context following the Goal + Format + Context framework... Check it out ! history_notes
├── history
│ ├── medieval.txt
│ ├── renaissance.txt
│ └── ww2.txt
└── meta
└── my_revision_goals.txt Command
$ code2prompt history_notes Create interactive flashcards for my upcoming history exam Generate question-answer pairs in markdown format:
- Each flashcard as a separate section
- Questions that test key facts, dates, and connections
- Concise but comprehensive answers
- Organized by historical period Project Path: history_notes
Source Tree:
```txt
history_notes
├── history
│ ├── medieval.txt
│ ├── renaissance.txt
│ └── ww2.txt
└── meta
└── my_revision_goals.txt
```
`history_notes/history/medieval.txt`:
```txt
Key events: Fall of Rome, Viking raids, Magna Carta
Important dates: 476 AD, 793 AD, 1215 AD
```
`history_notes/history/renaissance.txt`:
```txt
Key figures: Leonardo da Vinci, Michelangelo, Copernicus
Cultural shifts: Humanism, art revival, printing press
```
`history_notes/history/ww2.txt`:
```txt
Key events: D-Day, Hiroshima, End of War
Leaders: Churchill, Roosevelt, Hitler, Stalin
```
`history_notes/meta/my_revision_goals.txt`:
```txt
Focus: Memorize key events, understand causes & consequences
Deadline: 2 weeks
``` my_recipes
├── pantry
│ └── my_ingredients.txt
└── recipes
├── pasta.txt
├── pizza.txt
├── salad.txt
└── soup.txt Command
$ code2prompt my_recipes Suggest a recipe I can cook tonight based on my available ingredients Provide a personalized recommendation with:
- Recipe name and brief description
- Ingredient checklist (what I have vs. what I need)
- Step-by-step cooking instructions
- Estimated prep and cooking time Project Path: my_recipes
Source Tree:
```txt
my_recipes
├── pantry
│ └── my_ingredients.txt
└── recipes
├── pasta.txt
├── pizza.txt
├── salad.txt
└── soup.txt
```
`my_recipes/pantry/my_ingredients.txt`:
```txt
Available: pasta, tomato sauce, cheese
```
`my_recipes/recipes/pasta.txt`:
```txt
Ingredients: pasta, tomato sauce, garlic, basil
Instructions: Boil pasta, heat sauce, mix, serve.
```
`my_recipes/recipes/pizza.txt`:
```txt
Ingredients: flour, tomato sauce, cheese, oregano
Instructions: Make dough, add toppings, bake.
```
`my_recipes/recipes/salad.txt`:
```txt
Ingredients: lettuce, tomato, cucumber, olive oil
Instructions: Chop ingredients, mix, drizzle oil.
```
`my_recipes/recipes/soup.txt`:
```txt
Ingredients: carrots, potatoes, chicken broth, onions
Instructions: Boil broth, add vegetables, simmer.
``` node_app
├── README.md
├── data
│ └── sample.json
└── src
├── index.js
└── utils.js Command
$ code2prompt node_app Add a user filtering feature to sort users by age in ascending order Provide the complete implementation with:
- Updated utils.js with the new filterUsersByAge function
- Modified index.js to demonstrate the filtering
- Clear code comments explaining the logic 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 };
```
Code2Prompt comes with different flavors depending on your needs.
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
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.
|