// PROACTIVELY use when exploring unfamiliar codebases, analyzing remote repositories, generating reference skills from code, or needing AI-optimized context for code review. Triggers on "analyze repo", "explore codebase", "pack repository", "generate skill from", "understand this codebase", "code context".
| name | repomix-codebase-explorer |
| description | PROACTIVELY use when exploring unfamiliar codebases, analyzing remote repositories, generating reference skills from code, or needing AI-optimized context for code review. Triggers on "analyze repo", "explore codebase", "pack repository", "generate skill from", "understand this codebase", "code context". |
Pack and analyze codebases into AI-optimized formats. Three access methods: MCP tools (maximum control), slash commands (quick access), agents (autonomous exploration).
What do you need?
โ
โโ Quick exploration of a repo?
โ โโ /repomix-explorer:explore-remote (slash command)
โ
โโ Precise control over packing/filtering?
โ โโ MCP tools (pack_codebase, pack_remote_repository)
โ
โโ Autonomous multi-step analysis?
โ โโ repomix-explorer:explorer agent
โ
โโ Search within packed output?
โ โโ MCP grep_repomix_output (after packing)
โ
โโ Create reusable reference skill?
โโ MCP generate_skill
Always check schema first: mcp-cli info repomix/<tool> before calling.
| Task | Tool | Example |
|---|---|---|
| Pack local directory | pack_codebase | mcp-cli call repomix/pack_codebase '{"directory": "/path/to/project"}' |
| Pack GitHub repo | pack_remote_repository | mcp-cli call repomix/pack_remote_repository '{"remote": "user/repo"}' |
| Generate skill from code | generate_skill | mcp-cli call repomix/generate_skill '{"directory": "/path", "skillName": "my-skill"}' |
| Search packed output | grep_repomix_output | mcp-cli call repomix/grep_repomix_output '{"outputId": "xxx", "pattern": "function.*auth"}' |
| Read packed output | read_repomix_output | mcp-cli call repomix/read_repomix_output '{"outputId": "xxx", "startLine": 1, "endLine": 100}' |
| Attach existing pack | attach_packed_output | mcp-cli call repomix/attach_packed_output '{"path": "/path/to/output.xml"}' |
See: references/mcp-tools.md for complete schemas.
| Command | Purpose | When to Use |
|---|---|---|
/repomix-explorer:explore-local | Interactive local exploration | Understand local project structure |
/repomix-explorer:explore-remote | Interactive GitHub exploration | Quick remote repo analysis |
/repomix-commands:pack-local | Pack local codebase | Need packed output without exploration |
/repomix-commands:pack-remote | Pack remote repository | Pack GitHub repo quickly |
See: references/slash-commands.md for details.
// Use Task tool with repomix-explorer:explorer
Task({
subagent_type: "repomix-explorer:explorer",
prompt: "Analyze the authentication patterns in https://github.com/user/repo",
description: "Analyze auth patterns in repo"
})
Best for:
See: references/agent-integration.md for orchestration patterns.
| Rule | Why |
|---|---|
Run mcp-cli info repomix/<tool> before calling | Schemas have required params you might miss |
Use grep_repomix_output for targeted search | Don't load entire codebase when you need specific patterns |
| Store outputId after packing | Required for subsequent grep/read operations |
Use includePatterns for large repos | Focus on relevant files, reduce token cost |
| Anti-Pattern | Do Instead |
|---|---|
| Pack entire repo then read all | Pack once, grep multiple times |
Ignore compress for 2000+ file repos | Enable compression OR use incremental grep |
| Call grep without checking outputId exists | Pack first, store the ID, then grep |
| Skip pattern filtering on monorepos | Use includePatterns to focus scope |
| Codebase Size | Strategy |
|---|---|
| <100 files | Full pack, no compression |
| 100-500 files | Full pack with XML format |
| 500-2000 files | Use compression OR incremental grep |
| >2000 files | Always incremental grep workflow |
Compression reduces ~70% tokens while preserving semantics via Tree-sitter.
# After analysis, persist findings for future sessions
mcp-cli call cognee/save_interaction '{
"interaction_type": "analysis",
"content": "Analyzed auth patterns in user/repo: JWT middleware in /src/auth, refresh tokens in /src/tokens"
}'
Combine schema context with codebase analysis for full-stack understanding:
Route architectural decisions discovered during analysis:
# After finding multiple auth patterns
Task({
subagent_type: "ai-opus-debate",
prompt: "Debate: JWT vs session-based auth based on patterns found in codebase analysis..."
})
# Quick: Use slash command
/repomix-explorer:explore-remote
# Or MCP for control:
mcp-cli call repomix/pack_remote_repository '{"remote": "user/repo"}'
# Store outputId from response
mcp-cli call repomix/grep_repomix_output '{"outputId": "ID", "pattern": "export.*function"}'
mcp-cli call repomix/generate_skill '{
"directory": "/path/to/library",
"skillName": "library-reference",
"includePatterns": "src/**/*.ts"
}'
# Creates .claude/skills/library-reference/ with SKILL.md and references/
# 1. Pack the PR branch changes
mcp-cli call repomix/pack_codebase '{"directory": "/path", "includePatterns": "src/**"}'
# 2. Search for patterns to review
mcp-cli call repomix/grep_repomix_output '{"outputId": "ID", "pattern": "TODO|FIXME|console\\.log"}'
# 3. Route to Opus for deep review
Task({ subagent_type: "ai-opus-debate", prompt: "Review these patterns..." })
| Mistake | Consequence | Fix |
|---|---|---|
Packing without includePatterns on monorepo | 100k+ token output | Filter to relevant paths |
Using read_repomix_output for entire file | Token explosion | Use grep for targeted search |
| Re-packing same repo multiple times | Wasted API calls | Store and reuse outputId |
| Ignoring security scan results | Committing secrets | Review security warnings in pack output |