Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ratacat avatar

Ripgrep

  • 359 installs
  • 49 repo stars
  • Updated February 11, 2026
  • ratacat/claude-skills

ripgrep is a Claude Code skill that teaches agents to run the rg CLI for fast recursive regex searches across large codebases with .gitignore-aware filtering.

About

ripgrep is a Claude Code skill for the rg line-oriented search tool that recursively matches regex patterns across directories while respecting .gitignore by default. The skill guides agents to filter by file type or path, interpret match output, and avoid reading oversized files manually when grep or find is too slow. Ripgrep is documented as 10-100x faster than grep for typical repository scans. Developers reach for ripgrep when locating symbols, config keys, error strings, or API usages across monorepos, legacy trees, or unfamiliar checkouts during feature work, refactors, and bug hunts.

  • Construct efficient rg queries and globs
  • Filter by language, path, and ignore rules
  • Parse match context for refactors
  • Compare ripgrep vs grep tradeoffs
  • Accelerate codebase navigation for agents

Ripgrep by the numbers

  • 359 all-time installs (skills.sh)
  • Ranked #155 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ratacat/claude-skills --skill ripgrep

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs359
repo stars49
Last updatedFebruary 11, 2026
Repositoryratacat/claude-skills

How do you search large codebases with regex fast?

Run fast regex searches across large codebases, filter by file type or path, and interpret ripgrep output while implementing features, fixing bugs, or navigating unfamiliar repositories.

Who is it for?

Developers and coding agents that need fast, gitignore-aware text search across large or unfamiliar repositories.

Skip if: Developers who only need IDE symbol search inside a single open file without terminal workflows.

When should I use this skill?

The user asks to search for a pattern, find occurrences in files, or locate text across a codebase.

What you get

Filtered ripgrep match lists with file paths, line numbers, and regex hits ready for navigation or edits.

  • filtered rg match output
  • file-and-line hit lists

By the numbers

  • Documented as 10-100x faster than grep for typical searches
  • Respects .gitignore by default during recursive directory scans

Files

SKILL.mdMarkdownGitHub ↗

Ripgrep (rg) - Fast Text Search Tool

Overview

Ripgrep is a line-oriented search tool that recursively searches directories for regex patterns. It's 10-100x faster than grep and respects .gitignore by default. Use it instead of grep, find, or manually reading large files.

Core principle: When you need to find text in files, use ripgrep. Don't read entire files into context when you can search them.

When to Use

