| name | repomix |
| description | Packages repositories into AI-friendly bundles with Repomix and can reconstruct files from existing Repomix outputs. Use when packaging codebases for LLM analysis, creating repository snapshots, reversing bundles, or preparing security audits. Triggers include "repomix", "package codebase", "repomix-unmix", "extract-bundle", "AI-friendly", or "LLM context". |
| allowed-tools | Bash, Read, Write, Edit, Glob |
| user-invocable | true |
Repomix Skill
Repomix packs entire repositories into single, AI-friendly files. Perfect for feeding codebases to LLMs like Claude, ChatGPT, and Gemini.
When to Use
Use when:
- Packaging codebases for AI analysis
- Creating repository snapshots for LLM context
- Reconstructing files from Repomix XML, Markdown, or JSON bundles
- Analyzing third-party libraries
- Preparing for security audits
- Generating documentation context
- Investigating bugs across large codebases
- Creating AI-friendly code representations
Quick Start
Check Installation
repomix --version
Install
bun install -g repomix
brew install repomix
Basic Usage
repomix
repomix --style markdown
repomix --style json
bunx repomix --remote owner/repo
repomix --include "src/**/*.ts" --remove-comments -o output.md
Core Capabilities
Repository Packaging
- AI-optimized formatting with clear separators
- Multiple output formats: XML, Markdown, JSON, Plain text
- Git-aware processing (respects .gitignore)
- Token counting for LLM context management
- Security checks for sensitive information
Remote Repository Support
Process remote repositories without cloning:
bunx repomix --remote yamadashy/repomix
bunx repomix --remote https://github.com/owner/repo
bunx repomix --remote https://github.com/owner/repo/commit/hash
Comment Removal
Strip comments from supported languages (HTML, CSS, JavaScript, TypeScript, Vue, Svelte, Python, PHP, Ruby, C, C#, Java, Go, Rust, Swift, Kotlin, Dart, Shell, YAML):
repomix --remove-comments
Bundle Reconstruction
Reverse a Repomix bundle back into files when the user gives you packed XML, Markdown, or JSON output.
Workflow:
- Identify the format: detect whether the bundle is XML, Markdown, or JSON.
- Scan file paths: locate the paths encoded in the bundle.
- Extract and write: recreate each file with
Write or Edit.
- Validate structure: confirm the extracted files match the snippets in the bundle.
Features:
- Handles XML, Markdown, and JSON Repomix outputs
- Restores full directory hierarchy
- Verifies extracted content against the bundle
Common Use Cases
Code Review Preparation
repomix --include "src/**/*.ts" --remove-comments -o review.md --style markdown
Security Audit
bunx repomix --remote vendor/library --style xml -o audit.xml
Documentation Generation
repomix --include "src/**,docs/**,*.md" --style markdown -o context.md
Bug Investigation
repomix --include "src/auth/**,src/api/**" -o debug-context.xml
Restore a Packed Repository
When the user provides a Repomix bundle instead of a live repository:
- Detect the bundle format.
- Extract file paths and file contents.
- Recreate the original directory tree.
- Spot-check key files to verify the output.
Implementation Planning
repomix --remove-comments --copy
Command Line Reference
File Selection
repomix --include "src/**/*.ts,*.md"
repomix -i "tests/**,*.test.js"
repomix --no-gitignore
Output Options
repomix --style markdown
repomix -o output.md
repomix --remove-comments
repomix --copy
Configuration
repomix -c custom-config.json
repomix --init
Token Management
Repomix automatically counts tokens for individual files, total repository, and per-format output.
Typical LLM context limits:
- Claude Sonnet 4.5: ~200K tokens
- GPT-4: ~128K tokens
- GPT-3.5: ~16K tokens
Security Considerations
Repomix uses Secretlint to detect sensitive data (API keys, passwords, credentials, private keys, AWS secrets).
Best practices:
- Always review output before sharing
- Use
.repomixignore for sensitive files
- Enable security checks for unknown codebases
- Avoid packaging
.env files
- Check for hardcoded credentials
Disable security checks if needed:
repomix --no-security-check
Implementation Workflow
When user requests repository packaging:
-
Assess Requirements
- Identify target repository (local/remote)
- Determine output format needed
- Check for sensitive data concerns
-
Configure Filters
- Set include patterns for relevant files
- Add ignore patterns for unnecessary files
- Enable/disable comment removal
-
Execute Packaging
- Run repomix with appropriate options
- Monitor token counts
- Verify security checks
-
Validate Output
- Review generated file
- Confirm no sensitive data
- Check token limits for target LLM
-
Deliver Context
- Provide packaged file to user
- Include token count summary
- Note any warnings or issues
Reference Documentation
For detailed information, see:
- Configuration Reference - Config files, include/exclude patterns, output formats, advanced options
- Usage Patterns - AI analysis workflows, security audit preparation, documentation generation, library evaluation
Exploration and Analysis
After packing, analyze the output incrementally - never read the entire output file at once.
rg -i "export.*function|class " repomix-output.xml
Read("repomix-output.xml", offset=0, limit=500)
rg -i "auth|login|jwt|token" repomix-output.xml
rg -i "router|route|endpoint" repomix-output.xml
rg -i "config|Config" repomix-output.xml
Report findings: file count, token metrics, structure overview, pattern matches with file references.
Additional Resources