files-to-prompt: Concatenate Files into a Single Prompt for LLMs
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
files-to-prompt is a command-line tool designed to concatenate the contents of multiple files from a directory into a single, structured prompt suitable for Large Language Models (LLMs). It offers flexible options for filtering files by extension, ignoring patterns, and supports various output formats including standard text, Claude XML, and Markdown. This utility streamlines the process of preparing complex codebases or documentation for AI analysis.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
files-to-prompt is a powerful command-line utility created by Simon Willison that simplifies the process of preparing textual data for Large Language Models (LLMs). It efficiently concatenates the contents of multiple files, or even entire directories, into a single, cohesive output. This tool is particularly useful for developers and researchers who need to feed large amounts of code, documentation, or other text files into LLMs for tasks like code analysis, summarization, or question-answering, ensuring the LLM receives a well-structured context.
Installation
Installing files-to-prompt is straightforward using pip:
pip install files-to-prompt
Examples
Here are some common ways to use files-to-prompt:
Basic Usage: Concatenate all files in a directory.
files-to-prompt path/to/directory
Filter by Extension: Include only files with specific extensions.
files-to-prompt path/to/directory -e py -e js
Output as Claude XML: Format the output specifically for Anthropic's Claude LLMs, optimizing for its context window.
files-to-prompt path/to/directory --cxml
Output as Markdown: Generate output with fenced code blocks, useful for pasting into Markdown documents.
files-to-prompt path/to/directory --markdown
Include Line Numbers: Add line numbers to each file's content in the output.
files-to-prompt path/to/directory -n
Ignore Files: Exclude files matching a specific pattern.
files-to-prompt path/to/directory --ignore "*.log"
Read from Stdin: Pipe file paths from another command, such as find.
find . -name "*.py" -print0 | files-to-prompt --null
Why Use files-to-prompt?
In the era of powerful LLMs, providing well-structured and relevant context is crucial for obtaining accurate and useful responses. files-to-prompt addresses this need by:
- Streamlining Context Preparation: Automatically gathers and formats content from multiple files, saving manual effort.
- Optimizing for LLMs: Offers specific output formats like Claude XML and Markdown, which can improve how LLMs process and understand the provided context.
- Flexibility and Control: Provides extensive options for filtering, ignoring, and customizing the output, allowing users to precisely control what content is included.
- Developer-Friendly: Integrates seamlessly into existing workflows, especially for projects involving codebases or extensive documentation.
Links
- GitHub Repository: https://github.com/simonw/files-to-prompt
- PyPI: https://pypi.org/project/files-to-prompt/
- Background Article: Building files-to-prompt entirely using Claude 3 Opus
Related repositories
Similar repositories that may be relevant next.

awesome-cli-coding-agents: A Curated Directory of Terminal-Native AI Tools
August 9, 2026
The `awesome-cli-coding-agents` repository offers a comprehensive, curated directory of over 100 terminal-native AI coding agents. These powerful tools operate directly within your command line, enabling autonomous code reading, editing, and execution. The list also covers various harnesses and orchestration solutions for managing these agents.

QwenPaw: Your Personal AI Assistant for Local and Cloud Deployment
August 7, 2026
QwenPaw is a powerful personal AI assistant designed for easy installation and deployment, either on your local machine or in the cloud. It supports multiple chat applications and offers highly extensible capabilities, making it a versatile tool for various AI-driven tasks. With its robust memory system and security features, QwenPaw aims to be an intuitive and private partner in your digital life.

DeepTutor: Lifelong Personalized Tutoring with AI Agents
August 7, 2026
DeepTutor is an advanced AI-powered platform designed for lifelong personalized tutoring, integrating various learning modes into a single, extensible system. It leverages large language models and multi-agent systems to offer features like interactive chat, quiz generation, and skill development. This project provides a comprehensive environment for learners and educators seeking intelligent, adaptive educational tools.

Memori: Agent-Native Memory Infrastructure for LLM Production Systems
August 6, 2026
Memori provides agent-native memory infrastructure, offering an LLM-agnostic layer that transforms agent execution and conversations into structured, persistent state. Designed for enterprise use, it seamlessly integrates with existing data infrastructure and supports various deployment environments, ensuring robust memory management for AI agents.
Source repository
Open the original repository on GitHub.
13 counted GitHub visits