moai-tool-ast-grep

Search, scan, and refactor code using ASTs across 40+ languages.

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

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 through Abstract Syntax Trees (ASTs), going beyond simple text matching.

Core Features & Use Cases

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

Quick Start

Use ast-grep 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 find and refactor code patterns that regex cannot match?

AST-based structural search understands code syntax to find patterns that regex cannot match. It enables syntax-aware refactoring and codemod operations across your entire codebase.

Can I scan for SQL injection and XSS vulnerabilities based on code structure?

Yes, security scanning detects vulnerabilities like SQL injection and XSS by analyzing code structure through ASTs. This syntax-aware approach catches patterns that text-based scanners miss.

Does ast-grep support code refactoring across multiple programming languages?

Yes, AST-based refactoring supports over 40 programming languages including Python, JavaScript, TypeScript, Go, and Rust. You can execute semantic code transformations and codemods across these environments.

What is the best way to automate replacing a deprecated API across a codebase?

Running a codemod with AST-based structural search automates replacing deprecated APIs across a codebase. It parses syntax to safely transform all matching instances without breaking unrelated text.

How do I find all instances of a specific function call like console.log in JavaScript?

Use AST-based structural code search to find all instances of `console.log` in JavaScript files. Targeting the `src` directory, the search matches the function call structure precisely without false positives.