ast-grep-find

Search and refactor code using Abstract Syntax Tree patterns across languages.

8|1|Updated Jan 4, 2026
One-click install
npx skills add https://github.com/scooter-lacroix/Maestro --skill ast-grep-find-scooter-lacroix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep-find
Source: https://github.com/scooter-lacroix/Maestro/tree/main/maestro/skills/analysis/ast-grep-find
Command: npx skills add https://github.com/scooter-lacroix/Maestro --skill ast-grep-find-scooter-lacroix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of finding and modifying code based on its structure rather than just text patterns, enabling precise refactoring and code analysis.

Core Features & Use Cases

  • Structural Code Search: Locate code patterns like function calls, imports, and class definitions, ignoring comments and strings.
  • Precise Refactoring: Safely rename variables, functions, or entire code blocks across a codebase.
  • Use Case: Quickly find all instances of a specific API call in a large Python project and replace it with a new, recommended alternative.

Quick Start

Use the ast-grep-find skill to search for all Python function definitions in the current directory.

Frequently Asked Questions about ast-grep-find

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

FAQPage Schema
How do I find and replace a specific API call in a Python codebase?

AST-based code search locates specific API calls by analyzing code structure rather than text, enabling precise refactoring. You can safely find all instances of an API call in Python and replace it with an alternative across your project.

What is AST-based code search and how does it differ from regular text search?

AST-based code search identifies code patterns like function calls and imports by parsing the Abstract Syntax Tree, ignoring comments and strings. This allows for precise structural matching and code modifications that regular text search cannot achieve.

Can I use ast-grep for refactoring JavaScript and Python projects?

Yes, ast-grep performs AST-based code searching and refactoring across multiple programming languages including JavaScript and Python. It supports advanced pattern matching syntax to safely rename variables, functions, or entire code blocks.

Do I need an active server to run ast-grep-find?

Yes, you need an active ast-grep server for operation. The skill relies on this server to perform Abstract Syntax Tree based code searching and execute precise refactoring modifications across your codebase.

How do I locate all function definitions in a directory without matching text inside strings?

AST-based code search locates function definitions by parsing the Abstract Syntax Tree, automatically ignoring comments and strings. This ensures you find actual code structures rather than coincidental text matches within your directory.