skills/modelscope.cn/ast-grep-search

ast-grep-search

SKILL.md

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 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 "any function name," use ast-grep.

Pattern Syntax

Installs
1
First Seen
Apr 21, 2026