ast-grep-explore

Search codebases using AST patterns to reveal structural code relationships.

1|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/IndianBoy42/dot-opencode --skill ast-grep-explore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ast-grep-explore
Source: https://github.com/IndianBoy42/dot-opencode/tree/main/skills/ast-grep-explorer
Command: npx skills add https://github.com/IndianBoy42/dot-opencode --skill ast-grep-explore

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Large codebases often defy efficient understanding using only text-based search. ast-grep-explore provides AST-pattern based exploration to locate structural constructs, relationships, and patterns across files, enabling precise code insight without manual pattern guessing.

Core Features & Use Cases

  • Structural search: Match code constructs by syntax-tree patterns, enabling language-aware queries across projects.
  • Architecture and API tracing: Reveal class hierarchies, module boundaries, and how libraries and APIs are used throughout the codebase.
  • Pattern discovery and quality insight: Identify recurring constructs and potential refactoring targets for consistency and quality improvements.

Quick Start

Provide an AST pattern and run the explorer to locate matching code structures across your repository.

Frequently Asked Questions about ast-grep-explore

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

FAQPage Schema
How do I search for code structures across files instead of plain text?

You can search for code structures across files using AST patterns. This approach matches syntax-tree constructs rather than exact text, enabling language-aware queries to locate structural patterns and relationships across large repositories.

What is AST-based code analysis and when do I need it for my repository?

AST-based code analysis parses syntax trees to find structural constructs and code relationships. You need it when text-based search fails to reveal class hierarchies, module boundaries, and API usage patterns across a large codebase.

Can I trace API usage and architecture patterns across a large codebase?

Yes, you can trace API usage and architecture patterns across a large codebase. By applying AST-pattern matching, the tool reveals class hierarchies, module boundaries, and how libraries are used throughout the repository.

Do I need to specify a programming language for AST structural search?

No, you do not need to manually specify a programming language. The AST-pattern explorer auto-detects languages to parse patterns and apply structural matching across the files in your codebase.

How do I find recurring code patterns for refactoring targets?

Find recurring code patterns for refactoring by running the explorer with an AST pattern. This identifies repeating constructs and potential quality improvements, enabling structural consistency checks across your project.

What are the limitations of text-based search for code discovery?

Text-based search limitations include failing to capture syntax and structural relationships. AST-pattern exploration overcomes this by matching syntax-tree patterns, enabling precise code discovery and architecture analysis without guessing patterns.