agent/skills/tools/grit/SKILL.md
Search and rewrite code with GritQL — declarative queries backed by tree-sitter. Use when refactoring across languages or applying AST transformations at scale.
npx skillsauth add knoopx/pi gritInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
grit)Searches and rewrites source code using a declarative query language backed by tree-sitter. Any valid code snippet in backticks is a pattern — no AST vocabulary required. Install: curl -fsSL https://docs.grit.io/install | bash or npm install --location=global @getgrit/cli.
Find matches structurally (whitespace-insensitive):
grit apply '`console.log($_)`' ./src/
Patterns match the AST structure — variations in formatting are handled automatically.
Replace patterns in-place:
# Replace console.log with winston
grit apply '`console.log($msg)` => `winston.log($msg)`' ./src/
# Delete matches by rewriting to dot
grit apply '`debugger;' => .' ./src/
Always verify with --dry-run first. Language-specific targeting:
grit apply -l ts '`console.log($_)`' ./src/ # TypeScript only
grit apply -l py 'def $_($$$args) -> $_:' ./src/ # Python
200+ built-in patterns available by name:
grit apply no_console_log # Remove console.log
grit apply react_to_hooks # Class components → hooks
grit list # List all available patterns
Browse patterns at github.com/biomejs/gritql-stdlib. Import remote patterns in .grit/grit.yaml:
patterns:
- name: github.com/getgrit/stdlib#no_dead_code
level: error
Store patterns in .grit/patterns/ as .md or .grit files, then run by name:
mkdir -p .grit/patterns
# Create .grit/patterns/use_winston.md with the pattern body
grit apply use_winston ./src/
grit check # Enforce as lint (fails on error/warn level patterns)
$lowercase_snake_case, anonymous is $_, spread is $...tools
Inform the user what is happening — skip passive lookups
development
Renders markdown to self-contained HTML with a custom dark stylesheet and opens in browser. Use when previewing markdown documents, generating styled HTML from README or report files.
testing
Programmatic hunk selection for Jujutsu — split, commit, or squash specific hunks without interactive prompts. Use when making partial commits or selective squashes.
content-media
Manage version control with Jujutsu (jj) — no staging area, immediate changes, smart rebasing. Use when navigating history, squashing, or pushing to Git remotes.