ripgrep

xdg's avatarfrom xdg

Efficient text search using ripgrep (rg) with one-shot patterns that minimize iterations by getting files, line numbers, and context in a single call

⭐2stars🔀0forks📁View on GitHub🕐Updated Nov 23, 2025

When & Why to Use This Skill

The ripgrep skill empowers Claude with high-performance text search capabilities, utilizing optimized 'one-shot' patterns to locate specific strings or regex patterns across large codebases. By delivering file paths, line numbers, and surrounding context in a single execution, it significantly reduces iteration cycles and context window overhead, making it an essential tool for efficient code navigation and analysis.

Use Cases

  • Codebase Exploration: Rapidly locate function definitions, variable usages, or specific architectural patterns across thousands of files.
  • Efficient Debugging: Search through logs or source code for error messages and stack traces, retrieving immediate surrounding context to understand the root cause.
  • Refactoring and Impact Analysis: Identify all instances of a deprecated API or specific code pattern to assess the scope of required changes.
  • Security and Compliance Auditing: Scan local repositories for hardcoded secrets, vulnerable code patterns, or unauthorized keywords using advanced regex filtering.
  • Data Extraction from Text: Use pipe compositions (like head, sort, or wc) to perform complex text processing and statistical analysis on large datasets directly within the terminal.
nameripgrep
descriptionEfficient text search using ripgrep (rg) with one-shot patterns that minimize iterations by getting files, line numbers, and context in a single call

ripgrep: Powerful, one-shot text search

Default Strategy

For content search: use Bash(rg) with -e 'pattern' -n -C 2 for one-shot results.

This gives files, line numbers, and context in a single call - minimizes iterations and context usage.

Always prefer getting line numbers and surrounding context over multiple search attempts.

Tool Selection

Grep tool (built on ripgrep) - Use for structured searches:

  • Basic pattern matching with structured output
  • File type filtering with type parameter
  • When special flags like -F, -v, -w, or pipe composition are not needed
  • Handles 95% of search needs

Bash(rg) - Use for one-shot searches needing special flags or composition:

  • Fixed string search (-F)
  • Invert match (-v)
  • Word boundaries (-w)
  • Context lines with patterns (-n -C 2)
  • Pipe composition (| head, | wc -l, | sort)
  • Default choice for efficient one-shot results

Glob tool - Use for file name/path matching only (not content search)

When to Load Detailed Reference

Load ripgrep guide when needing:

  • One-shot search pattern templates
  • Effective flag combinations for complex searches
  • Pipe composition patterns
  • File type filters reference (-t flags)
  • Pattern syntax examples
  • Translation between Grep tool and rg commands
  • Performance optimization for large result sets

The guide focuses on practical patterns for getting targeted results in minimal calls.