file-search

0xDarkMatter's avatarfrom 0xDarkMatter

Modern file and content search using fd, ripgrep (rg), and fzf. Triggers on: fd, ripgrep, rg, find files, search code, fzf, fuzzy find, search codebase.

⭐3stars🔀0forks📁View on GitHub🕐Updated Dec 27, 2025

When & Why to Use This Skill

This Claude skill integrates high-performance command-line utilities—fd, ripgrep (rg), and fzf—to enable lightning-fast file discovery and deep content searching within complex codebases. By leveraging modern search algorithms, it allows developers and agents to navigate large-scale projects with precision, offering advanced filtering, regex support, and interactive selection that significantly outperforms traditional search tools.

Use Cases

  • Locate specific files or directories across massive projects instantly while automatically respecting .gitignore rules to filter out noise.
  • Perform high-speed global searches for specific code patterns, API usages, or 'TODO' markers using ripgrep's optimized regex engine.
  • Filter search results by file extension or exclude heavy directories like node_modules and build artifacts to isolate relevant source code.
  • Execute complex batch operations by combining file discovery with content matching, such as finding all Python files containing a specific import and counting their lines.
  • Enhance interactive workflows by using fuzzy finding to select and preview files before performing edits or refactoring.
namefile-search
description"Modern file and content search using fd, ripgrep (rg), and fzf. Triggers on: fd, ripgrep, rg, find files, search code, fzf, fuzzy find, search codebase."
compatibility"Requires fd, ripgrep (rg), and optionally fzf. Install: brew install fd ripgrep fzf (macOS)."
allowed-tools"Bash"

File Search

Modern file and content search.

fd - Find Files

# Find by name
fd config                    # Files containing "config"
fd -e py                     # Python files

# By type
fd -t f config               # Files only
fd -t d src                  # Directories only

# Exclude
fd -E node_modules           # Exclude directory
fd -E "*.min.js"             # Exclude pattern

# Execute command
fd -e py -x wc -l            # Line count per file

rg - Search Content

# Simple search
rg "TODO"                    # Find TODO
rg -i "error"                # Case-insensitive

# By file type
rg -t py "import"            # Python files only
rg -t js -t ts "async"       # JS and TS

# Context
rg -C 3 "function"           # 3 lines before/after

# Output modes
rg -l "TODO"                 # File names only
rg -c "TODO"                 # Count per file

fzf - Interactive Selection

# Find and select
fd | fzf

# With preview
fd | fzf --preview 'bat --color=always {}'

# Multi-select
fd -e ts | fzf -m | xargs code

Combined Patterns

# Find files, search content
fd -e py -x rg "async def" {}

# Search, select, open
rg -l "pattern" | fzf --preview 'rg -C 3 "pattern" {}' | xargs vim

Quick Reference

Task Command
Find TS files fd -e ts
Find in src fd -e ts src/
Search pattern rg "pattern"
Search in type rg -t py "import"
Files with match rg -l "pattern"
Count matches rg -c "pattern"
Interactive fd | fzf
With preview fd | fzf --preview 'bat {}'

Performance Tips

Tip Why
Both respect .gitignore Auto-skip node_modules, dist
Use -t over -g Type flags are faster
Narrow the path rg pattern src/ faster
Use -F for literals Avoids regex overhead

Additional Resources

For detailed patterns, load:

  • ./references/advanced-workflows.md - Git integration, shell functions, power workflows