Skip to content
aicoolies logo
code2prompt logo

code2prompt

CLI tool to convert codebases into LLM-ready prompts

code2prompt is a Rust CLI that converts entire codebases into structured prompts optimized for LLM context windows. It intelligently filters files using gitignore patterns, respects token budgets, generates directory tree visualizations, and supports custom Handlebars templates for output formatting. The tool addresses the core challenge of feeding large codebases to AI coding assistants by producing clean, organized context that maximizes the value of limited token budgets.

About code2prompt

code2prompt solves one of the most practical challenges in AI-assisted development: getting relevant codebase context into an LLM prompt without exceeding token limits or drowning the model in irrelevant files. The CLI traverses a project directory, respects gitignore rules and custom exclusion patterns, and assembles the selected files into a structured prompt with directory tree visualization, file contents, and metadata. Token counting against configurable limits helps developers stay within context window budgets for their target model.

The Handlebars template system allows customizing the output format for different use cases. Developers can create templates that emphasize architecture documentation, code review context, bug investigation, or refactoring analysis, each surfacing different aspects of the codebase. Built-in templates cover common scenarios, while the extensible template system accommodates specialized workflows. The Rust implementation ensures fast traversal of large repositories without the startup overhead of interpreted languages.

With over 7,300 GitHub stars and 300+ forks, code2prompt has become a standard tool in the AI coding workflow alongside tools like Repomix. The MIT license enables unrestricted use, and the single-binary distribution means no runtime dependencies to manage. The tool integrates naturally into command pipelines, accepting input from standard repository structures and outputting formatted text that can be piped directly to clipboard managers or LLM API calls.

Pricing & Platform Specs

Pricing Summary

Free and 100% open source under the MIT license. code2prompt has $0 licensing costs and no paid tiers. It runs locally as a high-performance Rust CLI, Python SDK, or MCP server to format codebases for LLMs without ongoing fees.

full pricing breakdown →

Supported Platforms

CLI on macOS, Linux, Windows

Explore categories, tags & use cases

Virtual engineering team as Claude Code skills by YC CEO Garry Tan

GStack transforms Claude Code into a structured virtual engineering team through 23 opinionated slash command skills created by Y Combinator CEO Garry Tan. It assigns specialist roles including CEO product review, engineering manager architecture oversight, designer visual audit, QA lead with real browser testing, and release engineer deployment. Each skill enforces focused workflows with clear decision principles for running parallel coding sessions.

Open Source

Agent harness performance system with 30+ agents and 136 skills

Everything Claude Code is a comprehensive agent harness performance optimization system providing 30 specialized agents, 136 skills, 60 commands, and automated hook workflows for AI-assisted development. Born from an Anthropic hackathon winner and evolved over 10+ months of intensive daily use, it works across Claude Code, Codex, Cursor, and OpenCode with built-in security scanning via AgentShield, continuous learning, and research-first development patterns.

Open Source

AI coding agent for embedded systems and firmware engineering

Embedder is a specialized AI coding agent for firmware and embedded systems development. It supports 400+ MCU variants including STM32 and ESP32, parses hardware datasheets to understand register maps and pin configurations, and verifies generated code by interacting with physical boards via serial console. YC S25 participant currently in beta.

paid

Side-by-Side Comparisons

code2prompt logo
code2prompt
vs
Repomix logo
Repomix

code2prompt vs Repomix — Rust CLI Codebase Serializer vs Node.js Prompt Generator

code2prompt and Repomix both convert codebases into LLM-ready prompts, but they differ in language, template systems, and optimization strategies. code2prompt is a Rust CLI with Handlebars templates and token budget management, while Repomix is a Node.js tool focused on intelligent file selection with built-in security checking and multiple output formats for different AI coding workflows.

code2promptRepomix

Community experience

Sources & verification

Sources checked
Content verified

Verification dates are editorial checks. Routine CMS saves and automatic updatedAt timestamps do not advance them.

FAQ

What is code2prompt?

code2prompt is a Rust CLI that converts entire codebases into structured prompts optimized for LLM context windows. It intelligently filters files using gitignore patterns, respects token budgets, generates directory tree visualizations, and supports custom Handlebars templates for output formatting. The tool addresses the core challenge of feeding large codebases to AI coding assistants by producing clean, organized context that maximizes the value of limited token budgets.

Is code2prompt free?

Yes — code2prompt is open source and free to use. Free and 100% open source under the MIT license. code2prompt has $0 licensing costs and no paid tiers. It runs locally as a high-performance Rust CLI, Python SDK, or MCP server to format codebases for LLMs without ongoing fees.

Is code2prompt open source?

Yes — code2prompt is open source.

Is code2prompt still maintained?

Yes — code2prompt is active. Its listing was last verified on September 6, 2026.

What are the best code2prompt alternatives?

The first editor-selected code2prompt alternatives are GStack, Everything Claude Code, Embedder.