From ast-grep
Use when you need ast-grep structural search, linting, or safe codemod rewrites, especially for requests that mention ast-grep, sg, codemod, rule files, or syntax-aware edits instead of plain-text search.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ast-grep:ast-grepThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when the task benefits from AST-based search, linting, or rewrites instead of regex- or line-based editing.
Use this skill when the task benefits from AST-based search, linting, or rewrites instead of regex- or line-based editing.
ast-grep, sg, codemod, rule files, or syntax-aware edit work.rg/glob usage.reverse-prompt.systematic-debugging.test-driven-development.| Situation | Use this skill? | Route instead |
|---|---|---|
| "Author a lint rule for a structural pattern" | Yes | - |
| "Replace a JS API call pattern across all TS files safely" | Yes | - |
| "Find where this exact string appears" | No | direct rg search |
| "I have a failing test and do not know why" | No | systematic-debugging |
| "Before coding, rewrite my vague request into an executable brief" | No | reverse-prompt |
| "Implement feature X with failing test first" | No | test-driven-development |
Required before editing
Helpful if present
dist, generated code, vendored directories).Only investigate if encountered
references/command-patterns.md and constrain it by language/path.-r) or rule-file mode (--rule) and re-run preview.references/safety-and-review.md.ast-grep binary name in docs and generated commands; use sg only if local shell compatibility requires it.node skills/skill-authoring/scripts/validate-skill-library.mjs skills/ast-grep/SKILL.mdnode skills/skill-authoring/scripts/validate-skill-library.mjs## Reference files exists and is linked.Use ast-grep to rewrite obj.val && obj.val() to obj.val?.() in TypeScript, preview firstFind the exact string "obj.val && obj.val()" in this repository.Use ast-grep to search for \console.log($X)` in `src/` with `--lang ts` and return JSON output.`Use ast-grep to rewrite \var code = $PAT` to `let code = $PAT` in JavaScript after previewing matches.`Use ast-grep to rewrite \obj.val && obj.val()` to optional chaining in TypeScript after a narrow preview.`references/command-patterns.md - search/rewrite command templates and scoped usage patternsreferences/safety-and-review.md - review checklist, rollback flow, and failure-mode handlingassets/examples.md - trigger and near-miss prompt matrix for activation tuningscripts/scaffold-ast-grep-command.mjs - optional helper to scaffold portable ast-grep commandsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub matt-riley/lucky-hat --plugin ast-grep