Skip to content
← Tools / Skills
ToolMufeed VH/10 trustVerified

code2prompt

Turn your entire codebase into a single LLM prompt — source tree, token counts, git context, templating.

Visit official site →

About

code2prompt is a Rust CLI that converts a codebase into one well-formatted Markdown prompt: source tree, file contents, token counts, and optional git diffs, logs, and branch comparisons. It respects .gitignore, filters with glob patterns, and uses Handlebars templates so you can shape the prompt for the job — porting code to another language, hunting bugs, generating docs, or implementing features.

Written in Rust, it is fast on large repos, and the token tracking keeps you inside context limits instead of discovering the overflow after a failed API call. There is a terminal UI for interactive configuration, clipboard auto-copy, and smart handling of non-code formats (CSV, notebooks, JSONL).

The honest caveat: this is a well-executed version of a simple idea, and the idea is increasingly absorbed into agentic tools that read repos themselves. Its remaining edge is control — exact file selection, exact templating, exact token budgets — which matters when you are feeding a model deliberately rather than letting an agent rummage. ~7,700 stars, MIT-licensed, docs at code2prompt.dev.

What it can do

  • Codebase-to-prompt generation with source tree and formatting
  • Token counting to stay within context limits
  • Handlebars prompt templating for different use cases
  • Glob filtering, .gitignore respect, line numbers, clipboard copy
  • Git integration: diffs, logs, branch comparisons in prompts
  • Terminal UI for interactive configuration; blazing-fast Rust binary
  • MIT-licensed

Setup

  1. Install: download a binary from GitHub Releases, or build with cargo install --path crates/code2prompt (needs Git, Rust, Cargo).
  2. Run code2prompt <path> in your repo to generate the prompt.
  3. Use flags for filtering (--include/--exclude), templating (--template), token counting (--tokens), and git context.
  4. Copy the output (or let it auto-copy) into your model of choice.

Prerequisites

A local codebase; a prebuilt binary or a Rust toolchain to compile from source.

Use cases

codeclideveloper-toolsllmproductivity

Works with

Trust score — 8/10

/10 trustVerified

Scored 8/10 (verified tier, metrics-v1). Evidence: Adoption 7: starScore from 7,726 stars on mufeedvh/code2prompt (log scale vs 298k peer max); Maintenance 8: pushed 2026-09-25 (recency 9); mature, stable feature set; Openness 10: MIT (0.7*10) + official docs verified at code2prompt.dev (0.3*10); Manual 8: focused single-purpose Rust CLI corroborated by docs and releases; docked: concept increasingly absorbed by agentic tools. License: MIT.

★ 7,726 GitHub stars

How the trust score is built

Full methodology →
Adoption · stars/downloads, log-scaled vs peers
7.0/10
Maintenance · recency, releases, issue load
8.0/10
Openness · license + docs
10.0/10
Manual review · sanity read + red-flag check
8.0/10
  • · Adoption 7: starScore from 7,726 stars on mufeedvh/code2prompt (log scale vs 298k peer max)
  • · Maintenance 8: pushed 2026-09-25 (recency 9); mature, stable feature set
  • · Openness 10: MIT (0.7*10) + official docs verified at code2prompt.dev (0.3*10)
  • · Manual 8: focused single-purpose Rust CLI corroborated by docs and releases; docked: concept increasingly absorbed by agentic tools

Sources

Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.