Use ripgrep when:

  • Searching for text patterns across a codebase or directory
  • Finding all occurrences of a function, variable, or string
  • Searching through books, documentation, or large text files
  • Files are too large to read fully into context
  • Looking for specific content in many files at once
  • Finding files that contain (or don't contain) certain patterns
  • Extracting matching lines for analysis

Don't use when:

  • You need the full file content (use Read tool)
  • Simple glob pattern matching for filenames only (use Glob tool)
  • You need structured data extraction (consider jq, awk)

Quick Reference

TaskCommand
Basic searchrg "pattern" [path]
Case insensitiverg -i "pattern"
Smart case (auto)rg -S "pattern"
Whole word onlyrg -w "word"
Fixed string (no regex)rg -F "literal.string"
Show context linesrg -C 3 "pattern" (3 before & after)
Show line numbersrg -n "pattern" (default in tty)
Only filenamesrg -l "pattern"
Files without matchrg --files-without-match "pattern"
Count matchesrg -c "pattern"
Only matching partrg -o "pattern"
Invert matchrg -v "pattern"
Multiline searchrg -U "pattern.*\nmore"

File Filtering

By File Type

Ripgrep has built-in file type definitions. Use -t to include, -T to exclude:

# Search only Python files
rg -t py "def main"

# Search only JavaScript and TypeScript
rg -t js -t ts "import"

# Exclude test files
rg -T test "function"

# List all known types
rg --type-list

Common types: py, js, ts, rust, go, java, c, cpp, rb, php, html, css, json, yaml, md, txt, sh

By Glob Pattern

# Only .tsx files
rg -g "*.tsx" "useState"

# Exclude node_modules (in addition to gitignore)
rg -g "!node_modules/**" "pattern"

# Only files in src directory
rg -g "src/**" "pattern"

# Multiple globs
rg -g "*.js" -g "*.ts" "pattern"

# Case insensitive globs
rg --iglob "*.JSON" "pattern"

By File Size

# Skip files larger than 1MB
rg --max-filesize 1M "pattern"

Directory Control

# Limit depth
rg --max-depth 2 "pattern"

# Search hidden files (dotfiles)
rg --hidden "pattern"

# Follow symlinks
rg -L "pattern"

# Ignore all ignore files (.gitignore, etc.)
rg --no-ignore "pattern"

# Progressive unrestricted (-u can stack up to 3 times)
rg -u "pattern"      # --no-ignore
rg -uu "pattern"     # --no-ignore --hidden
rg -uuu "pattern"    # --no-ignore --hidden --binary

Context Options

# Lines after match
rg -A 5 "pattern"

# Lines before match
rg -B 5 "pattern"

# Lines before and after
rg -C 5 "pattern"

# Print entire file on match (passthrough mode)
rg --passthru "pattern"

Output Formats

# Just filenames with matches
rg -l "pattern"

# Files without matches
rg --files-without-match "pattern"

# Count matches per file
rg -c "pattern"

# Count total matches (not lines)
rg --count-matches "pattern"

# Only the matched text (not full line)
rg -o "pattern"

# JSON output (for parsing)
rg --json "pattern"

# Vim-compatible output (file:line:col:match)
rg --vimgrep "pattern"

# With statistics
rg --stats "pattern"

Regex Patterns

Ripgrep uses Rust regex syntax by default:

# Alternation
rg "foo|bar"

# Character classes
rg "[0-9]+"
rg "[a-zA-Z_][a-zA-Z0-9_]*"

# Word boundaries
rg "\bword\b"

# Quantifiers
rg "colou?r"           # 0 or 1
rg "go+gle"            # 1 or more
rg "ha*"               # 0 or more
rg "x{2,4}"            # 2 to 4 times

# Groups
rg "(foo|bar)baz"

# Lookahead/lookbehind (requires -P for PCRE2)
rg -P "(?<=prefix)content"
rg -P "content(?=suffix)"

Multiline Matching

# Enable multiline mode
rg -U "start.*\nend"

# Dot matches newline too
rg -U --multiline-dotall "start.*end"

# Match across lines
rg -U "function\s+\w+\([^)]*\)\s*\{"

Replacement (Preview Only)

Ripgrep can show what replacements would look like (doesn't modify files):

# Simple replacement
rg "old" -r "new"

# Using capture groups
rg "(\w+)@(\w+)" -r "$2::$1"

# Remove matches (empty replacement)
rg "pattern" -r ""

Searching Special Files

Compressed Files

# Search in gzip, bzip2, xz, lz4, lzma, zstd files
rg -z "pattern" file.gz
rg -z "pattern" archive.tar.gz

Binary Files

# Include binary files
rg --binary "pattern"

# Treat binary as text (may produce garbage)
rg -a "pattern"

Large Files

For files too large to read into context:

# Search and show only matching lines
rg "specific pattern" large_file.txt

# Limit matches to first N per file
rg -m 10 "pattern" huge_file.log

# Show byte offset for large file navigation
rg -b "pattern" large_file.txt

# Use with head/tail for pagination
rg "pattern" large_file.txt | head -100

Performance Tips

1. Be specific with paths - Don't search from root when you know the subdir 2. Use file types - -t py is faster than -g "*.py" 3. Use fixed strings - -F when you don't need regex 4. Limit depth - --max-depth when you know structure 5. Let gitignore work - Don't use --no-ignore unless needed 6. Use word boundaries - -w is optimized

Common Patterns

Find function definitions

# Python
rg "def \w+\(" -t py

# JavaScript/TypeScript
rg "(function|const|let|var)\s+\w+\s*=" -t js -t ts
rg "^\s*(async\s+)?function" -t js

# Go
rg "^func\s+\w+" -t go

Find imports/requires

# Python
rg "^(import|from)\s+" -t py

# JavaScript
rg "^(import|require\()" -t js

# Go
rg "^import\s+" -t go

Find TODO/FIXME comments

rg "(TODO|FIXME|HACK|XXX):"

Find error handling

# Python
rg "except\s+\w+:" -t py

# JavaScript
rg "\.catch\(|catch\s*\(" -t js

Find class definitions

# Python
rg "^class\s+\w+" -t py

# JavaScript/TypeScript
rg "^(export\s+)?(default\s+)?class\s+\w+" -t js -t ts

Search in books/documents

# Find chapter headings
rg "^(Chapter|CHAPTER)\s+\d+" book.txt

# Find quoted text
rg '"[^"]{20,}"' document.txt

# Find paragraphs containing word
rg -C 2 "keyword" book.txt

Combining with Other Tools

# Find files, then search
rg --files | xargs rg "pattern"

# Search and count by file
rg -c "pattern" | sort -t: -k2 -rn

# Search and open in editor
rg -l "pattern" | xargs code

# Extract unique matches
rg -o "\b[A-Z]{2,}\b" | sort -u

# Search multiple patterns from file
rg -f patterns.txt

Exit Codes

CodeMeaning
0Matches found
1No matches found
2Error occurred

Useful for scripting:

if rg -q "pattern" file.txt; then
    echo "Found"
fi

Common Mistakes

MistakeFix
Pattern has special charsUse -F for fixed strings or escape: rg "foo\.bar"
Can't find hidden filesAdd --hidden or -uu
Missing node_modulesAdd --no-ignore (but it's usually right to skip)
Regex too complexTry -P for PCRE2 with lookahead/lookbehind
Output too longUse -m N to limit, or -l for just filenames
Binary file skippedAdd --binary or -a for text mode
Need to see full lineRemove -o (only-matching) flag

When to Prefer Other Tools

TaskBetter Tool
Structured JSON queriesjq
Column-based text processingawk
Stream editing/substitutionsed (actually modifies files)
Find files by name onlyfd or find
Simple file listingls or glob
Full file content neededRead tool

Related skills

How it compares

Choose ripgrep over manual file reads when you need fast, filtered regex hits across an entire repository tree.

FAQ

When should developers use ripgrep instead of grep?

ripgrep should be used when recursive regex search must span many files quickly. The skill notes rg is 10-100x faster than grep and respects .gitignore by default, which reduces noise in large repositories.

Does the ripgrep skill support file-type filtering?

Yes. The ripgrep skill directs agents to filter ripgrep output by file type or path when searching codebases, so matches focus on relevant source, config, or document files.

CLI & Terminalfrontendbackendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.