ast-grep

Search codebases with AST-aware structural patterns using ast-grep.

1|Updated Jan 18, 2026
One-click install
npx skills add https://github.com/anntnzrb/agents --skill ast-grep-anntnzrb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/anntnzrb/agents/tree/main/assets/skills/ast-grep
Command: npx skills add https://github.com/anntnzrb/agents --skill ast-grep-anntnzrb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Read-only structural search with sg or ast-grep for AST-aware code discovery across large codebases, enabling quick pattern searches without modifying code.

Core Features & Use Cases

  • AST-aware search across languages using sg/ast-grep for structure-first exploration.
  • Pattern-driven discovery to locate usages, references, and code structures in real projects.
  • Use Case: Quickly locate all occurrences of a deprecated API across a monorepo without changing any files.

Quick Start

Use sg to search for a structural pattern in your codebase.

Frequently Asked Questions about ast-grep

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search for a code pattern across a large codebase without modifying files?

You can use ast-grep to perform read-only, AST-aware code search across large codebases to find structural patterns without modifying any files.

What is AST-aware structural search and how does it work?

AST-aware structural search uses tree-sitter to parse code into an abstract syntax tree, enabling structure-first pattern matching to locate usages and references beyond simple text matching.

Can I find all occurrences of a deprecated API in a monorepo using pattern matching?

Yes, ast-grep supports pattern-driven discovery to quickly locate all occurrences of a deprecated API or specific code structures across a monorepo using safe, non-destructive queries.

Does ast-grep work with tree-sitter for multi-language code exploration?

Yes, ast-grep is powered by tree-sitter to enable AST-aware structural search and pattern matching across multiple programming languages within large repositories.

What is the best way to locate code usages and references in real projects safely?

Using ast-grep provides a read-only, non-destructive approach with safe defaults to efficiently locate usages, references, and code structures in real projects without altering the source code.

Are there limitations when using static analysis for structural code search?

AST-aware static analysis is limited to read-only queries and structural pattern matching, meaning it locates code structures efficiently but does not modify, refactor, or execute the searched code.