Individual skill
ast-grep
Searches and rewrites code by AST shape across 25 languages. Use when the target is a syntax pattern (every call/class/import shaped like X, a codemod, a YAML rule) rather than literal text; for plain strings, comments, or filenames, use rg.
plugins/omo/skills/ast-grep/SKILL.md
Source commit 49104cf38aa10f0a55aabf33aa675118d2873fc1
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Network or broad shell
- Last checked
- Nov 3, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 3,889
- Repository last updated
- Nov 6, 2026
- License
- MIT
Observed agent integration: codex
- ai Repository topic
- ai-agents Repository topic
- claude Repository topic
- claude-code Repository topic
- cli Repository topic
- codex Repository topic
- developer-tools Repository topic
- lazy Repository topic
- oh-my-openagent Repository topic
- omo Repository topic
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 3,162 bytesLICENSEasset · 1,068 bytesREADME.mddoc · 7,791 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSKILL.mdcore · 13,371 bytesSOURCEasset · 125 bytesagents/openai.yamlasset · 43 bytesinstall.ps1runs · 7,384 bytesinstall.shruns · 7,663 bytesreferences/cli.mddoc · 7,273 bytesreferences/install.mddoc · 5,829 bytesreferences/patterns.mddoc · 5,538 bytesreferences/pitfalls.mddoc · 8,914 bytesreferences/recipes.mddoc · 7,870 bytesreferences/sgconfig.mddoc · 6,413 bytesreferences/yaml-rules.mddoc · 11,383 bytesscripts/ast_grep_helper.pyruns · 27,452 bytestests/smoke.ps1runs · 5,701 bytestests/smoke.shruns · 7,765 bytes
Read excerpt
# ast-grep
`sg` (also installed as `ast-grep`) is an **AST-aware search and rewrite tool** across 25 languages. It treats your pattern as code, parses it the same way it parses your project, and matches structurally. It is the right tool whenever your question depends on **code shape** rather than text bytes.
This skill ships a Python wrapper at `scripts/ast_grep_helper.py` and platform install scripts at `install.sh` (POSIX) and `install.ps1` (Windows). The helper adds offline pattern validation, the two-pass write trick, and binary auto-resolution. Use it as your default entry point.
---
## OmO native: the ast-grep MCP tools (fastest path, no CLI needed)
OmO native also registers a bundled ast-grep MCP server. Its three tools are **deferred**: they are absent from the resident tool list and activate automatically the first time you call them by name — no `tool_search` round trip needed.
- `mcp__ast_grep_search({ pattern, language, paths })` — AST-shape search, the MCP equivalent of `sg run -p`. Prefer this over shelling out to `sg` for one-off lookups: no install, no PATH issues.
- `mcp__ast_grep_rewrite({ pattern, rewrite, language, paths, apply })` — preview matches (`apply: false`, the default) or apply the rewrite (`apply: true`). Same two-pass discipline as `sg run -r`: preview first, then apply.