ast-grep

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps users find and analyze code based on its structure, not just text, enabling precise code queries that go beyond simple text search.

Core Features & Use Cases

  • Structural Code Search: Locate code patterns using Abstract Syntax Tree (AST) matching.
  • Complex Querying: Perform searches that require understanding code structure, like finding specific language constructs or code with particular AST characteristics.
  • Use Case: Find all asynchronous functions that do not have error handling, or locate all console.log statements within class methods.

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 find specific code patterns using structural analysis instead of text search?

Structural analysis locates code patterns by matching Abstract Syntax Tree (AST) structures rather than exact text. This allows you to find specific language constructs and perform complex queries based on how the code is structured.

Can I locate asynchronous functions that are missing error handling using AST patterns?

Yes, you can locate asynchronous functions missing error handling by querying AST patterns. This enables precise structural code search to identify specific language constructs that lack required try-catch blocks or await statements.

How do I write ast-grep rules from natural language to query my codebase?

You can write ast-grep rules by translating natural language queries into ast-grep rule syntax. This requires an understanding of AST structures to effectively perform complex code querying and precise pattern matching.

What is the best way to find all console.log statements located within class methods?

The best way to find console.log statements within class methods is using structural code search. This approach matches AST patterns to precisely locate specific code constructs nested inside class structures.

Do I need to understand AST structures to perform structural code search?

Yes, understanding AST structures and ast-grep rule syntax is required for effective code querying. This knowledge allows you to translate natural language queries into precise rules for structural code analysis.

How does structural code search differ from standard text search for refactoring?

Structural code search finds code based on its structural AST characteristics rather than just text, enabling precise pattern matching. This allows complex querying of specific language constructs for refactoring tasks that simple text search cannot achieve.