gritql

Generate GritQL patterns for AST-based code transformations.

25|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/peterfox/agent-skills --skill gritql-peterfox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gritql
Source: https://github.com/peterfox/agent-skills/tree/main/gritql
Command: npx skills add https://github.com/peterfox/agent-skills --skill gritql-peterfox

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

GritQL Expert provides guidance and ready-to-run patterns for AST-based code transformations, enabling safe, precise refactors with minimal effort.

Core Features & Use Cases

  • Write structural patterns that match syntax trees rather than raw code strings
  • Create reusable templates for common refactors (API migrations, imports rewrites, function renames) across languages
  • Explore best practices and real-world examples for safe multi-file and polyglot transformations

Quick Start

Specify the code change you want, and I'll generate a minimal GritQL pattern to apply it.

Frequently Asked Questions about gritql

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

FAQPage Schema
How do I write AST-based code refactoring patterns for API migrations?

You write AST-based code refactoring patterns by defining structural rules that match syntax trees rather than raw text strings, enabling precise API migrations through reusable templates. GritQL patterns target syntax trees instead of raw code strings to ensure precise, safe AST-based transformations.

What is the best way to automate function renames across multiple programming languages?

The best way to automate function renames across multiple programming languages is using multilingual structural pattern matching. GritQL provides polyglot snippets and AST-based templates to execute safe cross-language refactors without relying on fragile text replacements.

Can I use metavariables and where clauses for structural code transformations?

Yes, you can use metavariables and where clauses for structural code transformations. GritQL patterns support metavariables for dynamic syntax binding and where clauses to apply conditional logic, ensuring AST-based transformations match only the intended structural conditions.

Does pattern matching work for polyglot snippets in multi-file refactors?

Pattern matching works for polyglot snippets in multi-file refactors by applying structural AST transformations across different languages. GritQL supports polyglot snippets and bubble scope to handle diverse codebases and execute safe multi-file refactoring operations.

When should I avoid regex and use AST-based pattern matching for code refactoring?

You should avoid regex and use AST-based pattern matching for code refactoring when precision is critical, because regex operates on raw text strings. AST-based GritQL targets syntax trees to prevent unintended matches during complex API migrations and structural transformations.