code-search
SKILL.md
Code Search & Refactoring Tools
ast-grep vs ripgrep
When to Use ast-grep
Use ast-grep when structure matters. It parses code and matches AST nodes, so results ignore comments/strings, understand syntax, and can safely rewrite code.
Best for:
- Refactors/codemods: rename APIs, change import forms, rewrite call sites or variable kinds
- Policy checks: enforce patterns across a repo (
scanwith rules +test) - Editor/automation: LSP mode;
--jsonoutput for tooling - Any operation where you'll apply changes to code
When to Use ripgrep
Use ripgrep when text is enough. It's the fastest way to grep literals/regex across files.