
Ast Grep
Use for ast-grep project setup, rule authoring, rule debugging, and structural search...
Install
npx skills add vinhnx/VTCode --skill ast-grep -g -a claude-code -y- Repository
- vinhnx/VTCode897
- Category
- Testing
- Updated
- 3d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Use for ast-grep project setup, rule authoring, rule debugging, and structural search workflows.
Ast-Grep
Use this skill for ast-grep project setup, rule authoring, rule debugging, and CLI workflows that go beyond a single structural query.
Routing
- Use
exec_commandfor ast-grep queries, project scans, rule tests, debug output, and rewrite previews. - Use
ast-grep scanfor project rules andast-grep testfor rule tests. - Use
ast-grep run --pattern=... --rewrite=... --json=compact --color=neverfor dry-run rewrite previews. Review every replacement before applying changes. - Use
ast-grep run --debug-querywhen a query matches an unexpected syntax node. - Use
--kindto match node kinds. Ast-grep supports ESQuery-style compound selectors and pseudo-selectors in supported releases. - Keep this skill read-only unless the user explicitly authorises applying a rewrite.
Quick Start
- In VT Code, prefer
vtcode dependencies install ast-grepbefore suggesting system package managers. - External install routes such as Homebrew, Cargo, npm, pip, MacPorts, or Nix are fallback options when the user explicitly wants a system-managed install.
- After installation, validate availability with
ast-grep --help. - On Linux, prefer the full
ast-grepbinary name oversgbecausesgmay already refer tosetgroups. - When running CLI patterns with shell metavariables like
$PROP, use single quotes so the shell does not expand them before ast-grep sees the pattern. - A good first rewrite example is optional chaining, for example rewriting
$PROP && $PROP()to$PROP?.().
Command Overview
ast-grep run: ad-hoc query execution and one-off rewrites.ast-grep scan: project rule scanning.ast-grep new: scaffold and rule generation.ast-grep test: rule-test execution.ast-grep lsp: editor integration via language server.


