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.

by code-yeongyu 69k GitHub stars Other Updated Sep 21, 2026
↑ GrowingActive Workflow CodexCursorOpenCode ⚠ No license
ast-grep skill by code-yeongyu
ast-grep — Workflow skill by code-yeongyu

Overview

ast-grep is an open-source workflow skill for Claude Code and compatible agents, published by code-yeongyu. Its author describes it as: “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, comment…”. The project has 69k stars on GitHub and ships custom license terms, so review them before reuse. Add it to your setup with `git clone https://github.com/code-yeongyu/oh-my-openagent ~/.claude/skills/ast-grep`.

What ast-grep does

`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.

What’s inside

The SKILL.md for ast-grep is organised into these sections:

  • OmO native: the ast-grep MCP tools (fastest path, no CLI needed)
  • When to use this skill
  • Three things the agent must internalize
  • 1. ast-grep is NOT regex
  • 2. Patterns must be valid code
  • 3. --update-all and --json are mutually exclusive (silently)
  • The helper script — scripts/astgrephelper.py
  • search — find all matches of a pattern
  • replace — rewrite by pattern, dry-run by default
  • scan — run YAML rules
  • validate — offline pattern check (no sg call)
  • langs / doctor / install

Installation

Add ast-grep to your agent with:

git clone https://github.com/code-yeongyu/oh-my-openagent ~/.claude/skills/ast-grep

Review a skill’s source before installing it — skills can instruct your agent to run commands. This command comes from the skill’s public repository, which is the source of truth for setup steps. New to skills? Read how to install Claude Code skills.

Supported agents

  • Codex — declared in the repository topics
  • Cursor — declared in the repository topics
  • OpenCode — declared in the repository topics

License

code-yeongyu has not declared a standard open-source license for this repository (Other). Confirm the terms with the author before reusing it.

Strengths

  • Ships in code-yeongyu/oh-my-openagent, an established project with 69,248 GitHub stars
  • Works with Codex, Cursor, OpenCode
  • Actively maintained — repository updated in the last 30 days
  • Its repository gained 2,357 GitHub stars over the last 52 days

Things to check

  • No license declared — confirm terms with the author before reuse

Author

code-yeongyu 49 skills in the catalog · GitHub profile ↗
View skills

Topics

Need a skill like this, tailored to your team?Build a custom skill →

Frequently asked questions

What does ast-grep do?
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.
How do I install ast-grep?
Run git clone https://github.com/code-yeongyu/oh-my-openagent ~/.claude/skills/ast-grep in your agent, then reload your skills. Review the source at https://github.com/code-yeongyu/oh-my-openagent before installing.
Is ast-grep free to use?
ast-grep is publicly available on GitHub, but code-yeongyu has not declared a standard open-source license (Other). Confirm the terms with the author before reusing it.
Which agents does ast-grep work with?
ast-grep lists Codex, Cursor, and OpenCode — named in its SKILL.md, its plugin marketplace or its repository topics. Skills use the portable SKILL.md format, so other agents that read that format may load it too.
Where does ast-grep come from?
ast-grep ships inside code-yeongyu/oh-my-openagent, a repository that contains 49 catalogued skills in total. The repository's 69,248 GitHub stars apply to that whole collection, not to this skill on its own.

Compare HEAD with the latest published npm versions and list all unpublished changes by release layer. Triggers: unpublished changes, changelog, what changed, whats new.

↑ GrowingActive CodexCursorOpenCode
69k GitHub stars Other Updated Sep 21, 2026 Free

Easter egg command - about oh-my-opencode. Triggers: omomomo, about, easter egg.

↑ GrowingActive CodexCursorOpenCode
69k GitHub stars Other Updated Sep 21, 2026 Free

Nuclear-grade 12-agent pre-publish release gate. Runs /get-unpublished-changes to detect all changes since last npm release, spawns up to 10 ultrabrain agents for deep per-change analysis, invokes /review-work (orchestrator manual QA plus one gate reviewer) for holistic review, and 1 oracle for overall release synthesis. Runs ONLY when the user explicitly asks for a pre-publish review — a plain publish/release request MUST NOT trigger this; /publish ships directly. Triggers: 'pre-publish review', 'review before publish', 'release review', 'pre-release review', 'ready to publish?', 'can I publish?', 'pre-publish', 'safe to publish', 'publishing review', 'pre-publish check'.

↑ GrowingActive CodexCursorOpenCode
69k GitHub stars Other Updated Sep 21, 2026 Free

Publish oh-my-opencode to npm by triggering the GitHub Actions publish workflow and verifying its artifacts. Ship-only: never runs pre-publish-review or re-reviews merged code unless the user explicitly asks. Argument: <patch|minor|major|explicit-semver>. Triggers: publish, release, deploy, npm publish.

↑ GrowingActive CodexCursorOpenCode
69k GitHub stars Other Updated Sep 21, 2026 Free

Remove unused code from this project with ultrawork mode, LSP-verified safety, atomic commits. Triggers: remove dead code, dead code, cleanup, remove unused.

↑ GrowingActive CodexCursorOpenCode
69k GitHub stars Other Updated Sep 21, 2026 Free