Repomix
by @yamadashy
Pack and analyze codebases into AI-friendly single files using Repomix. Use when the user wants to explore repositories, analyze code structure, find pattern...
clawhub install repomixπ About This Skill
name: repomix version: 1.0.0 description: | Pack and analyze codebases into AI-friendly single files using Repomix. Use when the user wants to explore repositories, analyze code structure, find patterns, check token counts, or prepare codebase context for AI analysis. Supports both local directories and remote GitHub repositories. tags: - code-analysis - repository - codebase - ai-context - code-explorer - token-count - tree-sitter author: yamadashy metadata: openclaw: emoji: "π¦" homepage: "https://github.com/yamadashy/repomix" requires: bins: - npx install: - kind: node package: repomix bins: - repomix label: "Install Repomix CLI (npm)"
Repomix β 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
Quick Reference
Pack a Remote Repository
npx repomix@latest --remote --output /tmp/-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/-analysis.xml
Key Options
| Option | Description |
|--------|-------------|
| --style | Output format: xml (default, recommended), markdown, plain, json |
| --compress | Tree-sitter compression (~70% token reduction) β use for large repos |
| --include | Include only matching patterns (e.g., "src//*.ts,/*.md") |
| --ignore | Additional ignore patterns |
| --output | Custom output path (default: repomix-output.xml) |
| --remote-branch | 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.xmlLarge remote repo with compression
npx repomix@latest --remote facebook/react --compress --output /tmp/react-analysis.xmlLocal directory
npx repomix@latest ./src --output /tmp/src-analysis.xmlSpecific file types only
npx repomix@latest --include "**/*.{ts,tsx,js,jsx}" --output /tmp/filtered-analysis.xml
Step 2: Check Command Output
The command displays:
Note the output file location for subsequent analysis.
Step 3: Analyze the Output
Structure overview: 1. Search for the file tree section (near the beginning of the output) 2. 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" Search with context
grep -iE -A 5 -B 5 "authentication|auth" Find API endpoints
grep -iE "router|route|endpoint|api" Find database models
grep -iE "model|schema|database|query"
Read specific sections using offset/limit for large outputs.
Step 4: Report Findings
Best Practices
1. Use --compress for large repos (>100k lines) to reduce token usage by ~70%
2. Use pattern search first before reading entire output files
3. Use a temporary directory for output (/tmp on Unix, %TEMP% on Windows) to keep the user's workspace clean
4. Use --include to focus on specific parts of a codebase
5. 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
--compress, narrow scope with --includeSecurity
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.
β‘ When to Use
π Tips & Best Practices
1. Use --compress for large repos (>100k lines) to reduce token usage by ~70%
2. Use pattern search first before reading entire output files
3. Use a temporary directory for output (/tmp on Unix, %TEMP% on Windows) to keep the user's workspace clean
4. Use --include to focus on specific parts of a codebase
5. XML is the default and recommended format β it has clear file boundaries for structured analysis