Repomix is a powerful tool that packs your entire codebase into a single, AI-friendly file. This makes it easy to feed your repository to Large Language Models (LLMs) like Claude, ChatGPT, DeepSeek, and others for analysis, refactoring, or documentation generation.
You can run Repomix instantly without installation:
npx repomix@latest
Or install globally for repeated use:
# Install using npm
npm install -g repomix
# Alternatively using yarn
yarn global add repomix
# Alternatively using bun
bun add -g repomix
# Alternatively using Homebrew (macOS/Linux)
brew install repomix
# Basic usage (current directory)
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
# Process specific directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix path/to/directory
# Process remote repository
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/repomix --remote https://github.com/yamadashy/repomix
# Pack entire repository
repomix
# Pack specific directory
repomix path/to/directory
# Include specific files using glob patterns
repomix --include "src/**/*.ts,**/*.md"
# Exclude specific files or directories
repomix --ignore "**/*.log,tmp/"
# Pack from GitHub URL
repomix --remote https://github.com/yamadashy/repomix
# Using GitHub shorthand
repomix --remote yamadashy/repomix
# Specify branch or commit
repomix --remote yamadashy/repomix --remote-branch main
repomix --remote https://github.com/yamadashy/repomix/tree/main
# Using find command
find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin
# Using grep to find files with specific content
grep -l "TODO" **/*.ts | repomix --stdin
# Include git logs in output
repomix --include-logs
# Compress output to reduce token count
repomix --compress
# Initialize configuration file
repomix --init
Repomix supports multiple output formats to suit different needs:
repomix
repomix --style markdown
repomix --style json
repomix --style plain
Create a configuration file with default settings:
repomix --init
This creates a repomix.config.json file in your project root. You can also use TypeScript or JavaScript configuration:
// repomix.config.ts
import { defineConfig } from 'repomix';
export default defineConfig({
output: {
filePath: 'output.xml',
style: 'xml',
removeComments: true,
},
ignore: {
customPatterns: ['**/node_modules/**', '**/dist/**'],
},
});
Repomix can run as a Model Context Protocol (MCP) server to integrate with AI assistants:
repomix --mcp
Configure MCP in VS Code:
code --add-mcp '{"name":"repomix","command":"npx","args":["-y","repomix","--mcp"]}'
Or install using the badge:
Generate Claude Agent Skills for reusable codebase reference:
# Generate Skills from local directory
repomix --skill-generate
# Generate with custom Skills name
repomix --skill-generate my-project-reference
# Generate from remote repository
repomix --remote https://github.com/user/repo --skill-generate
Visualize token usage with:
repomix --token-count-tree
Or set a minimum threshold:
repomix --token-count-tree 1000 # Only show files/directories with 1000+ tokens
Once you've generated the packed file, you can use it with AI tools. Example prompts:
This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.
Based on the codebase in this file, please generate a detailed README.md that includes an overview of the project, its main features, setup instructions, and usage examples.
Analyze the code in this file and suggest a comprehensive set of unit tests for the main functions and classes. Include edge cases and potential error scenarios.
-v, --version: Show version information--verbose: Enable detailed logging--quiet: Suppress all output except errors--stdout: Write directly to stdout--stdin: Read file paths from stdin--copy: Copy output to clipboard--token-count-tree [threshold]: Show file tree with token counts--top-files-len <number>: Number of largest files to show-o, --output <file>: Output file path--style <style>: Output format (xml, markdown, json, plain)--parsable-style: Escape special characters--compress: Extract essential code structure--no-file-summary: Omit file summary section--remove-comments: Strip code comments--remove-empty-lines: Remove blank lines--header-text <text>: Add custom text at beginning--include-logs: Add git commit history--include-diffs: Add git diff section--include <patterns>: Include only matching files-i, --ignore <patterns>: Additional patterns to exclude--no-gitignore: Don't use .gitignore rules--no-default-patterns: Don't apply built-in ignore patterns--remote <url>: Clone and pack remote repository--remote-branch <name>: Specific branch or commitTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "repomix" '{"command":"npx","args":["-y","repomix","--mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"repomix": {
"command": "npx",
"args": [
"-y",
"repomix",
"--mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"repomix": {
"command": "npx",
"args": [
"-y",
"repomix",
"--mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect