En

agent-skill

A Claude plugin that enables AI-powered structured code search using ast-grep.

Install & Use

Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:

Help me install this AI Skill: agent-skill.
It is used for: A Claude plugin that enables AI-powered structured code search using ast-grep.
Full Skill content: https://321skill.com/skills/agent-skill-ast-grep/raw/index.md
Read that page and install it.

The prompt includes a link to the full Skill content. You can also view the full content.

This Skill addresses the limitation of traditional text-based search tools in understanding code structure. It empowers Claude to comprehend and generate ast-grep rules, performing advanced searches based on Abstract Syntax Trees (AST) across a codebase—such as finding all async functions lacking error handling or locating React hooks used in specific contexts.

Usage is straightforward: after installation, simply ask Claude in Claude Code for a code-structure-based search request, like “find all functions with more than three parameters” or “search for console.log calls inside class methods.” Claude will analyze your intent, automatically generate and test the corresponding ast-grep rules, then execute the search across the entire project and return the results.

It is particularly useful for developers who need to deeply analyze or refactor large, complex codebases, especially front-end, back-end, and full-stack developers. When code logic is intricate, text search struggles to pinpoint patterns accurately, or when batch code review for compliance is required, this Skill significantly boosts efficiency.

Before use, ensure the ast-grep CLI tool is installed on your system. Currently, Claude Code cannot automatically trigger this Skill in all applicable scenarios, so you may sometimes need to explicitly instruct it in your query, e.g., “Use ast-grep to find...”.

Key Features

Unlike pure text-matching search tools (e.g., grep), it performs structure-aware searches based on the code's Abstract Syntax Tree, enabling precise matching of logical patterns like “function definitions” or “conditional statement blocks.” By leveraging Claude to intelligently generate and validate search rules, it lowers the barrier to writing complex AST query syntax directly.

Limitations

Not suitable for simple text lookups or instant searches in projects where ast-grep is not installed.

FAQ

What's the difference between ast-grep and regular grep?

ast-grep searches based on code structure (AST), understanding programming logic (e.g., finding function definitions), whereas grep only performs text matching.

Do I need to learn ast-grep's rule syntax in advance?

No, Claude will automatically generate and test search rules based on your natural language description.

Installation guide for AI assistants

If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:

Visit https://321skill.com/skills/agent-skill-ast-grep/raw/index.md to read the original Skill definition (Markdown format) for agent-skill, and install it according to the instructions.