
Repomix
FreePack and analyze codebases for AI-friendly exploration.
Free · Opens the source repo
What Repomix does
Repomix is a powerful tool designed for developers and engineers who need to analyze and explore codebases efficiently. It allows users to pack entire repositories into a single file that is optimized for AI analysis, making it easier to understand the structure and patterns within the code. With support for both local directories and remote GitHub repositories, Repomix is versatile and can be used in a variety of scenarios, from security checks to token counting.
The tool intelligently handles repository files by respecting .gitignore rules and automatically excluding sensitive files such as API keys and credentials. This ensures that the analysis is both thorough and secure, allowing developers to focus on the code itself without worrying about exposing sensitive information. The generated output is structured and can be formatted in XML, Markdown, Plain, or JSON, depending on the user's needs.
Repomix is particularly useful when exploring large codebases or when specific analysis is required, such as identifying authentication-related code or understanding the overall structure of a project. The command-line interface is straightforward, with options to compress large repositories, include or ignore specific patterns, and specify output paths, making it a flexible choice for various workflows.
Whether you are a developer looking to gain insights into a new codebase or a security analyst needing to perform a thorough review, Repomix provides the tools necessary to streamline your analysis process and enhance your understanding of complex code structures.
When to use it
Use Repomix when you need to explore a repository, analyze its structure, or prepare code for AI-driven insights.
When not to use it
If your analysis requires real-time collaboration or interactive exploration, Repomix may not be the best fit as it focuses on packing and generating static outputs.
What you can build with it
Analyzing a Large Repository
Use Repomix to pack a large codebase, applying compression to manage token counts effectively.
Exploring Authentication Code
Run Repomix to find all authentication-related code in a repository, streamlining security audits.
Preparing Code for AI Insights
Pack a codebase into an AI-friendly format for subsequent analysis by AI tools, enhancing understanding.
How to install Repomix
View source1. Install with the skills CLI
npx skills add yamadashy/repomix/clawhub --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by yamadashyRepomix — Codebase Packer & Analyzer
Pack entire codebases into a single, AI-friendly file for analysis. Repomix intelligently collects repository files, respects .gitignore, runs security checks, and generates structured output optimized for LLM consumption.
When to Use
- "Analyze this repo" / "Explore this codebase"
- "What's the structure of facebook/react?"
- "Find all authentication-related code"
- "How many tokens is this project?"
- "Pack this repo for AI analysis"
- "Show me the main components of vercel/next.js"
Quick Reference
Pack a Remote Repository
npx repomix@latest --remote <owner/repo> --output /tmp/<repo-name>-analysis.xml
Always output to a temporary directory (/tmp on Unix, %TEMP% on Windows) for remote repositories to avoid polluting the user's working directory.
Pack a Local Directory
npx repomix@latest [directory] --output /tmp/<name>-analysis.xml
Key Options
| Option | Description |
|---|---|
--style <format> | Output format: xml (default, recommended), markdown, plain, json |
--compress | Tree-sitter compression (~70% token reduction) — use for large repos |
--include <patterns> | Include only matching patterns (e.g., "src/**/*.ts,**/*.md") |
--ignore <patterns> | Additional ignore patterns |
--output <path> | Custom output path (default: repomix-output.xml) |
--remote-branch <name> | Specific branch, tag, or commit (for remote repos) |
Workflow
Step 1: Pack the Repository
Choose the appropriate command based on the target:
# Remote repository (always output to /tmp)
npx repomix@latest --remote yamadashy/repomix --output /tmp/repomix-analysis.xml
# Large remote repo with compression
npx repomix@latest --remote facebook/react --compress --output /tmp/react-analysis.xml
# Local directory
npx repomix@latest ./src --output /tmp/src-analysis.xml
# Specific file types only
npx repomix@latest --include "**/*.{ts,tsx,js,jsx}" --output /tmp/filtered-analysis.xml
Step 2: Check Command Output
The command displays:
- Files processed: Number of files included
- Total characters: Size of content
- Total tokens: Estimated AI tokens
- Output file location: Where the file was saved
Note the output file location for subsequent analysis.
Step 3: Analyze the Output
Structure overview:
- Search for the file tree section (near the beginning of the output)
- Check the metrics summary for overall statistics
Search for patterns (use the output file path from Step 2):
# Find exports and main entry points
grep -iE "export.*function|export.*class" <output-file>
# Search with context
grep -iE -A 5 -B 5 "authentication|auth" <output-file>
# Find API endpoints
grep -iE "router|route|endpoint|api" <output-file>
# Find database models
grep -iE "model|schema|database|query" <output-file>
Read specific sections using offset/limit for large outputs.
Step 4: Report Findings
- Metrics: Files, tokens, size from command output
- Structure: Directory layout from file tree analysis
- Key findings: Based on pattern search results
- Next steps: Suggestions for deeper exploration
Best Practices
- Use
--compressfor large repos (>100k lines) to reduce token usage by ~70% - Use pattern search first before reading entire output files
- Use a temporary directory for output (
/tmpon Unix,%TEMP%on Windows) to keep the user's workspace clean - Use
--includeto focus on specific parts of a codebase - XML is the default and recommended format — it has clear file boundaries for structured analysis
Output Formats
| Format | Best For |
|---|---|
| XML (default) | Structured analysis, clear file boundaries |
| Markdown | Human-readable documentation |
| Plain | Simple grep-friendly output |
| JSON | Programmatic/machine analysis |
Error Handling
- Command fails: Check error message, verify repository URL/path, check permissions
- Output too large: Use
--compress, narrow scope with--include - Network issues (remote): Verify connection, suggest local clone as alternative
- Pattern not found: Try alternative patterns, check file tree to verify files exist
Security
Repomix automatically excludes potentially sensitive files (API keys, credentials, .env files) through built-in security checks. Trust its security defaults unless the user explicitly requests otherwise.
Frequently asked questions about Repomix
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
