Ast Grep

Use this skill when the user wants to search code structurally using AST patterns, perform linting, or rewrite code automatically across multiple files.

57 stars 5 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add javimosch/supercli --skill ast-grep
Manual install
git clone --depth 1 https://github.com/javimosch/supercli.git /tmp/supercli
mkdir -p ~/.claude/skills
cp -r /tmp/supercli/plugins/ast-grep/skills/quickstart ~/.claude/skills/ast-grep

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# ast-grep Plugin

AST-based code structural search, lint, and rewriting.

## Commands

### Search
- `ast-grep search run` — Search using AST pattern

### Rewrite
- `ast-grep rewrite run` — Rewrite code using pattern and replacement

### Lint
- `ast-grep lint run` — Run linting rules
- `ast-grep scan run` — Scan directory with rules

## Usage Examples
- "Find all usages of $A && $A() pattern in TypeScript"
- "Replace null coalescing patterns"
- "Lint the codebase for specific patterns"
- "Scan src directory for violations"

## Installation

```bash
npm install --global @ast-grep/cli
# or
cargo install ast-grep
# or
brew install ast-grep
```

## Examples

```bash
# Search for AST pattern
ast-grep --pattern 'const $X = $Y' --lang ts

# Rewrite code
ast-grep --pattern '$A && $A()' --lang ts --rewrite '$A?.()'

# Run lint
ast-grep lint

# Scan directory
ast-grep scan src/
```

## Key Features
- Pattern looks like real code
- Supports JS, TS, Python, Rust, Go, Java, etc.
- Use `$VAR` as wildcard for AST nodes
- YAML-based lint rules
-批量 code rewriting
Read the full skill on GitHub

Details

Skill name
ast-grep
Path
plugins/ast-grep/skills/quickstart/SKILL.md
License
MIT
Repo updated
2 November 2026

FAQ

What does the Ast Grep skill do?

Use this skill when the user wants to search code structurally using AST patterns, perform linting, or rewrite code automatically across multiple files.

How do I install the Ast Grep skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add javimosch/supercli --skill ast-grep. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Ast Grep popular?

It lives in javimosch/supercli, which has 57 GitHub stars and 5 forks, and is included in 1 curated skill list.

Related skills

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.