ast-grep

Search codebases structurally using Abstract Syntax Tree patterns.

5|Updated Jun 22, 2026
One-click install
npx skills add https://github.com/namanchopra/branchwater --skill ast-grep-namanchopra
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep
Source: https://github.com/namanchopra/branchwater/tree/main/.claude/skills/ast-grep
Command: npx skills add https://github.com/namanchopra/branchwater --skill ast-grep-namanchopra

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @ast-grep/cli, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill solves the problem of performing complex, structural code search and analysis within large codebases. It enables users to search for code patterns, locate specific language constructs, and perform detailed code queries that go beyond simple text search.

Core Features & Use Cases

  • Structural Code Search: Uses Abstract Syntax Tree (AST) patterns to match code based on its structure.
  • Advanced Queries: Perform searches that require understanding code structure, like finding code patterns or locating specific language constructs.
  • Use Case: For instance, finding all asynchronous functions that do not have error handling or identifying all instances of console.log calls within class methods.

Quick Start

Use the ast-grep skill to find all functions that contain an 'await' expression using the command: ast-grep find-await.

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 specific code patterns using Abstract Syntax Trees?

Structural code search using Abstract Syntax Trees allows you to locate complex patterns and language constructs within codebases by matching code structure rather than simple text. This Skill performs AST analysis using engine-agnostic rule-based querying.

What is the best way to find all asynchronous functions missing error handling?

To find asynchronous functions missing error handling, you can use structural code search to locate specific language constructs. For example, use the ast-grep CLI tool to find all functions containing an 'await' expression.

Do I need the ast-grep CLI tool to perform structural code analysis?

Yes, you need the ast-grep CLI tool installed to perform structural code analysis. This Skill utilizes the CLI dependency to execute Abstract Syntax Tree pattern matching and rule-based querying within your codebase.

Can I locate specific language constructs like console.log calls within class methods?

Yes, you can locate specific language constructs like console.log calls within class methods using structural code search. This Skill employs Abstract Syntax Tree patterns to perform advanced queries that go beyond simple text search.

How does structural code search differ from simple text search?

Structural code search differs from simple text search by using Abstract Syntax Tree patterns to match code based on its structure. This enables advanced queries that understand code structure, allowing you to locate complex patterns and specific language constructs.