Ast Grep Skill — AI skill for Claude Code
LLM-neutral skill for AST-aware search and rewrite across 25 languages, wrapping ast-grep (sg) with offline pattern validation, two-pass writes, and per-OS install scripts.
How to install Ast Grep Skill
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open code-yeongyu/ast-grep-skill and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Ast Grep Skill does
LLM-neutral skill for AST-aware search and rewrite across 25 languages, wrapping ast-grep (sg) with offline pattern validation, two-pass writes, and per-OS install scripts.
Alternatives in AI
- Jcodemunch MCP — Cut AI token costs 95%+ on code exploration 2.6k ★
- Empryo — Empryo issue tracker + SoulForge (v2) 1.1k ★
- Humanize Ppt — AST-based outline director for human-centered AI presentation workflows 934 ★
README
ast-grep-skill
LLM-neutral skill for **AST-aware search and rewrite** across 25 languages. Wraps the [`ast-grep`](https://ast-grep.github.io/) (`sg`) CLI with offline pattern validation, the two-pass write trick, binary auto-resolution, and a per-OS installer.
Same shape as [`web-fetch`](https://github.com/code-yeongyu/web-fetch) and [`web-search`](https://github.com/code-yeongyu/web-search), packaged as a standalone skill that any Bash-capable agent (Claude Code, OpenCode, pi, hermes, openclaw) can load.
Install
git clone https://github.com/code-yeongyu/ast-grep-skill ~/.agents/skills/ast-grep
bash ~/.agents/skills/ast-grep/install.sh # installs the ast-grep binary
That is it. The wrapper script is single-file Python 3 stdlib; no `pip install` needed. The installer tries `brew` → `npm` → `cargo` → `pip` → `nix` → `mise` → GitHub release in priority order, picks the first that works, and falls back to a cached binary at `/bin/sg`.
Symlink for active development
ln -s /path/to/your/clone ~/.agents/skills/ast-grep
Other agents
- Claude Code / OpenCode: drop the directory under
~/.agents/skills/(or~/.config/opencode/skills/) and the skill auto-registers via thename+descriptioninSKILL.mdfrontmatter. - pi (
~/.senpi/agent): not apiextension — this is a skill. Pi consumes skills via~/.agents/skills/symlinks; the actualpi-ast-grepextension is at https://github.com/code-yeongyu/pi-extensions. - Direct CLI use:
python3 ~/.agents/skills/ast-grep/scripts/ast_grep_helper.py.
Usage
# Search by AST pattern (the helper validates patterns offline first)
python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
# Rewrite (dry-run preview by default)
python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/
# Apply the rewrite (two-pass: preview JSON + then --update-all)
python3 scripts/ast_gr
Related Skills
Semble Rs
Fast, AI-agent-native code search in Rust — hybrid BM25 + semantic, Tree-sitter AST chunking, dependency & imp
Go Surgeon
Deterministic Go code editing for LLM agents. AST-based CLI and MCP server that replaces Edit, Read, and Grep
Reporecall
Local codebase memory for Claude Code. Tree-sitter AST indexing (22 languages), hybrid keyword + vector search
Nutrient Agent Skill
Document processing with Nutrient DWS API: convert (PDF/DOCX/XLSX/PPTX/HTML/images), extract text/tables, OCR
Validate Skill
VALIDATE Skill - Critical validation agent for Claude Code & Codex. Catches AI systematic optimism by scoring
Prompt Architecture
Reference guide for designing production LLM prompt systems in this codebase. Covers the Two-Pass Gap Analysis
Related Agents
Ast Grep Surgeon
Structural code analysis and surgical refactoring specialist using ast-grep. Use PROACTIVELY for code search,
Ast Grep Runner
DEPRECATED — superseded by scripts/ast-grep-runner.sh
Ccxt PR Reviewer
End-to-end review of a CCXT pull request. Reads the diff, transpiles and builds in all six languages (TS/JS, P