moai-tool-ast-grep

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

Updated Feb 2, 2026
One-click install
npx skills add https://github.com/CJ-1981/excel-processor --skill moai-tool-ast-grep-cj-1981
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-tool-ast-grep
Source: https://github.com/CJ-1981/excel-processor/tree/main/.claude/skills/moai-tool-ast-grep
Command: npx skills add https://github.com/CJ-1981/excel-processor --skill moai-tool-ast-grep-cj-1981

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides advanced, syntax-aware code analysis for searching complex patterns, performing semantic refactoring, and identifying security vulnerabilities across a wide range of programming languages.

Core Features & Use Cases

  • Structural Code Search: Find code patterns that regex cannot capture, like nested function calls or specific AST structures.
  • AST-based Refactoring: Perform safe and semantic code transformations, API migrations, and codemod operations.
  • Security Scanning: Detect common vulnerabilities like SQL injection, XSS, and hardcoded secrets based on code structure.
  • Use Case: Automatically refactor all instances of a deprecated API call across your entire codebase, or scan for specific security anti-patterns before committing code.

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 across multiple programming languages?

Structural code search is performed using AST-based pattern matching to find syntax-aware structures like nested function calls across 40+ programming languages, returning precise code locations that regex cannot capture.

What is the best way to automate API migrations and codemod operations safely?

AST-based refactoring automates API migrations and codemod operations by applying syntax-aware code transformations, ensuring semantic accuracy when updating deprecated API calls across an entire codebase.

Can I scan for security vulnerabilities like SQL injection based on code structure?

Security scanning detects common vulnerabilities like SQL injection, XSS, and hardcoded secrets by analyzing the AST structure rather than string matching, identifying risky code patterns before committing code.

Does ast-grep work for finding specific syntax patterns in large codebases?

ast-grep works across large codebases by parsing files into abstract syntax trees to locate specific AST structures, enabling syntax-aware code search that handles complex nested logic across 40+ languages.

Why use AST-based structural search instead of regex for code refactoring?

AST-based structural search understands code syntax and semantic context, allowing it to accurately match nested function calls and specific code structures where regex pattern matching fails or produces false positives.