comment-checker
Use when Codex needs to understand or respond to automatic comment-checker feedback emitted after an edit-like PostToolUse hook.
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.
$ npx -y skills add code-yeongyu/oh-my-opencode --skill ast-grep --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/ast-grepContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
name: ast-grep description: "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."
`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 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.
Same pattern language as the CLI: `$VAR` matches one AST node, `$$$VAR` matches zero or more, and the pattern is code, not regex. `paths` accepts a file or directory list; `language` is required for patterns that are ambiguous across languages.
---
Use it whenever the user's question is about **code structure**, not bytes:
Switch to plain `grep` / `rg` when the question is text-shaped (string literal contents, comments, license headers, file names, cross-language regex). When in doubt, ask: "does the answer depend on the language's syntax tree, or just on the file's bytes?" If the former, ast-grep. If the latter, grep.
---
The wildcards are `$VAR` (one AST node) and `$$$` (zero or more nodes). Regex syntax fails silently:
| You wrote | What ast-grep saw | What you wanted | |---|---|---| | `foo\|bar` | bitwise-or of `foo` and `bar` | run two separate searches | | `.*foo` | not parseable | `$$$ foo` (if `$$$` is a list of nodes) or use `rg` | | `\w+` | not parseable | `$VAR` to capture any identifier | | `[a-z]` | character class, not parseable | switch to `rg` |
The full anti-pattern table is in `references/pitfalls.md` §1. The helper's `validate` subcommand catches these mechanically — call it before debugging "no matches" by hand.
The pattern itself must parse. `def $FN($$$):` fails because the trailing `:` makes it incomplete; use `def $FN($$$)`. `function $NAME` without params/body fails; use `function $NAME($$$) { $$$ }`. Full table per language in `references/pitfalls.md` §2.
This is the single biggest gotcha when scripting. `sg run -p P -r R --json --update-all` returns the JSON but **does not mutate files**. To both preview AND apply, run **two passes**:
sg run -p P -r R --json=compact . # pass 1: see what would change sg run -p P -r R --update-all . # pass 2: actually apply
The helper does this automatically when you call `replace --apply`. Read `references/pitfalls.md` §9.
---
A single-file Python 3 stdlib wrapper. Same on every OS. The agent's default entry point.
python3 scripts/ast_grep_helper.py search 'console.log($MSG)' --lang ts src/
Validates the pattern offline first. If the pattern looks like regex (`\w`, `.*`, `|`, etc.) the helper exits with a hint and never calls `sg` — saves a round-trip. Pass `--force` to skip validation.
Flags:
# Dry-run preview (default — no files mutated) python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ # Actually apply python3 scripts/ast_grep_helper.py replace 'console.log($MSG)' 'logger.info($MSG)' --lang ts src/ --apply
The helper: 1. Validates both `pattern` and `rewrite` for hint-detectable mistakes. 2. Runs pass 1 with `--json=compact` to collect matches and show a preview. 3. If `--apply` is set, runs pass 2 with `--update-all` to mutate files.
# Discover sgconfig.yml from cwd and run all rules python3 scripts/ast_grep_helper.py scan src/ # Run a single rule file python3 scripts/ast_grep_helper.py scan -r rules/no-console.yml src/ # Apply auto-fixes python3 scripts/ast_grep_helper.py scan -U src/ # CI-friendly GitHub annotations python3 scripts/ast_grep_helper.py scan --report-style short src/
You're juggling Claude Code, Codex, and random OSS models. Configuring workflows. Debugging agents. We did the work. Tested everything. Kept what actually shipped. Install oh-my-openagent. Type ultrawork. Done.
Repo: code-yeongyu/oh-my-opencode
Use when Codex needs to understand or respond to automatic comment-checker feedback emitted after an edit-like PostToolUse hook.
Contribute a verified bug fix for LazyCodex, lazycodex-ai, omo-codex, bundled Codex skills, or upstream Codex CLI bugs. Opens a fork PR only for upstream…
Diagnose LazyCodex and Codex CLI installation health against the latest sources. Use whenever the user asks for a doctor or health check, says LazyCodex,…
Create a high-signal bug issue or PR in the repo that owns the defect. Use this whenever the user asks to report, file, open, or triage a LazyCodex,…
Use when Codex needs language-server diagnostics, definitions, references, symbols, or rename safety checks in the current workspace.
Use when the user asks about Codex Rules behavior, injected project rules, supported rule file locations, matching, or environment configuration.