Turning a directory tree into a single LLM prompt, minus the tedium
It exists because copy-pasting a dozen files into an LLM chat window is a terrible use of an afternoon.

What it does
files-to-prompt is a command-line utility that walks directories, filters files, and dumps their contents into a single stream of text. It respects .gitignore by default, skips hidden files, and lets you include or exclude paths with fnmatch patterns. The output is formatted with file paths and separators, ready to be piped into an LLM or saved to disk.
The interesting bit
The real value is in the formatting options tailored for LLMs: it can wrap everything in Anthropic’s Claude XML structure or emit Markdown fenced code blocks with guessed language tags, even handling nested triple backticks by extending the fence. It is essentially glue code, but it is thoughtful glue code that handles the edge cases you would otherwise hit five minutes in.
Key highlights
- Respects
.gitignoreand hidden-file conventions by default, so you don’t accidentally dump your.envinto the context window. - Supports
fnmatchignore patterns and extension filtering to narrow the file set. - Outputs in plain text, Claude XML (
--cxml), or Markdown (--markdown) with automatic language-tag guessing. - Reads file lists from stdin, including NUL-separated paths for safe handling of filenames containing spaces.
- Optionally prefixes every line with line numbers.
Verdict
Anyone regularly feeding code or documentation to LLMs will save time. If you rarely need more than a single file, your shell’s built-ins are already enough.
Frequently asked
- What is simonw/files-to-prompt?
- It exists because copy-pasting a dozen files into an LLM chat window is a terrible use of an afternoon.
- Is files-to-prompt open source?
- Yes — simonw/files-to-prompt is open source, released under the Apache-2.0 license.
- What language is files-to-prompt written in?
- simonw/files-to-prompt is primarily written in Python.
- How popular is files-to-prompt?
- simonw/files-to-prompt has 2.8k stars on GitHub.
- Where can I find files-to-prompt?
- simonw/files-to-prompt is on GitHub at https://github.com/simonw/files-to-prompt.