ast-grep

Analyze and transform code patterns using the ast-grep engine.

12|Updated May 27, 2026
One-click install
npx skills add https://github.com/everruns/yolop --skill ast-grep-everruns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/everruns/yolop/tree/main/src/bundled/system-skills/ast-grep
Command: npx skills add https://github.com/everruns/yolop --skill ast-grep-everruns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the difficulty of performing precise, shape-aware code searches and refactors that standard text-based grep tools cannot handle, such as matching specific function call patterns or complex structural declarations.

Core Features & Use Cases

  • Structural Search: Find code based on its abstract syntax tree (AST) rather than raw text, allowing you to ignore comments or formatting variations.
  • Automated Refactoring: Safely rewrite code patterns across an entire repository using pattern-based replacement templates.
  • Use Case: Use this to find all instances of a specific function call across a large codebase or to modernize deprecated API usage by replacing old method signatures with new ones globally.

Quick Start

Use the ast-grep skill to find all instances of the connect method called on any receiver in the current rust codebase.

Frequently Asked Questions about ast-grep

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

FAQPage Schema
How do I perform structural code search instead of plain text matching?

Structural code search parses source code into abstract syntax tree (AST) nodes to identify specific syntax patterns, ignoring formatting variations and comments. This allows precise matching of function call shapes or complex declarations.

Can I automate code refactoring across a large repository safely?

Automated refactoring uses pattern-based replacement templates to safely rewrite code patterns globally. You can modernize deprecated APIs by replacing old method signatures with new ones across an entire repository.

What programming languages does AST-based code search support?

AST-based code search supports multiple programming languages including Rust, Python, and TypeScript. The integrated engine parses source code from these languages into AST nodes for accurate structural matching.

Why use structural code search over standard grep tools?

Structural code search is shape-aware, overcoming standard text-based grep limitations. It matches specific function call patterns or complex structural declarations accurately, ignoring formatting variations and comments.

How do I find all instances of a specific method call across a codebase?

To find all instances of a method call, use structural search to match the receiver and method name pattern. This targets the specific function call syntax across the codebase, regardless of variable names.

Does AST refactoring require a specific binary or environment setup?

AST refactoring requires an integrated ast-grep binary to parse source code into AST nodes. This binary is necessary for the engine to accurately identify and modify specific syntax patterns.