ast-grep

Generate ast-grep rules from natural language queries for structural code search.

Updated Feb 18, 2026
One-click install
npx skills add https://github.com/zach-source/claude-plugins --skill ast-grep-zach-source
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/zach-source/claude-plugins/tree/main/plugins/devtools/skills/ast-grep
Command: npx skills add https://github.com/zach-source/claude-plugins --skill ast-grep-zach-source

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users perform precise code searches and analysis by translating natural language queries into ast-grep rules, overcoming the limitations of simple text-based searches.

Core Features & Use Cases

  • Structural Code Search: Find code patterns based on Abstract Syntax Tree (AST) structure, not just text.
  • Complex Querying: Locate specific language constructs, identify code with particular AST characteristics, and perform intricate code queries.
  • Use Case: Find all asynchronous functions in a JavaScript codebase that use await but do not have a try-catch block.

Quick Start

Use the ast-grep skill to find all JavaScript functions that contain an await keyword.

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 using natural language instead of regex?

Structural code search translates natural language queries into ast-grep rules to match Abstract Syntax Tree patterns. This allows precise code querying across codebases based on language constructs rather than simple text matching.

Can I find JavaScript async functions that use await but lack a try-catch block?

You can find JavaScript async functions missing a try-catch block by generating ast-grep rules from natural language. This complex querying locates specific language constructs with particular AST characteristics for advanced code analysis.

What is AST pattern matching for codebase refactoring?

AST pattern matching finds code by analyzing its structural syntax tree rather than raw text. It enables precise refactoring and complex code analysis by identifying specific language constructs across an entire codebase.

Does ast-grep work for identifying specific language constructs across different codebases?

Yes, ast-grep facilitates precise code querying for identifying specific language constructs and AST patterns across codebases. It supports advanced code analysis by leveraging Abstract Syntax Tree matching for complex pattern detection.

Why use AST-based code analysis over simple text-based search?

AST-based code analysis overcomes limitations of simple text-based searches by matching structural syntax tree patterns. This ensures precise code querying and accurate detection of complex language constructs during refactoring.