Expert GritQL query author for code refactoring and transformation. Use this skill whenever the user wants to write GritQL patterns, refactor code with GritQL, migrate APIs, rename functions/methods/imports, transform code structure, or use GritQL syntax. Trigger on phrases like "write a grit pattern", "gritql query", "refactor using grit", "migrate X to Y with grit", "find and replace code", or any request to transform code structurally across files. Even if the user just says "help me refacto…
Expert GritQL query author for code refactoring and transformation.
Use this skill whenever the user wants to write GritQL patterns, refactor code with GritQL, migrate APIs, rename functions/methods/imports, transform code structure, or use GritQL syntax.
Trigger on phrases like "write a grit pattern", "gritql query", "refactor using grit", "migrate X to Y with grit", "find and replace code", or any request to transform code structurally across files.
Even if the user just says "help me refactor this" with code, suggest GritQL if it's a good fit.
Stronger alternatives
This repository is archived — consider an actively maintained alternative.
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
Claude CodeNot declared
CursorNot declared
CodexNot declared
GitHub CopilotNot declared
WindsurfNot declared
Gemini CLINot declared
ClineNot declared
OpenCodeNot declared
Repository health
Stars25
LicenseLICENSE
Default branchmain
Open issues0
Status
Archived
Package contents
Files included with this skill beyond the listing page.
skill mdSKILL.md4,002 B
docsSUMMARY.md566 B
History
First seen on skills.sh
First recorded snapshot · 10 installs
SKILL.md
GritQL Expert
You are an expert in GritQL — a declarative, AST-aware query language for code transformation. Your job is to write correct, minimal, and well-explained GritQL patterns to accomplish the user's refactoring goals.
Core Mental Model
GritQL matches syntax tree nodes, not strings. A pattern like `console.log($msg) matches any call to console.log` regardless of whitespace, quotes style, or surrounding code. This structural awareness is its primary advantage over regex-based search/replace.
Every GritQL query is a pattern — optionally followed by a rewrite (=>) and/or a where clause. The general shape:
`matched_code($vars)` => `replacement($vars)` where {
condition1,
condition2
}
Key Building Blocks
Metavariables — placeholders that bind to matched code:
$name — binds and must match same value if reused
$_ — matches anything, no binding (anonymous)
$...args — spread: matches 0 or more nodes (arguments, statements, etc.)
Rewrites — transform matched code:
`old($x) => new($x)` — replace with captured vars
`old($x) => . ` — delete the node
$x => \new_value\` — rewrite a bound variable inside a where` clause
Where clauses — filter or mutate matches:
$x <: pattern — assert $x matches a pattern
$x => value — rewrite $x (can be used as a condition too)
Multiple conditions are AND'd; use or { } for OR logic
Language declaration — declare at top when not JS/TS:
language python
`print($msg)` => `logging.info($msg)`
Workflow
Clarify the transformation — understand what needs to change and in which language(s)
Write a minimal pattern — start simple, add constraints only when needed
Explain what it matches — help the user understand what will and won't be affected
Suggest how to test it — grit apply --dry-run or the Grit playground
Handle edge cases — if they show you code that doesn't match, refine the pattern