Use ast-grep for structural code search and refactoring when editing code structure with ambiguity in text matching, handling "old_string not unique" problems, or performing formatting-independent pattern matching across function signatures, method calls, and class structures
Performs structural code search and refactoring using AST patterns instead of text matching. Triggers when editing code structure with ambiguous text patterns or encountering "old_string not unique" errors.
/plugin marketplace add xdg/xdg-claude/plugin install context-efficient-tools@xdg-claudeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
reference/ast-grep-guide.mdUse ast-grep to solve the "old_string not unique" problem by matching code structure instead of exact text. This enables refactoring across formatting variations and structural patterns.
If editing code structure and there's any ambiguity in text matching → use ast-grep.
ast-grep's primary value: Solves the "old_string not unique" problem by matching structure instead of exact text.
For comprehensive patterns, syntax, metavariables, common use cases, language-specific tips, and best practices, load ast-grep guide.
The reference includes:
$VAR, $$$ARGS, $$STMT)