--- url: 'https://repomix.com/guide/agent-skills-generation.md' --- # Agent Skills Generation Repomix can generate [Claude Agent Skills](https://docs.anthropic.com/en/docs/claude-code/skills) format output, creating a structured Skills directory that can be used as a reusable codebase reference for AI assistants. This feature is particularly powerful when you want to reference implementations from remote repositories. By generating Skills from open source projects, you can easily ask Claude to reference specific patterns or implementations while working on your own code. Instead of generating a single packed file, Skills generation creates a structured directory with multiple reference files optimized for AI comprehension and grep-friendly searching. > \[!NOTE] > This is an experimental feature. The output format and options may change in future releases based on user feedback. ## Basic Usage Generate Skills from your local directory: ```bash # Generate Skills from current directory repomix --skill-generate # Generate with custom Skills name repomix --skill-generate my-project-reference # Generate from specific directory repomix path/to/directory --skill-generate # Generate from remote repository repomix --remote https://github.com/user/repo --skill-generate ``` ## Skills Location Selection When you run the command, Repomix prompts you to choose where to save the Skills: 1. **Personal Skills** (`~/.claude/skills/`) - Available across all projects on your machine 2. **Project Skills** (`.claude/skills/`) - Shared with your team via git If the Skills directory already exists, you'll be prompted to confirm overwriting it. > \[!TIP] > When generating Project Skills, consider adding them to `.gitignore` to avoid committing large files: > > ```gitignore > .claude/skills/repomix-reference-*/ > ``` ## Non-Interactive Usage For CI pipelines and automation scripts, you can skip all interactive prompts using `--skill-output` and `--force`: ```bash # Specify output directory directly (skips location prompt) repomix --skill-generate --skill-output ./my-skills # Skip overwrite confirmation with --force repomix --skill-generate --skill-output ./my-skills --force # Full non-interactive example repomix --remote user/repo --skill-generate my-skill --skill-output ./output --force ``` | Option | Description | | --- | --- | | `--skill-output ` | Specify skill output directory path directly (skips location prompt) | | `-f, --force` | Skip all confirmation prompts (e.g., skill directory overwrite) | ## Generated Structure The Skills are generated with the following structure: ```text .claude/skills// ├── SKILL.md # Main Skills metadata & documentation └── references/ ├── summary.md # Purpose, format, and statistics ├── project-structure.md # Directory tree with line counts ├── files.md # All file contents (grep-friendly) └── tech-stacks.md # Languages, frameworks, dependencies ``` ### File Descriptions | File | Purpose | Contents | |------|---------|----------| | `SKILL.md` | Main Skills metadata & documentation | Skills name, description, project info, file/line/token counts, usage overview, common use cases and tips | | `references/summary.md` | Purpose, format, and statistics | Reference codebase explanation, file structure docs, usage guidelines, breakdown by file type and language | | `references/project-structure.md` | File discovery | Directory tree with line counts per file | | `references/files.md` | Searchable code reference | All file contents with syntax highlighting headers, optimized for grep-friendly searching | | `references/tech-stacks.md` | Tech stack summary | Languages, frameworks, runtime versions, package managers, dependencies, config files | #### Example: references/project-structure.md ```text src/ index.ts (42 lines) utils/ helpers.ts (128 lines) math.ts (87 lines) ``` #### Example: references/files.md ````markdown ## File: src/index.ts ```typescript import { sum } from './utils/helpers'; export function main() { console.log(sum(1, 2)); } ``` ```` #### Example: references/tech-stacks.md Auto-detected tech stack from dependency files: * **Languages**: TypeScript, JavaScript, Python, etc. * **Frameworks**: React, Next.js, Express, Django, etc. * **Runtime Versions**: Node.js, Python, Go, etc. * **Package Manager**: npm, pnpm, poetry, etc. * **Dependencies**: All direct and dev dependencies * **Config Files**: All detected configuration files Detected from files like: `package.json`, `requirements.txt`, `Cargo.toml`, `go.mod`, `.nvmrc`, `pyproject.toml`, etc. ## Auto-Generated Skills Names If no name is provided, Repomix auto-generates one using this pattern: ```bash repomix src/ --skill-generate # → repomix-reference-src repomix --remote user/repo --skill-generate # → repomix-reference-repo repomix --skill-generate CustomName # → custom-name (normalized to kebab-case) ``` Skills names are: * Converted to kebab-case (lowercase, hyphen-separated) * Limited to 64 characters maximum * Protected against path traversal ## Integration with Repomix Options Skills generation respects all standard Repomix options: ```bash # Generate Skills with file filtering repomix --skill-generate --include "src/**/*.ts" --ignore "**/*.test.ts" # Generate Skills with compression repomix --skill-generate --compress # Generate Skills from remote repository repomix --remote yamadashy/repomix --skill-generate # Generate Skills with specific output format options repomix --skill-generate --remove-comments --remove-empty-lines ``` ### Documentation-Only Skills Using `--include`, you can generate Skills containing only the documentation from a GitHub repository. This is useful when you want Claude to reference specific library or framework documentation while working on your code: ```bash # Claude Code Action documentation repomix --remote https://github.com/anthropics/claude-code-action --include docs --skill-generate # Vite documentation repomix --remote https://github.com/vitejs/vite --include docs --skill-generate # React documentation repomix --remote https://github.com/reactjs/react.dev --include src/content --skill-generate ``` ## Limitations The `--skill-generate` option cannot be used with: * `--stdout` - Skills output requires writing to filesystem * `--copy` - Skills output is a directory, not copyable to clipboard ## Using Generated Skills Once generated, you can use the Skills with Claude: 1. **Claude Code**: The Skills are automatically available if saved to `~/.claude/skills/` or `.claude/skills/` 2. **Claude Web**: Upload the Skills directory to Claude for codebase analysis 3. **Team Sharing**: Commit `.claude/skills/` to your repository for team-wide access ## Example Workflow ### Creating a Personal Reference Library ```bash # Clone and analyze an interesting open source project repomix --remote facebook/react --skill-generate react-reference # The Skills are saved to ~/.claude/skills/react-reference/ # Now you can reference React's codebase in any Claude conversation ``` ### Team Project Documentation ```bash # In your project directory cd my-project # Generate Skills for your team repomix --skill-generate # Choose "Project Skills" when prompted # The Skills are saved to .claude/skills/repomix-reference-my-project/ # Commit and share with your team git add .claude/skills/ git commit -m "Add codebase reference Skills" ``` ## Related Resources * [Claude Code Plugins](/guide/claude-code-plugins) - Learn about Repomix plugins for Claude Code * [MCP Server](/guide/mcp-server) - Alternative integration method * [Code Compression](/guide/code-compress) - Reduce token count with compression * [Configuration](/guide/configuration) - Customize Repomix behavior --- --- url: 'https://repomix.com/guide/tips/best-practices.md' --- # AI-Assisted Development Best Practices: From My Experience While I haven't successfully completed a large-scale project using AI yet, I'd like to share what I've learned so far from my experience working with AI in development. ## Basic Development Approach When working with AI, attempting to implement all features at once can lead to unexpected issues and project stagnation. That's why it's more effective to start with core functionality and build each feature one at a time, ensuring solid implementation before moving forward. ### The Power of Existing Code This approach is effective because implementing core functionality allows you to materialize your ideal design and coding style through actual code. The most effective way to communicate your project vision is through code that reflects your standards and preferences. By starting with core features and ensuring each component works properly before moving on, the entire project maintains consistency, making it easier for AI to generate more appropriate code. ## The Modular Approach Breaking code into smaller modules is crucial. In my experience, keeping files around 250 lines of code makes it easier to give clear instructions to AI and makes the trial-and-error process more efficient. While token count would be a more accurate metric, line count is more practical for human developers to work with, so we use that as a guideline. This modularization isn't just about separating frontend, backend, and database components - it's about breaking down functionality at a much finer level. For example, within a single feature, you might separate validation, error handling, and other specific functionalities into distinct modules. Of course, high-level separation is also important, and implementing this modular approach gradually helps maintain clear instructions and enables AI to generate more appropriate code. This approach is effective not just for AI but for human developers as well. ## Ensuring Quality Through Testing I consider testing to be crucial in AI-assisted development. Tests serve not only as quality assurance measures but also as documentation that clearly demonstrates code intentions. When asking AI to implement new features, existing test code effectively acts as a specification document. Tests are also an excellent tool for validating the correctness of AI-generated code. For instance, when having AI implement new functionality for a module, writing test cases beforehand allows you to objectively evaluate whether the generated code behaves as expected. This aligns well with Test-Driven Development (TDD) principles and is particularly effective when collaborating with AI. ## Balancing Planning and Implementation Before implementing large-scale features, I recommend first discussing the plan with AI. Organizing requirements and considering architecture leads to smoother implementation. A good practice is to compile requirements first, then move to a separate chat session for implementation work. It's essential to have human review of AI output and make adjustments as needed. While the quality of AI-generated code is generally moderate, it still accelerates development compared to writing everything from scratch. ## Conclusion By following these practices, you can leverage AI's strengths while building a consistent, high-quality codebase. Even as your project grows in size, each component remains well-defined and manageable. --- --- url: 'https://repomix.com/guide/usage.md' --- # Basic Usage ## Quick Start Pack your entire repository: ```bash repomix ``` ## Common Use Cases ### Pack Specific Directories ```bash repomix path/to/directory ``` ### Include Specific Files Use [glob patterns](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax): ```bash repomix --include "src/**/*.ts,**/*.md" ``` ### Exclude Files ```bash repomix --ignore "**/*.log,tmp/" ``` ### Split Output Into Multiple Files When working with large codebases, the packed output may exceed file size limits imposed by some AI tools (e.g., Google AI Studio's 1MB limit). Use `--split-output` to automatically split the output into multiple files: ```bash repomix --split-output 1mb ``` This generates numbered files like: * `repomix-output.1.xml` * `repomix-output.2.xml` * `repomix-output.3.xml` Size can be specified with units: `500kb`, `1mb`, `2mb`, `1.5mb`, etc. Decimal values are supported. > \[!NOTE] > Files are grouped by top-level directory to maintain context. A single file or directory will never be split across multiple output files. ### Remote Repositories ```bash # Using GitHub URL repomix --remote https://github.com/user/repo # Using shorthand repomix --remote user/repo # Specific branch/tag/commit repomix --remote user/repo --remote-branch main repomix --remote user/repo --remote-branch 935b695 ``` ### File List Input (stdin) Pass file paths via stdin for ultimate flexibility: ```bash # Using find command find src -name "*.ts" -type f | repomix --stdin # Using git to get tracked files git ls-files "*.ts" | repomix --stdin # Using ripgrep (rg) to find files rg --files --type ts | repomix --stdin # Using grep to find files containing specific content grep -l "TODO" **/*.ts | repomix --stdin # Using ripgrep to find files with specific content rg -l "TODO|FIXME" --type ts | repomix --stdin # Using sharkdp/fd to find files fd -e ts | repomix --stdin # Using fzf to select from all files fzf -m | repomix --stdin # Interactive file selection with fzf find . -name "*.ts" -type f | fzf -m | repomix --stdin # Using ls with glob patterns ls src/**/*.ts | repomix --stdin # From a file containing file paths cat file-list.txt | repomix --stdin # Direct input with echo echo -e "src/index.ts\nsrc/utils.ts" | repomix --stdin ``` The `--stdin` option allows you to pipe a list of file paths to Repomix, giving you ultimate flexibility in selecting which files to pack. When using `--stdin`, the specified files are effectively added to the include patterns. This means that the normal include and ignore behavior still applies - files specified via stdin will still be excluded if they match ignore patterns. > \[!NOTE] > When using `--stdin`, file paths can be relative or absolute, and Repomix will automatically handle path resolution and deduplication. ### Code Compression {#code-compression} Reduce token count while preserving code structure. See the [Code Compression guide](/guide/code-compress) for details. ```bash repomix --compress # You can also use it with remote repositories: repomix --remote yamadashy/repomix --compress ``` ### Git Integration Include Git information to provide development context for AI analysis: ```bash # Include git diffs (uncommitted changes) repomix --include-diffs # Include git commit logs (last 50 commits by default) repomix --include-logs # Include specific number of commits repomix --include-logs --include-logs-count 10 # Include both diffs and logs repomix --include-diffs --include-logs ``` This adds valuable context about: * **Recent changes**: Git diffs show uncommitted modifications * **Development patterns**: Git logs reveal which files are typically changed together * **Commit history**: Recent commit messages provide insight into development focus * **File relationships**: Understanding which files are modified in the same commits ### Token Count Optimization Understanding your codebase's token distribution is crucial for optimizing AI interactions. Use the `--token-count-tree` option to visualize token usage across your project: ```bash repomix --token-count-tree ``` This displays a hierarchical view of your codebase with token counts: ``` 🔢 Token Count Tree: ──────────────────── └── src/ (70,925 tokens) ├── cli/ (12,714 tokens) │ ├── actions/ (7,546 tokens) │ └── reporters/ (990 tokens) └── core/ (41,600 tokens) ├── file/ (10,098 tokens) └── output/ (5,808 tokens) ``` You can also set a minimum token threshold to focus on larger files: ```bash repomix --token-count-tree 1000 # Only show files/directories with 1000+ tokens ``` This helps you: * **Identify token-heavy files** that might exceed AI context limits * **Optimize file selection** using `--include` and `--ignore` patterns * **Plan compression strategies** by targeting the largest contributors * **Balance content vs. context** when preparing code for AI analysis ## Output Formats ### XML (Default) ```bash repomix --style xml ``` ### Markdown ```bash repomix --style markdown ``` ### JSON ```bash repomix --style json ``` ### Plain Text ```bash repomix --style plain ``` ## Additional Options ### Remove Comments See [Comment Removal](/guide/comment-removal) for supported languages and details. ```bash repomix --remove-comments ``` ### Show Line Numbers ```bash repomix --output-show-line-numbers ``` ### Copy to Clipboard ```bash repomix --copy ``` ### Disable Security Check See [Security](/guide/security) for details on what Repomix detects. ```bash repomix --no-security-check ``` ## Configuration Initialize configuration file: ```bash repomix --init ``` See [Configuration Guide](/guide/configuration) for detailed options. ## Related Resources * [Output Formats](/guide/output) - Learn about XML, Markdown, JSON, and plain text formats * [Command Line Options](/guide/command-line-options) - Full CLI reference * [Prompt Examples](/guide/prompt-examples) - Example prompts for AI analysis * [Use Cases](/guide/use-cases) - Real-world examples and workflows --- --- url: 'https://repomix.com/guide/claude-code-plugins.md' --- # Claude Code Plugins Repomix provides official plugins for [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) that integrate seamlessly with the AI-powered development environment. These plugins make it easy to analyze and pack codebases directly within Claude Code using natural language commands. ## Installation ### 1. Add the Repomix Plugin Marketplace First, add the Repomix plugin marketplace to Claude Code: ```text /plugin marketplace add yamadashy/repomix ``` ### 2. Install Plugins Install the plugins using the following commands: ```text # Install MCP server plugin (recommended foundation) /plugin install repomix-mcp@repomix # Install commands plugin (extends functionality) /plugin install repomix-commands@repomix # Install repository explorer plugin (AI-powered analysis) /plugin install repomix-explorer@repomix ``` ::: tip Plugin Relationship The `repomix-mcp` plugin is recommended as a foundation. The `repomix-commands` plugin provides convenient slash commands, while `repomix-explorer` adds AI-powered analysis capabilities. While you can install them independently, using all three provides the most comprehensive experience. ::: ### Alternative: Interactive Installation You can also use the interactive plugin installer: ```text /plugin ``` This opens an interactive interface where you can browse and install available plugins. ## Available Plugins ### 1. repomix-mcp (MCP Server Plugin) Foundation plugin that provides AI-powered codebase analysis through MCP server integration. **Features:** * Pack local and remote repositories * Search through packed outputs * Read files with built-in security scanning ([Secretlint](https://github.com/secretlint/secretlint)) * Automatic Tree-sitter compression (~70% token reduction) ### 2. repomix-commands (Slash Commands Plugin) Provides convenient slash commands for quick operations with natural language support. **Available Commands:** * `/repomix-commands:pack-local` - Pack local codebase with various options * `/repomix-commands:pack-remote` - Pack and analyze remote GitHub repositories ### 3. repomix-explorer (AI Analysis Agent Plugin) AI-powered repository analysis agent that intelligently explores codebases using Repomix CLI. **Features:** * Natural language codebase exploration and analysis * Intelligent pattern discovery and code structure understanding * Incremental analysis using grep and targeted file reading * Automatic context management for large repositories **Available Commands:** * `/repomix-explorer:explore-local` - Analyze local codebase with AI assistance * `/repomix-explorer:explore-remote` - Analyze remote GitHub repositories with AI assistance **How it works:** 1. Runs `npx repomix@latest` to pack the repository 2. Uses Grep and Read tools to efficiently search the output 3. Provides comprehensive analysis without consuming excessive context ## Usage Examples ### Packing a Local Codebase Use the `/repomix-commands:pack-local` command with natural language instructions: ```text /repomix-commands:pack-local Pack this project as markdown with compression ``` Other examples: * "Pack the src directory only" * "Pack TypeScript files with line numbers" * "Generate output in JSON format" ### Packing a Remote Repository Use the `/repomix-commands:pack-remote` command to analyze GitHub repositories: ```text /repomix-commands:pack-remote yamadashy/repomix Pack only TypeScript files from the yamadashy/repomix repository ``` Other examples: * "Pack the main branch with compression" * "Include only documentation files" * "Pack specific directories" ### Exploring a Local Codebase with AI Use the `/repomix-explorer:explore-local` command for AI-powered analysis: ```text /repomix-explorer:explore-local ./src Find all authentication-related code ``` Other examples: * "Analyze the structure of this project" * "Show me the main components" * "Find all API endpoints" ### Exploring a Remote Repository with AI Use the `/repomix-explorer:explore-remote` command to analyze GitHub repositories: ```text /repomix-explorer:explore-remote facebook/react Show me the main component architecture ``` Other examples: * "Find all React hooks in the repository" * "Explain the project structure" * "Where are error boundaries defined?" ## Related Resources * [MCP Server Documentation](/guide/mcp-server) - Learn about the underlying MCP server * [Configuration](/guide/configuration) - Customize Repomix behavior * [Security](/guide/security) - Understanding security features * [Command Line Options](/guide/command-line-options) - Available CLI options ## Plugin Source Code The plugin source code is available in the Repomix repository: * [Plugin Marketplace](https://github.com/yamadashy/repomix/tree/main/.claude-plugin) * [MCP Plugin](https://github.com/yamadashy/repomix/tree/main/.claude/plugins/repomix-mcp) * [Commands Plugin](https://github.com/yamadashy/repomix/tree/main/.claude/plugins/repomix-commands) * [Repository Explorer Plugin](https://github.com/yamadashy/repomix/tree/main/.claude/plugins/repomix-explorer) ## Feedback and Support If you encounter issues or have suggestions for the Claude Code plugins: * [Open an issue on GitHub](https://github.com/yamadashy/repomix/issues) * [Join our Discord community](https://discord.gg/wNYzTwZFku) * [View existing discussions](https://github.com/yamadashy/repomix/discussions) --- --- url: 'https://repomix.com/guide/code-compress.md' --- # Code Compression Code compression is a powerful feature that intelligently extracts essential code structures while removing implementation details. This is particularly useful for reducing token count while maintaining important structural information about your codebase. > \[!NOTE]\ > This is an experimental feature that we'll be actively improving based on user feedback and real-world usage ## Basic Usage Enable code compression using the `--compress` flag: ```bash repomix --compress ``` You can also use it with remote repositories: ```bash repomix --remote user/repo --compress ``` ## How It Works The compression algorithm processes code using tree-sitter parsing to extract and preserve essential structural elements while removing implementation details. The compression preserves: * Function and method signatures * Interface and type definitions * Class structures and properties * Important structural elements While removing: * Function and method implementations * Loop and conditional logic details * Internal variable declarations * Implementation-specific code ### Example Original TypeScript code: ```typescript import { ShoppingItem } from './shopping-item'; /** * Calculate the total price of shopping items */ const calculateTotal = ( items: ShoppingItem[] ) => { let total = 0; for (const item of items) { total += item.price * item.quantity; } return total; } // Shopping item interface interface Item { name: string; price: number; quantity: number; } ``` After compression: ```typescript import { ShoppingItem } from './shopping-item'; ⋮---- /** * Calculate the total price of shopping items */ const calculateTotal = ( items: ShoppingItem[] ) => { ⋮---- // Shopping item interface interface Item { name: string; price: number; quantity: number; } ``` ## Configuration You can enable compression in your configuration file: ```json { "output": { "compress": true } } ``` ## Use Cases Code compression is particularly useful when: * Analyzing code structure and architecture * Reducing token count for LLM processing * Creating high-level documentation * Understanding code patterns and signatures * Sharing API and interface designs ## Related Options You can combine compression with other options: * `--remove-comments`: Remove code comments (see [Comment Removal](/guide/comment-removal)) * `--remove-empty-lines`: Remove empty lines * `--output-show-line-numbers`: Add line numbers to output ## Related Resources * [Comment Removal](/guide/comment-removal) - Remove comments for further token reduction * [Configuration](/guide/configuration) - Set `output.compress` in your config file * [Command Line Options](/guide/command-line-options) - Full CLI reference --- --- url: 'https://repomix.com/guide/command-line-options.md' --- # Command Line Options ## Basic Options * `-v, --version`: Show version information and exit ## CLI Input/Output Options | Option | Description | |--------|-------------| | `--verbose` | Enable detailed debug logging (shows file processing, token counts, and configuration details) | | `--quiet` | Suppress all console output except errors (useful for scripting) | | `--stdout` | Write packed output directly to stdout instead of a file (suppresses all logging) | | `--stdin` | Read file paths from stdin, one per line (specified files are processed directly) | | `--copy` | Copy the generated output to system clipboard after processing | | `--token-count-tree [threshold]` | Show file tree with token counts; optional threshold to show only files with ≥N tokens (e.g., `--token-count-tree 100`) | | `--top-files-len ` | Number of largest files to show in summary (default: `5`) | ## Repomix Output Options | Option | Description | |--------|-------------| | `-o, --output ` | Output file path (default: `repomix-output.xml`, use `"-"` for stdout) | | `--style