Welcome to Code2Prompt! This tutorial provides an introduction to
using Code2Prompt to generate AI-ready prompts from your codebases. We’ll
explore its core functionality and demonstrate its usage across different
integration methods.
Code2Prompt is a system tool designed to extract codebase informations for LLMs. It extracts relevant code snippets, applies filtering, and formats the information into structured prompts optimized for LLM. This simplifies tasks like code documentation, bug detection, refactoring, and more.
Code2Prompt offers different flavors to suit various use cases:
A core rust library that provides the foundation for code ingestion and
prompt
A user-friendly command-line interface for quick prompt generation. Ideal
for interactive use and one-off tasks.
A powerful Software Development Kit (SDK) for seamless integration into your
Python projects. Perfect for automating prompt generation within larger
workflows.
A Model Context Protocol (MCP) server for integration with LLM
agents. Enables sophisticated, real-time interactions with your codebase.
To reduce token usage of your harness, you can let your agent run code2prompt as a MCP server or as a skill. This allows agents to request code context dynamically in a way that replaces multiple find, glob and grep calls.