ast-grep

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

6|1|Updated Nov 23, 2023
One-click install
npx skills add https://github.com/gmcabrita/dotfiles --skill ast-grep-gmcabrita
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/gmcabrita/dotfiles/tree/main/.agents/skills/ast-grep
Command: npx skills add https://github.com/gmcabrita/dotfiles --skill ast-grep-gmcabrita

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Translating natural language queries into ast-grep rules enables precise, AST-based code search and analysis, allowing developers to find patterns that text-based searches miss.

Core Features & Use Cases

  • Translate natural language requests into AST pattern rules to search large codebases.
  • Provide example code snippets and iterative rule refinement workflows for debugging.
  • Support multi-language codebases and complex structural queries (inside, has, precedes, follows) using YAML rules.

Quick Start

Create a simple rule targeting async functions with await and test it on a small sample file.

Frequently Asked Questions about ast-grep

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

FAQPage Schema
How do I translate natural language queries into ast-grep rules for structural code search?

AST-based code search translates natural language queries into YAML rules to locate specific language constructs across large codebases. This allows developers to find structural patterns that text-based searches miss.

How do I search for specific code patterns using AST structure across multiple languages?

You can search for specific code patterns using AST structure by generating correctly formed YAML rules. These rules support complex structural queries like inside, has, precedes, and follows across multi-language codebases.

What is the best way to find specific language constructs in a large codebase that text search misses?

The best way to find specific language constructs is using AST-based code search. It translates natural language requests into structural pattern rules, enabling precise matching of code syntax and formatting.

Does ast-grep support multi-language structural queries for debugging complex code patterns?

Yes, ast-grep supports multi-language structural queries for debugging complex code patterns. It provides iterative rule refinement workflows and relies on the ast-grep CLI for validation and testing across different languages.

How do I debug and validate AST pattern rules generated from natural language?

To debug and validate AST pattern rules, use the ast-grep CLI on small sample files. The workflow involves iterative rule refinement, applying example code snippets to ensure the correctly formed YAML rules match the intended structure.