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
  • Debug AST - Visualize AST and CST structures
  • Logical Queries - Composite queries using all, any, and not operators
  • AI-assisted - Convert natural language to YAML rules
  • Relational Search - Find patterns using inside, has, precedes

Installs
6
GitHub Stars
7
First Seen
May 6, 2026
ast-grep — codeatcode/oss-ai-skills