ast-grep

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

4|1|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/tentacle-pro/skills --skill ast-grep-tentacle-pro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/tentacle-pro/skills/tree/main/ast-grep
Command: npx skills add https://github.com/tentacle-pro/skills --skill ast-grep-tentacle-pro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Translates natural language queries into ast-grep rules for structural code search, enabling precise matches based on code structure rather than text.

Core Features & Use Cases

  • Convert natural language queries into ast-grep patterns and rules tailored to your target language.
  • Provide example code snippets, test rules, and debugging guidance to validate matches locally.
  • Support for refining complex queries with relational rules (inside/has) and metavariables for dynamic code patterns.

Quick Start

Describe the code search goal 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 convert natural language queries into AST search rules?

To convert natural language queries into AST search rules, describe your code search goal and the target language grammar to generate precise ast-grep patterns for structural code analysis.

What is the best way to search for specific code structures across different programming languages?

The best way to search for specific code structures across languages is using ast-grep rules to locate precise AST patterns and constructs based on code structure rather than plain text.

How do I test and debug ast-grep rules against sample code?

To test and debug ast-grep rules, provide example code snippets alongside your natural language query to validate matches locally and refine complex relational rules with metavariables.

Do I need to understand tree-sitter grammar to generate ast-grep patterns?

Understanding the target language grammar and ast-grep rule syntax is required to translate natural language queries into accurate structural code search patterns and dynamic metavariables.

Can I use relational rules to find nested code patterns inside other constructs?

You can use relational rules like inside and has alongside metavariables to refine complex queries and locate dynamic code patterns nested within other AST constructs.