Skip to content

t1k:repomix

FieldValue
Modulet1k-maintainer
Version2.18.3
Effortmedium
Tools

Keywords: codebase, llm-context, pack, repomix, snapshot

/t1k:repomix
[path] [--format xml|md|txt]

Repomix packs entire repositories into single, AI-friendly files. Perfect for feeding codebases to LLMs like Claude, ChatGPT, and Gemini.

Use when:

  • Packaging codebases for AI analysis
  • Creating repository snapshots for LLM context
  • Analyzing third-party libraries
  • Preparing for security audits
  • Generating documentation context
  • Investigating bugs across large codebases
  • Creating AI-friendly code representations
Terminal window
repomix --version
Terminal window
# npm
npm install -g repomix
# Homebrew (macOS/Linux)
brew install repomix
Terminal window
# Package current directory (generates repomix-output.xml)
repomix
# Specify output format
repomix --style markdown
repomix --style json
# Package remote repository
npx repomix --remote owner/repo
# Custom output with filters
repomix --include "src/**/*.ts" --remove-comments -o output.md
  • 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

Process remote repositories without cloning:

Terminal window
# Shorthand
npx repomix --remote yamadashy/repomix
# Full URL
npx repomix --remote https://github.com/owner/repo
# Specific commit
npx repomix --remote https://github.com/owner/repo/commit/hash

Strip comments from supported languages (HTML, CSS, JavaScript, TypeScript, Vue, Svelte, Python, PHP, Ruby, C, C#, Java, Go, Rust, Swift, Kotlin, Dart, Shell, YAML):

Terminal window
repomix --remove-comments
Terminal window
# Package feature branch for AI review
repomix --include "src/**/*.ts" --remove-comments -o review.md --style markdown
Terminal window
# Package third-party library
npx repomix --remote vendor/library --style xml -o audit.xml
Terminal window
# Package with docs and code
repomix --include "src/**,docs/**,*.md" --style markdown -o context.md
Terminal window
# Package specific modules
repomix --include "src/auth/**,src/api/**" -o debug-context.xml
Terminal window
# Full codebase context
repomix --remove-comments --copy
Terminal window
# Include specific patterns
repomix --include "src/**/*.ts,*.md"
# Ignore additional patterns
repomix -i "tests/**,*.test.js"
# Disable .gitignore rules
repomix --no-gitignore
Terminal window
# Output format
repomix --style markdown # or xml, json, plain
# Output file path
repomix -o output.md
# Remove comments
repomix --remove-comments
# Copy to clipboard
repomix --copy
Terminal window
# Use custom config file
repomix -c custom-config.json
# Initialize new config
repomix --init # creates repomix.config.json

Repomix automatically counts tokens for individual files, total repository, and per-format output.

Typical LLM context limits:

  • Claude Sonnet: ~200K tokens
  • GPT-4: ~128K tokens
  • GPT-3.5: ~16K tokens
Terminal window
repomix --token-count-tree
repomix --token-count-tree 1000 # Only show files/directories with 1000+ tokens

Repomix uses Secretlint to detect sensitive data (API keys, passwords, credentials, private keys, AWS secrets).

Best practices:

  1. Always review output before sharing
  2. Use .repomixignore for sensitive files
  3. Enable security checks for unknown codebases
  4. Avoid packaging .env files
  5. Check for hardcoded credentials

Disable security checks if needed:

Terminal window
repomix --no-security-check

When user requests repository packaging:

  1. Assess Requirements

    • Identify target repository (local/remote)
    • Determine output format needed
    • Check for sensitive data concerns
  2. Configure Filters

    • Set include patterns for relevant files
    • Add ignore patterns for unnecessary files
    • Enable/disable comment removal
  3. Execute Packaging

    • Run repomix with appropriate options
    • Monitor token counts
    • Verify security checks
  4. Validate Output

    • Review generated file
    • Confirm no sensitive data
    • Check token limits for target LLM
  5. Deliver Context

    • Provide packaged file to user
    • Include token count summary
    • Note any warnings or issues

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

When invoking repomix, this skill MUST enforce the following caps on every run:

  • Output size cap: default --max-output-size 8MB (8 × 1024 × 1024 chars). Larger packs do not fit a single LLM context anyway. Override only when the user explicitly requests --no-output-size-cap.
  • Token-count guard: if the post-pack token estimate exceeds 200_000, refuse to deliver the file inline; instead write the path and report 'too large to inline; opened on disk at <path>'.
  • Security check is FAIL-CLOSED, not fail-open: the historical --no-security-check flag is a fail-OPEN default that ships secret-laden packs. This skill MUST pass --security-check (default), and MUST refuse --no-security-check unless the user types the literal phrase I accept secret leak risk in the same turn.
  • Guarded write: packed file goes to os.tmpdir()/t1k-repomix/<sha>.{xml,md,txt} first; only after the security-check passes does the skill copy to the user-specified output path. Failure path leaves nothing in the destination.

These caps protect downstream consumers (LLM context budgets) and prevent the most common failure mode (accidentally packing .env or credential files into a session).