At its core, code2prompt does one thing exceptionally well: it transforms your entire codebase into a single, well-structured prompt that’s ready for LLM consumption. I highly recommend trying this tool out when working on an open source project, or working with a self hosted LLM via say Ollama.

The tool includes several thoughtful features that make it particularly valuable:

  • It automatically respects your .gitignore file.
  • It adds each file’s full path as a header to the file’s contents.
  • It supports modifying the output via templating.

and a bunch more.

I’ve found that the latest version (v2.0.0)’s “automatically copy to clipboard” feature is broken. I’ve worked around this by leveraging the technique I detailed in this other blog post.

Overall, code2prompt has made interacting with LLMs much easier.