ast-grep

Convert natural language queries into ast-grep rules for structural code search.

2|Updated Nov 16, 2025
One-click install
npx skills add https://github.com/lwyBZss8924d/ReCodeAgent --skill ast-grep-lwybzss8924d
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/lwyBZss8924d/ReCodeAgent/tree/main/.agents/skills/ast-grep
Command: npx skills add https://github.com/lwyBZss8924d/ReCodeAgent --skill ast-grep-lwybzss8924d

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Structural code search and analysis using AST patterns to find constructs that text search misses.

Core Features & Use Cases

  • Translate natural language queries into ast-grep rules for AST-based searches across codebases.
  • Provide guidance on crafting rules using pattern, kind, inside, has, and composites.
  • Use metatvariables to capture dynamic parts and perform precise matches across languages.

Quick Start

Provide a description of the code pattern you want to find, and I will generate an ast-grep rule to locate matches in your project.

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 structural code patterns instead of plain text?

Structural code search uses AST patterns to find specific code constructs that plain text search misses. By translating natural language queries into ast-grep rules, you locate precise matches across codebases.

What is the best way to convert natural language queries into AST-based rules?

You can convert natural language queries into AST-based rules by providing a description of the code pattern. The system generates an ast-grep rule to locate corresponding matches in your project.

Can I use metavariables to capture dynamic parts during code analysis?

Metavariables capture dynamic code parts during AST pattern matching. They enable precise matches across multiple languages by binding specific structural elements within your generated ast-grep rules.

How do relational and composite rules work for tree-sitter code search?

Relational and composite rules combine structural constraints for tree-sitter code search using pattern, kind, inside, and has operators. They validate complex language constructs across codebases.

Does AST-based code search work across multiple programming languages?

AST-based code search works across multiple programming languages. It applies rules to debug complex language constructs and validate matches using tree-sitter syntax across your codebase.