code-ast-grep
Installation
SKILL.md
ast-grep: Semantic Code Search
Use ast-grep (command: sg) for structure-aware code searching. Unlike Grep (text search), ast-grep understands syntax and finds patterns by their role in the code, not their textual form.
When to Use ast-grep vs Grep
Use ast-grep |
Use Grep |
|---|---|
| Find all calls to a function | Find a string in any file |
| Find class definitions | Search logs or text files |
| Find import statements for a module | Find TODO comments |
| Find all uses of a decorator | Search non-code files (YAML, MD) |
| Find arrow functions vs regular functions | Quick text pattern in known file |
| Search within specific code constructs | Simple identifier search |