Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Searches code by AST structure using ast-grep to find function calls, imports, and class definitions instead of text patterns.
40% 72%+32 ptsof test cases passed
Passed 18 of 25 test cases with the skill, and 10 of 25 without it.
3 of 3 safety checks passed
Not used yet
Search code by its abstract syntax tree (AST) structure. Finds semantic patterns that regex cannot match reliably.
| Tool | Command | Use For |
|---|---|---|
| ast-grep | sg -p 'pattern' | AST-aware code search |
| Pattern | Matches | Example |
|---|---|---|
$NAME | Named identifier | function $NAME() {} |
$_ | Any single node | console.log($_) |
$$$ | Zero or more nodes | function $_($$$) {} |
# 1. Find console.log calls
sg -p 'console.log($_)'
# 2. Find React hooks
sg -p 'const [$_, $_] = useState($_)'
sg -p 'useEffect($_, [$$$])'
# 3. Find function definitions
sg -p 'function $NAME($$$) { $$$ }'
sg -p 'def $NAME($$$): $$$' --lang python
# 4. Find imports
sg -p 'import $_ from "$_"'
sg -p 'from $_ import $_' --lang python
# 5. Find async patterns
sg -p 'await $_'
sg -p 'async function $NAME($$$) { $$$ }'
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.