repomix
Pack entire codebases into AI-friendly files for LLM analysis. Use when consolidating code for AI review, generating codebase summaries, or preparing context for ChatGPT, Claude, or other AI tools.
What this skill does
# Repomix - Codebase Packing for AI
Pack your entire repository into a single, AI-friendly file optimized for LLMs like Claude, ChatGPT, Gemini, and more.
## When to Use This Skill
- Feeding codebase to AI for analysis or refactoring
- Generating comprehensive code reviews
- Creating documentation from code
- Preparing context for AI-assisted development
- Analyzing remote repositories without cloning
- Token counting for LLM context limits
## Quick Start
```bash
# Pack current directory (no install required)
npx repomix@latest
# Pack specific directory
npx repomix path/to/directory
# Pack with compression (~70% token reduction)
npx repomix --compress
# Copy output to clipboard
npx repomix --copy
```
**Default output:** `./repomix-output.xml` in current directory
## Examples
**Example: Prepare codebase for Claude review**
```
User: "Pack my src folder for Claude to review the architecture"
→ npx repomix --include "src/**/*" --style xml --copy
→ Output copied to clipboard, ready to paste into Claude
```
**Example: Analyze remote repo without cloning**
```
User: "I want to understand how shadcn/ui implements its button"
→ npx repomix --remote shadcn-ui/ui --include "**/button/**/*" --compress
→ Generates focused output of button component
```
**Example: Prepare PR diff for review**
```
User: "Pack only the files I changed for a code review"
→ git diff --name-only main | npx repomix --stdin --compress
→ Packs only modified files with compression
```
**Example: Check token usage before sending to AI**
```
User: "Is my codebase too large for GPT-4?"
→ npx repomix --token-count-tree
→ Shows token breakdown per file/directory
```
**Example: Generate skills reference from library**
```
User: "Create a Claude skill from the zod repository"
→ npx repomix --remote colinhacks/zod --skill-generate zod-reference
→ Generates AI-optimized reference documentation
```
## Output Formats
```bash
# XML (default) - best for Claude
npx repomix --style xml
# Markdown - human readable
npx repomix --style markdown
# JSON - programmatic processing
npx repomix --style json
# Plain text
npx repomix --style plain
```
## Token Optimization
### LLM Context Limits Reference
| Model | Context Window | Typical Repo Fit |
|-------|---------------|------------------|
| Claude 3.5/Opus | 200K tokens | Large monorepos |
| GPT-4 Turbo/4o | 128K tokens | Medium projects |
| Gemini 1.5 Pro | 1M tokens | Very large codebases |
| Gemini 1.5 Flash | 1M tokens | Very large codebases |
### Token Analysis
```bash
# Show token count tree
npx repomix --token-count-tree
# Filter by minimum tokens (show files with 1000+ tokens)
npx repomix --token-count-tree 1000
# Split output for large codebases
npx repomix --split-output 1mb
```
## File Selection
### Include Patterns
```bash
# Include only TypeScript files
npx repomix --include "**/*.ts"
# Include multiple patterns
npx repomix --include "src/**/*.ts,**/*.md"
# Include specific directories
npx repomix --include "src/**/*,tests/**/*"
```
### Ignore Patterns
```bash
# Ignore test files
npx repomix --ignore "**/*.test.ts"
# Ignore multiple patterns
npx repomix --ignore "**/*.log,tmp/,dist/"
# Combine include and ignore
npx repomix --include "src/**/*.ts" --ignore "**/*.test.ts"
```
### Stdin Input
```bash
# From find command
find src -name "*.ts" -type f | npx repomix --stdin
# From git tracked files
git ls-files "*.ts" | npx repomix --stdin
# Interactive selection with fzf
find . -name "*.ts" -type f | fzf -m | npx repomix --stdin
# From ripgrep
rg --files --type ts | npx repomix --stdin
```
## Common Workflows
### PR Review Preparation
```bash
# Pack only changed files for review
git diff --name-only main | npx repomix --stdin --compress
# Pack with diff context included
npx repomix --include-diffs --compress
```
### Architecture Analysis
```bash
# Pack structure without implementation details
npx repomix --compress --include "src/**/*" --ignore "**/*.test.*"
# Focus on specific layer
npx repomix --include "src/api/**/*,src/services/**/*" --compress
```
### Documentation Generation
```bash
# Pack with full context for docs
npx repomix --include "src/**/*,**/*.md" --style markdown
# Include git history for changelog
npx repomix --include-logs --include-logs-count 50
```
### Dependency Analysis
```bash
# Pack only config and dependency files
npx repomix --include "package.json,tsconfig.json,**/*.config.*"
```
## Remote Repositories
```bash
# Pack remote repository
npx repomix --remote https://github.com/user/repo
# GitHub shorthand
npx repomix --remote user/repo
# Specific branch
npx repomix --remote user/repo --remote-branch main
# Specific commit
npx repomix --remote user/repo --remote-branch 935b695
# Branch URL format
npx repomix --remote https://github.com/user/repo/tree/feature-branch
```
## Code Compression
Tree-sitter powered compression extracts signatures while removing implementation details.
### Supported Languages
Tree-sitter compression works with: JavaScript, TypeScript, Python, Ruby, Go, Rust, Java, C, C++, C#, PHP, Swift, Kotlin, and more.
### Usage
```bash
npx repomix --compress
# Combine with remote
npx repomix --remote user/repo --compress
```
**Before compression:**
```typescript
const calculateTotal = (items: Item[]) => {
let total = 0;
for (const item of items) {
total += item.price * item.quantity;
}
return total;
};
```
**After compression:**
```typescript
const calculateTotal = (items: Item[]) => { /* ... */ };
```
## Git Integration
```bash
# Include git logs (last 50 commits)
npx repomix --include-logs
# Specify commit count
npx repomix --include-logs --include-logs-count 20
# Include git diffs
npx repomix --include-diffs
# Combine logs and diffs
npx repomix --include-logs --include-diffs
```
## Configuration
### Initialize Config
```bash
# Create repomix.config.json
npx repomix --init
# Global config
npx repomix --init --global
```
### Configuration File
```json
{
"$schema": "https://repomix.com/schemas/latest/schema.json",
"output": {
"filePath": "repomix-output.xml",
"style": "xml",
"compress": false,
"removeComments": false,
"showLineNumbers": false,
"copyToClipboard": false
},
"include": ["src/**/*", "**/*.md"],
"ignore": {
"useGitignore": true,
"useDefaultPatterns": true,
"customPatterns": ["**/*.test.ts", "dist/"]
},
"security": {
"enableSecurityCheck": true
}
}
```
## Docker Usage
```bash
# Pack current directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
# Pack specific directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix path/to/directory
# Remote repository
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/repomix --remote user/repo
```
## MCP Server Integration
Run as Model Context Protocol server for AI assistants:
```bash
npx repomix --mcp
```
### Configure for Claude Code
```bash
claude mcp add repomix -- npx -y repomix --mcp
```
### Available MCP Tools
When running as MCP server, provides:
| Tool | Description |
|------|-------------|
| `pack_codebase` | Pack local directory into AI-friendly format |
| `pack_remote_repository` | Pack GitHub repository without cloning |
| `read_repomix_output` | Read contents of generated output file |
| `file_system_tree` | Get directory tree structure |
## Claude Agent Skills Generation
Generate skills format output for Claude:
```bash
# Generate skills from local directory
npx repomix --skill-generate
# Generate with custom name
npx repomix --skill-generate my-project-reference
# From remote repository
npx repomix --remote user/repo --skill-generate
```
## CLI Options Reference
| Option | Description |
|--------|-------------|
| `-o, --output <file>` | Output file path |
| `--style <style>` | Output format: xml, markdown, json, plain |
| `--compress` | Enable Tree-sitter compression |
| `--include <patterns>` | Include files matching glob patterns |
| `-i, --ignore <patterns>` Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.