ast-grep

Installation
SKILL.md

ast-grep

Fast and user-friendly tool for large-scale code searching, linting, and rewriting using AST patterns.

Overview

ast-grep (sg) is a CLI tool that searches code based on Abstract Syntax Tree patterns, similar to syntax-aware grep/sed. It supports multiple languages and can perform automated code refactoring.

  • Fast - Written in Rust, processes code quickly
  • Polyglot - Supports JavaScript, TypeScript, Python, Go, Rust, Java, C, C++, and more
  • Structural - Matches code by AST patterns, not regex
  • Rewrite - Automated code refactoring with metavariables

Installation

Installs
16
GitHub Stars
28
First Seen
May 6, 2026