ast-grep
Installation
SKILL.md
AST-Grep: Structural Code Search & Outline
Use ast-grep for syntax-aware code exploration instead of dumping large files or parsing noisy regex grep output.
High-Leverage Commands
1. Symbol Outlining
Inspect all functions, classes, interfaces, and methods in a file without loading the entire source:
ast-grep outline path/to/file.ts
2. Pattern Matching
Search for exact syntactic constructs using $VAR (single node) and $$$VAR (zero or more nodes):
# Find all function declarations
ast-grep run -p 'function $NAME($$$ARGS) { $$$BODY }' <dir>