ast-grep

Originally fromast-grep/claude-skill
Installation
SKILL.md

ast-grep

Workflow

  1. Write a test snippet representing the target code
  2. Write the rule (start with pattern, escalate to kind + has/inside if needed)
  3. Test with --stdin before searching the codebase
  4. Search the codebase once the rule matches

Critical Gotchas

Always use stopBy: end on relational rules

Without it, has/inside stop at the first non-matching node instead of traversing the full subtree:

# WRONG — will miss deeply nested matches
has:
  pattern: await $EXPR
Related skills
Installs
23
Repository
poteto/noodle
GitHub Stars
143
First Seen
Mar 3, 2026