code2prompt Prompt模板 是 AI Skill Hub 本期精选AI工具之一。已获得 7.3k 颗 GitHub Star,综合评分 8.2 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
将整个代码库转换为单个LLM提示词的CLI工具。支持生成源代码树和完整代码上下文,便于开发者快速向AI模型(如ChatGPT、Claude)提交代码进行分析、优化或代码审查。适合需要与AI协作的开发者。
code2prompt Prompt模板 是一款基于 Rust 开发的开源工具,专注于 提示词生成、代码分析、CLI工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
将整个代码库转换为单个LLM提示词的CLI工具。支持生成源代码树和完整代码上下文,便于开发者快速向AI模型(如ChatGPT、Claude)提交代码进行分析、优化或代码审查。适合需要与AI协作的开发者。
code2prompt Prompt模板 是一款基于 Rust 开发的开源工具,专注于 提示词生成、代码分析、CLI工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:cargo install(推荐) cargo install code2prompt # 方式二:从源码编译 git clone https://github.com/mufeedvh/code2prompt cd code2prompt cargo build --release # 二进制在 ./target/release/code2prompt
# 查看帮助 code2prompt --help # 基本运行 code2prompt [options] <input> # 详细使用说明请查阅文档 # https://github.com/mufeedvh/code2prompt
# code2prompt 配置说明 # 查看配置选项 code2prompt --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export CODE2PROMPT_CONFIG="/path/to/config.yml"
<p align="center"> <a href="https://code2prompt.dev"><b>Website</b></a> • <a href="https://code2prompt.dev/docs/welcome/"><b>Documentation</b></a> • <a href="https://discord.com/invite/ZZyBbsHTwH"><b>Discord</b></a> </p>
</div>
---

Code2Prompt is a powerful context engineering tool designed to ingest codebases and format them for Large Language Models. Whether you are manually copying context for ChatGPT, building AI agents via Python, or running a MCP server, Code2Prompt streamlines the context preparation process.
Code2Prompt transforms your entire codebase into a well-structured prompt for large language models. Key features include:
.gitignore rulesStop manually copying files and formatting code for LLMs. Code2Prompt handles the tedious work so you can focus on getting insights and solutions from AI models.
pip install code2prompt-rs
Requires:
git clone https://github.com/mufeedvh/code2prompt.git
cd code2prompt/
cargo install --path crates/code2prompt
Once installed, generating a prompt from your codebase is as simple as pointing the tool to your directory.
Basic Usage: Generate a prompt from the current directory and copy it to the clipboard.
code2prompt .
Save to file:
code2prompt path/to/project --output-file prompt.txt
Refer to the documentation for detailed installation instructions.
实用的开发者工具,填补代码到提示词转换的空白。Rust实现保证性能,开源社区活跃,适合AI编程工作流集成。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,code2prompt Prompt模板 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | code2prompt |
| 原始描述 | 开源Prompt模板:A CLI tool to convert your codebase into a single LLM prompt with source tree, p。⭐7.3k · Rust |
| Topics | 提示词生成代码分析CLI工具AI辅助编码 |
| GitHub | https://github.com/mufeedvh/code2prompt |
| License | MIT |
| 语言 | Rust |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。