Agent skill · software engineering · aiskillstore
structural-search
Search code by AST structure using ast-grep. Find semantic patterns like function calls, imports, class definitions instead of text patterns. Triggers on: find all calls to X, search for pattern, refactor usages, find where function is used, structural search, ast-grep, sg.
Why this skill is useful
Adds specific AST pattern commands for ast-grep that enhance code search capabilities beyond standard text patterns.
What it needs
Requires ast-grep installed locally. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Structural Search Search code by its abstract syntax tree (AST) structure. Finds semantic patterns that regex cannot match reliably. Tools Tool Command Use For ------ --------- --------- ast-grep sg -p 'pattern' AST-aware code search Pattern Syntax Pattern Matches Example --------- --------- --------- $NAME Named identifier function $NAME() {} $ Any single node console.log($) $$ Zero or more nodes function $($$) {} Top 10 Essential Patterns Quick Reference Task Command ------ --------- Find pattern sg -p 'pattern' Specific language sg -p 'pattern' --lang python Replace (preview) sg -p 'old' -r 'new' Replace (apply) sg -p 'old' -r 'new' --rewrite Show context sg -p 'pattern' -A 3 JSON output sg -p 'pattern' --json File list only sg -p 'pattern' -l Count matches sg -p 'pattern' --count Run YAML rules sg scan When to Use Finding all usages of a function/method Locating specific code patterns (hooks, API calls) Preparing for large-scale refactoring When regex would match false positives Detecting anti-patterns and security issues Creating custom linting rules Additional Resources For complete patterns, load: ./references/js-ts-patterns.md - JavaScript/TypeScript patterns ./references/python-patterns.md - Python patterns ./references/go-rust-patterns.md - Go and Rust patterns ./references/security-patterns.md - Security vulnerability detection ./references/advanced-usage.md - YAML rules and tool integration ./assets/rule-template.yaml - Starter template for custom rules
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/structural-search