gritql

Perform AST-based code transformations to rename methods and migrate APIs.

8|2|Updated Jul 13, 2015
One-click install
npx skills add https://github.com/tstapler/dotfiles --skill gritql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gritql
Source: https://github.com/tstapler/dotfiles/tree/main/.claude/skills/gritql
Command: npx skills add https://github.com/tstapler/dotfiles --skill gritql

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

gritql helps developers perform AST-based multi-file code transformations safely, avoiding brittle text replacements and ensuring syntax correctness across files.

Core Features & Use Cases

  • AST-aware transformations across files
  • Rename methods/classes, migrate APIs, and modernize patterns
  • Preview-first workflow with gritql paired with ast-grep for search-then-transform

Quick Start

Preview a transformation by running gritql in dry-run mode and review the resulting changes before applying.

Frequently Asked Questions about gritql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely rename methods across multiple files without breaking syntax?

AST-based code transformation safely renames methods across multiple files by matching syntax tree patterns instead of text, ensuring syntax correctness. You preview all changes in dry-run mode before applying them to your codebase.

What is the best way to migrate APIs across a large codebase?

API migration across a large codebase is handled through AST-aware pattern matching that identifies usage and transforms it safely. A preview-first workflow lets you review all proposed changes before applying them.

How does AST pattern matching work for code refactoring?

AST pattern matching for code refactoring works by parsing code into abstract syntax trees and applying transformations to the tree structure. This avoids brittle text replacements and enforces syntax correctness across supported languages.

Can I preview code transformations before applying them to my files?

Previewing code transformations before applying them is a core requirement of this workflow. You run transformations in dry-run mode to review resulting changes, ensuring safe multi-file refactors before committing.

Does ast-grep work with gritql for search-then-transform workflows?

ast-grep works with gritql for search-then-transform workflows by pairing syntax-aware search with AST-based transformations. This combination enforces a preview step prior to applying transformations across files.

Why should I use AST transformations instead of find and replace for refactoring?

AST transformations avoid the limitations of find and replace by understanding code syntax structurally, preventing broken syntax from text replacements. They enforce preview-first workflows to safely modernize patterns across files.