moai-tool-ast-grep

Perform structural code analysis, security auditing, and refactoring with ast-grep pattern matching.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ast-grep, mcp__context7__resolve-library-id, mcp__context7__get-library-docs, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill enables developers to perform precise structural code searches, security scans, and automated refactoring using AST pattern matching.

Core Features & Use Cases

  • Code Search & Transformation: Find specific code patterns in multiple languages and apply automated refactors.
  • Security Analysis: Detect vulnerabilities such as SQL injection, XSS, and insecure cryptography.
  • Use Case: A developer can locate all instances of insecure hash algorithms in a codebase and replace them with secure alternatives in bulk.

Quick Start

Use the moai tool to search for all function definitions in a Python project.

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

Structural code search and refactoring across multiple languages is achieved using AST pattern matching to locate specific code patterns and apply automated transformations. This requires the ast-grep CLI and related configuration files for execution.

Can I detect security vulnerabilities like SQL injection using AST pattern matching?

Yes, AST pattern matching facilitates security analysis by detecting vulnerabilities such as SQL injection, XSS, and insecure cryptography. It scans the abstract syntax tree to locate and assess insecure code patterns across a codebase.

What is the best way to execute large-scale refactoring and replace insecure hash algorithms in bulk?

Large-scale refactoring to replace insecure hash algorithms is best executed using codemod techniques via ast-grep. You can locate all instances of insecure algorithms and apply automated code transformations to replace them with secure alternatives.

Do I need to install ast-grep before running cross-language pattern detection?

Yes, you need to install the ast-grep CLI and its related configuration files before running cross-language pattern detection. This environment setup is a prerequisite for executing structural code analysis and transformation tasks.

How does AST-based code search differ from standard text search for vulnerability scanning?

AST-based code search differs from standard text search by parsing code into an abstract syntax tree, enabling precise structural pattern matching. This allows for accurate vulnerability scanning and code transformation without false positives from string matching.