find
Fast file and code search using `fd` and `rg`. Use when the user asks to locate files or search code patterns.
When & Why to Use This Skill
This Claude skill enables lightning-fast file and code search by leveraging the power of and (rg). It is designed to help developers and AI agents navigate complex codebases efficiently, allowing for precise pattern matching, file location, and content discovery across large-scale projects. By integrating these high-performance CLI tools, the skill significantly reduces the time spent on manual file exploration and code auditing.
Use Cases
- Codebase Navigation: Quickly locate specific class, function, or interface definitions across thousands of files using regex patterns.
- Refactoring Support: Identify all instances of a specific code pattern or variable name to ensure safe and comprehensive updates during global changes.
- Bug Investigation: Search for specific error strings, log patterns, or suspicious code snippets to accelerate the root cause analysis during debugging.
- Project Auditing: Find specific file types or configuration patterns (e.g., searching for all .env or .yaml files) to audit security settings and project dependencies.
| name | find |
|---|---|
| description | Fast file and code search using `fd` and `rg`. Use when the user asks to locate files or search code patterns. |
| compatibility | Assumes a filesystem shell with `fd` and `rg` installed. |
| allowed-tools | Bash(fd:*) Bash(rg:*) |
Use fd for file search, rg for content search.
Common Patterns
Find files by name:
fd "pattern" [path]
fd -H "pattern" [path] # include hidden files
fd -e md -e txt "README" [path]
Search file contents:
rg -n "pattern" [path]
rg -i "pattern" # case-insensitive
rg -S "pattern" # smart case
rg --files-with-matches "pattern" # list files only
rg -n "pattern" --glob '!node_modules/*'
Find definitions:
rg -n "^(class|interface|function|def)\\s+Name\\b"
rg -n "^class\\s+ClassName\\b" --type python
Search with context:
rg -n "pattern" -A 2 -B 2
Combine searches:
fd -0 "Controller" -t f | xargs -0 rg -n "handleRequest"