AGENT SKILL
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.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 57
- Forks
- 5
01 前言 Front Matter
- name
- ast-grep
- description
- Use this skill when the user wants to search code structurally using AST patterns, perform linting, or rewrite code automatically across multiple files.
03 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 rulesast-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
npm install --global @ast-grep/cli
# or
cargo install ast-grep
# or
brew install ast-grep
Examples
# 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
$VARas wildcard for AST nodes - YAML-based lint rules -批量 code rewriting
04 同仓库更多 Skills
sc-machin-mcp
暂无简介
★ 57
supercli.quickstart
SuperCLI capability router — discover and execute CLI commands through namespace.resource.action interface
★ 57
zzdoc
Use this skill to compile scdoc manpages with a fast Zig-based compiler.
★ 57
zx
Use this skill when the user wants to a tool for writing better scripts using node.js.
★ 57
zvm
Use this skill when the user wants to manage multiple Zig compiler versions.
★ 57
quickstart
暂无简介
★ 57