A Claude Code plugin marketplace containing the ast-grep skill for powerful structural code search using Abstract Syntax Tree (AST) patterns. Search your codebase based on code structure rather than just text matching.
> /plugin marketplace add ast-grep/agent-skill> /plugin install ast-grep@ast-grep-marketplace
Repo: ast-grep/agent-skill
What's inside
A Claude Code plugin marketplace containing the ast-grep skill for powerful structural code search using Abstract Syntax Tree (AST) patterns. Search your codebase based on code structure rather than just text matching.
This is a Claude Code plugin marketplace that provides the ast-grep plugin. The plugin includes a skill that teaches Claude how to write and use ast-grep rules to perform advanced code searches. Unlike traditional text-based search (grep, ripgrep), ast-grep understands the structure of your code, allowing you to find patterns like:
You need to have ast-grep installed on your system:
# macOS
brew install ast-grep
# npm
npm install -g @ast-grep/cli
# cargo
cargo install ast-grep
Verify installation:
ast-grep --version
npx skills add ast-grep/agent-skill
/plugin marketplace add ast-grep/agent-skill
/plugin install ast-grep
/plugin install activates the plugin in the running session, reporting Installed ast-grep. Plugin is now active., so no restart is needed.
Run /plugin to confirm it is listed.
If you're developing or testing locally:
# Clone the repository
git clone https://github.com/ast-grep/agent-skill.git /path/to/local-marketplace
# Add as local marketplace
/plugin marketplace add /path/to/local-marketplace
# Install the plugin
/plugin install ast-grep
Once installed, ask Claude to search your code using structural patterns.
Installing the skill makes it discovered, not preferred. Claude Code loads it and matches its description against your query, but on any given search it is also holding a text-search tool that needs no setup, so it often takes that instead. Naming ast-grep or structural search ("Use ast-grep to find...") invokes the skill reliably.
To get that preference without repeating it every query, state it once in your AGENTS.md or CLAUDE.md:
You are operating in an environment where `ast-grep` is installed.
For any code search that requires understanding of syntax or code structure, you should default to using `ast-grep --lang [language] -p '<pattern>'`.
Adjust the `--lang` flag as needed for the specific programming language.
Avoid using text-only search tools unless a plain-text search is explicitly requested.
See Using ast-grep with AI Tools for more on prompting, including feeding the docs to an agent and the MCP server.
Find async functions with await:
Find all async functions in this project that use await
Find missing error handling:
Show me async functions that don't have try-catch blocks
Find specific function calls:
Find all places where we call console.log with more than one argument
Find code in specific contexts:
Find all setState calls inside useEffect hooks
When you ask Claude to search for code patterns:
ast-grep supports many programming languages including:
$VAR to match any expression, statement, or identifierWhile Claude will handle most use cases automatically, you can also use ast-grep directly:
# Simple pattern search
ast-grep run --pattern 'console.log($ARG)' --lang javascript .
# Complex rule-based search
ast-grep scan --inline-rules "id: my-rule
language: javascript
rule:
kind: function_declaration
has:
pattern: await \$EXPR
stopBy: end" .
If a search isn't working as expected, ask Claude to:
A zero-match run exits successfully, so "no results" and "wrong pattern" look identical. Two things help when a pattern is the suspect:
llms-full.txt, the whole ast-grep documentation as one file, into the agent's context so it stops guessing at rule syntax.ast-grep-mcp to let the agent dump the AST and test a pattern against a snippet, iterating instead of committing to one guess.This is a Claude Code plugin marketplace repository with the following structure:
agent-skill/
├── .claude-plugin/
│ └── marketplace.json # Marketplace manifest
├── ast-grep/ # ast-grep plugin
│ ├── .claude-plugin/
│ │ └── plugin.json # Plugin manifest
│ └── skills/
│ ├── ast-grep/
│ │ ├── SKILL.md # Skill instructions for Claude
│ │ └── references/
│ │ └── rule_reference.md # ast-grep rule documentation
│ └── outline/
│ └── SKILL.md # Structural codebase map skill
└── README.md # This file
.claude-plugin/marketplace.json: Marketplace manifest defining available pluginsast-grep/.claude-plugin/plugin.json: Plugin manifest for the ast-grep pluginast-grep/skills/ast-grep/SKILL.md: Main skill instructions that Claude usesast-grep/skills/ast-grep/references/: Supporting documentation and reference materialsast-grep/skills/outline/SKILL.md: Cheap structural map of a codebase, for exploring before reading full sourceClaude isn't using the skill:
ast-grep --version)No results found:
Unexpected results:
To improve this skill:
SKILL.md to update Claude's instructionsreferences/ directoryThis skill follows ast-grep's MIT license for any included documentation or examples.
For issues with:
FAQ
agent-skill is a Claude Code plugin with 2 hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. It includes ast-grep, outline. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it