lidge-jun/codexclaw / plugins/codexclaw/skills/ast-grep
cxc-ast-grep
VerifiedUse for AST search and codemods. Triggers: ast-grep, sg, function/call/class/import, empty catch, missing await, YAML rules.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 1.0 KB |
| SKILL.md | skill md | 5.0 KB |
| agents/openai.yaml | config | 152 B |
| references/install.md | markdown | 1.5 KB |
| references/patterns.md | markdown | 3.4 KB |
| scripts/ast_grep_helper.pyexecutable | script | 26.6 KB |
references/install.md
View on GitHub# Installing / provisioning `sg` (ast-grep)
The helper resolves the `sg` binary lazily and never assumes a global install.
## Resolution order
1. `CODEXCLAW_AST_GREP_SG_PATH` (explicit override; `OMO_AST_GREP_SG_PATH` fallback).
2. codexclaw runtime: `$CODEX_HOME/runtime/ast-grep/<os>-<arch>/sg`, then
`~/.codexclaw/runtime/ast-grep/<os>-<arch>/sg`.
3. A cached binary under this skill's `bin/`.
4. `PATH` (via `which`).
5. Homebrew defaults (`/opt/homebrew/bin/ast-grep`, `/opt/homebrew/bin/sg`).
## Lazy provisioning
Run the helper's `install` subcommand to provision on demand:
```
python3 scripts/ast_grep_helper.py install
```
It delegates to the platform install path and is idempotent — re-running when
`sg` is already present is a no-op. If provisioning fails, the helper prints a
clear hint (network, permissions, or unsupported platform) instead of crashing.
## Manual install options
- npm: `npm install -g @ast-grep/cli`
- Homebrew: `brew install ast-grep`
- Cargo: `cargo install ast-grep`
On Windows: download the binary from the ast-grep releases page or use
`winget install ast-grep`.
After installing, confirm with:
```
python3 scripts/ast_grep_helper.py doctor
```
which reports the resolved binary path and version, or a missing-binary hint.
## codexclaw doctor
`cxc doctor` includes an `ast-grep` status line (provisioned / PATH fallback /
missing / provisioning failed) with the binary path and version when available,
so plugin health surfaces the runtime state without a separate command.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |