tool-ast-grep-rules

Generate and apply AST-based code search and rewrite rules with ast-grep YAML configurations.

1|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/mshaheerz/hive-mind --skill tool-ast-grep-rules-mshaheerz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tool-ast-grep-rules
Source: https://github.com/mshaheerz/hive-mind/tree/main/agent-skills/tool-ast-grep-rules
Command: npx skills add https://github.com/mshaheerz/hive-mind --skill tool-ast-grep-rules-mshaheerz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the creation of precise code search and rewrite rules using AST-based patterns, enabling efficient code analysis, modernization, and migration.

Core Features & Use Cases

  • AST-based Code Search: Define complex patterns to find specific code structures.
  • Automated Code Rewriting: Automatically fix identified code patterns for modernization or API migration.
  • Lint Rule Creation: Develop custom linting rules for code quality and consistency.
  • Use Case: Automatically refactor all instances of console.log to a custom logger across a large JavaScript codebase.

Quick Start

Use the tool-ast-grep-rules skill to create a rule that replaces all instances of var with const in JavaScript files.

Frequently Asked Questions about tool-ast-grep-rules

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

FAQPage Schema
What are AST-based code rules and how do they help with code refactoring?

You can create automated code rewrite rules using ast-grep YAML configurations to automatically identify and transform specific code patterns, such as replacing all instances of `var` with `const` in JavaScript files.

How do I write a custom lint rule to enforce code consistency?

Custom lint rules can be generated using ast-grep YAML configurations to define precise AST pattern matching, facilitating consistent code quality checks and automated transformations across your codebase.

Does ast-grep support API migration across multiple programming languages?

Yes, ast-grep supports precise pattern matching and automated code transformation across multiple programming languages, making it suitable for executing complex API migration tasks and code modernization.

What is the best way to automate replacing console.log with a custom logger in JavaScript?

The best way is to use ast-grep YAML configurations to generate AST-based code rewrite rules, which can automatically search and replace all instances of `console.log` with your custom logger across a large JavaScript codebase.

When do I need AST pattern matching instead of simple text search for code analysis?

AST pattern matching is necessary when simple text search fails to capture structural code semantics, allowing you to define complex patterns to find specific code structures for precise linting and automated modernization.