ast-grep-searchlisted
Install: claude install-skill laurigates/claude-plugins
# ast-grep Structural Code Search & Refactoring
Structural code search and refactoring using `ast-grep` — matches code by its AST (abstract syntax tree) rather than text patterns.
## When to Use This Skill
| Use this skill when... | Use something else instead when... |
|------------------------|------------------------------------|
| The pattern depends on AST structure (function shape, call form, argument count) | Searching plain text or regex matches → `tools-plugin:rg-code-search` |
| Refactoring API call sites across many files while preserving captured variables | Running a one-shot anti-pattern scan with a report → `code-antipatterns` |
| Hand-written structural search/replace for an ad-hoc migration | Functional refactors of a known file/directory → `code-refactor` |
| Building a new ast-grep rule for a codebase-specific smell | Looking up agentic flags for an existing linter → `code-lint` |
## When to Use ast-grep vs Grep/ripgrep
| Use ast-grep when... | Use grep/rg when... |
|---------------------|---------------------|
| Pattern depends on code structure | Simple text or regex match |
| Need to match any number of arguments | Searching logs, docs, config |
| Refactoring across many files | One-off literal string search |
| Finding anti-patterns (empty catch, etc.) | Language doesn't matter |
| Replacing while preserving variables | Quick filename/line check |
**Decision rule**: If your search pattern contains wildcards for "any expression," "any arguments," or