- Home
- Skills
- Brettatoms
- Agent Skills
- Code Search
code-search_skill
- JavaScript
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill brettatoms/agent-skills --skill code-search- SKILL.md5.0 KB
Overview
This skill uses ripgrep (rg) to search file contents quickly and precisely. It helps locate code patterns, function or type definitions, references, TODOs, and configuration values across a project. Use it when you need fast, configurable text searches scoped by file type, directory, or regex.
How this skill works
The skill constructs rg commands with common options (file-type filters, context lines, glob includes/excludes, case rules, and multiline mode) and runs them against the repository. Results can be limited, formatted (line numbers, counts, matched text), or emitted as JSON for downstream parsing. It favors a broad-to-narrow strategy: list matching files first, then inspect with context.
When to use it
- Find where a function, class, or type is defined across the repo
- Locate all usages or references of a symbol with context
- Search for TODO/FIXME or configuration keys across multiple file types
- Quickly scan specific directories or file patterns (e.g., src/, *.ts, *.clj)
- Perform fast, repeated searches while debugging or refactoring
Best practices
- Start with rg -l to list files before dumping matches (cheaper and faster)
- Filter by file type (-t) or globs (-g) to reduce noise and improve speed
- Use -C, -A, -B for readable context around matches when investigating usage
- Use -m to limit matches per file and --json for programmatic consumption
- Combine -g "!pattern" to exclude tests, vendor, or node_modules directories
Example use cases
- Find a JavaScript function definition: rg -t js "function\s+myFunction|const\s+myFunction\s*="
- Locate all references to a Clojure symbol with two lines of context: rg -t clojure -C 2 "my-function"
- Search YAML/JSON config keys like database or password across env files: rg "database|password" -g "*.{yml,yaml,json,env}"
- List files mentioning authentication before inspecting details: rg -l "authentication" then rg -C 5 "authentication" src/
- Search multiline patterns such as start/end blocks: rg -U "start.*?end"
FAQ
Install rg via your package manager (apt, pacman, brew) or cargo. Then rerun the search commands.
How do I avoid matching partial words?
Use word-boundary or whole-word matching, e.g. rg -w "user" or include regex anchors like \buser\b.