moai-tool-ast-grep

Perform AST-based structural code search, security scanning, and refactoring across multiple programming languages.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/thkim2015/pdf-tool --skill moai-tool-ast-grep-thkim2015
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-tool-ast-grep
Source: https://github.com/thkim2015/pdf-tool/tree/main/.claude/skills/moai-tool-ast-grep
Command: npx skills add https://github.com/thkim2015/pdf-tool --skill moai-tool-ast-grep-thkim2015

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill automates complex code analysis, refactoring, and security scanning by understanding code structure rather than just text patterns.

Core Features & Use Cases

  • Structural Code Search: Find code patterns that are difficult or impossible with regex.
  • AST-based Refactoring: Perform semantic code transformations across your codebase.
  • Security Scanning: Identify vulnerabilities based on code structure and known patterns.
  • Use Case: Automatically refactor all instances of a deprecated API call across your entire project, or scan for common security vulnerabilities like SQL injection.

Quick Start

Use the moai-tool-ast-grep skill to find all instances of console.log in JavaScript files 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?

Structural code search uses AST-based pattern matching to find code structures based on syntax rather than text. This approach catches patterns that regular expressions miss by understanding the actual code structure across multiple languages.

How do I write a codemod to refactor deprecated API calls across my codebase?

AST-based refactoring automates semantic code transformations by defining structural patterns to match and replace. You can run automated codemods to update deprecated API calls across your entire project consistently.

Can I use ast-grep for security scanning and vulnerability detection?

Yes, ast-grep performs security scanning by identifying vulnerabilities based on code structure and known patterns. It detects syntax-aware security issues like SQL injection by analyzing the AST rather than just text.

What's the best way to find all console.log statements in JavaScript files?

The best way to find console.log statements is using AST-based code search to target the specific function call structure. This structural search ensures you match the actual function call without false positives from text in comments or strings.

Does ast-grep support multiple programming languages for code analysis?

Yes, ast-grep performs structural code search and refactoring across multiple programming languages. It leverages syntax-aware AST parsing to handle different language structures uniformly for code pattern matching and transformation.