ast-grep

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

6|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/archibate/archibate-skills --skill ast-grep-archibate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/archibate/archibate-skills/tree/main/skills/ast-grep
Command: npx skills add https://github.com/archibate/archibate-skills --skill ast-grep-archibate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill translates natural language code-search needs into ast-grep rule guidance so you can perform precise structural searches that plain text grep cannot achieve across large codebases.

Core Features & Use Cases

  • Rule authoring guidance: Step-by-step instructions for composing pattern, kind, relational, and composite YAML rules.
  • Testing and debugging: Techniques to validate rules with inline rules or rule files and inspect AST structure using debug-query modes.
  • Practical use cases: Locate async functions using await, find function calls with specific parameters, and detect functions missing error handling such as try-catch.

Quick Start

Translate the query 'find async functions without try-catch' into an ast-grep YAML rule and test it against a small sample file to verify matches.

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 code patterns structurally instead of using plain text grep?

Structural code search translates natural language queries into ast-grep YAML rules to find syntax constructs like async functions or missing error handling across large codebases, overcoming plain text grep limitations.

How do I write ast-grep YAML rules to find function calls with specific parameters?

Compose ast-grep YAML rules by combining pattern, kind, and relational directives to match function calls with specific parameters, then validate the structural search results using inline rules or rule files.

Can I use ast-grep to detect async functions missing try-catch error handling?

Yes, ast-grep detects async functions missing try-catch by composing relational and composite YAML rules that target language-specific tree-sitter node kinds to locate missing error handling constructs.

Does ast-grep structural search work with all programming languages?

ast-grep structural search applies to codebases across Tree-sitter-supported languages, requiring knowledge of language-specific node kinds to compose pattern, relational, and composite rules effectively.

How do I debug ast-grep rules when structural pattern matching is not working?

Debug ast-grep rules by inspecting the AST structure using debug-query modes to validate pattern, kind, and relational directives against sample files before running structural searches across large codebases.

What is the best way to find code constructs like missing error handling across a large codebase?

The best way to find missing error handling is using ast-grep structural search, which translates natural language code search needs into precise YAML rules for matching code patterns that plain text grep cannot achieve.