An AI agent skill that teaches efficient CLI-based code and file search strategies. Provides tool selection guidance, pattern recipes, and best practices for searching codebases of any size.
| Tool | Purpose | Replaces |
|---|---|---|
ripgrep (rg) |
Ultra-fast text/regex search | grep, grep -r |
ast-grep (sg) |
Structural/syntax-aware code search | complex regex hacks |
fd (fd) |
Fast file finder | find |
ripgrep-all (rga) |
Search PDFs, Office docs, archives | manual text extraction |
| tokei | Fast code statistics by language | cloc, wc -l |
| scc | Code counter with complexity analysis | cloc, tokei (when complexity needed) |
- Use
rginstead ofgrepfor text search in source code - Use
fdinstead offindfor file discovery - Use
rgainstead ofrgwhen searching non-code files (PDFs, Office docs, archives) - Use
sginstead of regex when matching code structure - Use
tokeiorsccto assess codebase size, notclocorwc -l - Always start with targeted, narrow searches and widen only if needed
- Always specify file types/languages to limit search scope
- Count matches before viewing full results to avoid overwhelming output
Requires Composer and the composer-agent-skill-plugin.
composer require netresearch/agent-file-searchskills/file-search/
SKILL.md # Main skill file (tool selection, usage, best practices)
references/
ripgrep-patterns.md # Extensive rg pattern recipes by use case
ast-grep-patterns.md # Structural search patterns by language
tool-comparison.md # Detailed comparison and decision guide
MIT - see LICENSE for details.