moai-tool-ast-grep

Perform AST-based structural code search, security scanning, and refactoring across 40+ languages.

Updated Dec 14, 2025
One-click install
npx skills add https://github.com/seo-jinseok/regulation_manager --skill moai-tool-ast-grep-seo-jinseok
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-tool-ast-grep
Source: https://github.com/seo-jinseok/regulation_manager/tree/main/.claude/skills/moai-tool-ast-grep
Command: npx skills add https://github.com/seo-jinseok/regulation_manager --skill moai-tool-ast-grep-seo-jinseok

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill automates complex code analysis, refactoring, and security scanning by understanding code structure (AST) rather than just text patterns, enabling precise and safe code transformations across many languages.

Core Features & Use Cases

  • Structural Code Search: Find code patterns that are impossible with regex (e.g., specific function call structures, nested logic).
  • Automated Refactoring: Perform large-scale code updates, migrations, and style enforcement semantically.
  • Security Scanning: Detect vulnerabilities like SQL injection, XSS, and hardcoded secrets based on code patterns.
  • Use Case: Automatically update all instances of a deprecated API call across your entire codebase, ensuring consistency and preventing errors.

Quick Start

Use the moai-tool-ast-grep skill to find all instances of console.log within the src/ directory.

Frequently Asked Questions about moai-tool-ast-grep

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

FAQPage Schema
How do I perform structural code search instead of using regex?

Automated refactoring with AST tools performs syntax-aware transformations to update deprecated APIs and enforce styles safely. This Skill handles codemod operations and large-scale code migrations by understanding code structure rather than relying on text replacements.

Can I scan for security vulnerabilities like SQL injection across multiple languages?

Yes, security scanning can detect vulnerabilities like SQL injection, XSS, and hardcoded secrets across 40+ languages. This Skill uses AST-based rule configurations to identify security risks based on specific code patterns rather than surface text.

Do I need to install the ast-grep CLI to run codemod operations?

Yes, the ast-grep (sg) CLI installation is required to run codemod operations and structural code searches. The Skill acts as an interface to the CLI, requiring specific rule configurations to execute advanced syntax-aware transformations.

What is the best way to find and replace all instances of a deprecated function call?

The best way to replace deprecated function calls is using AST-based refactoring to target the exact call structure. This Skill automates these large-scale codebase updates semantically, ensuring consistency and preventing errors that occur with manual text find-and-replace.