ast-grep Structural Code Search and Rewrite

SkillSearch

Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the ast-grep Structural Code Search and Rewrite skill

What this skill tells your AI

The instructions your AI receives, as published by agentskillexchange/skills in skills/ast-grep-structural-code-search-rewrite/SKILL.md and read by ahel’s review.

Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.

Installation

Use the upstream install or setup path that matches your environment:

  • npm install --global @ast-grep/cli
  • pip install ast-grep-cli
  • brew install ast-grep
  • cargo install ast-grep --locked

Requirements and caveats from upstream:

  • You can use $ sign + upper case letters as a wildcard, e.g. $MATCH, to match any single AST node. Think of it as [regular expression dot](https://regexone.com/lesson...
  • You can install it from npm, pip, cargo, [cargo-binstall](...

Basic usage or getting-started notes:

Source

Signals

GitHub stars
38
Forks
53
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
ast-grep-structural-code-search-and-rewrite
Source
github.com/agentskillexchange/skills