What problem does it solve? Manually chasing compiler errors, type mismatches, and security issues after every code edit is slow and error-prone. This Skill runs an automated feedback loop that collects LSP diagnostics and AST-grep scan results after each Write/Edit operation, then iterates until errors reach zero, tests pass, and coverage thresholds are met. ## Core Features & Use Cases - LSP Diagnostic Loop: Collects real-time diagnostics from language servers for 16 languages (Python, TypeScript, Go, Rust, and more) via a PostToolUse hook after every file edit. - AST-grep Security Scanning: Detects structural vulnerabilities such as SQL injection, XSS, and hardcoded secrets using configurable pattern rules. - Loop Controller with Completion Conditions: A Stop hook tracks iteration state in a JSON state file and continues the loop until zero errors, passing tests, and coverage thresholds are satisfied, with graceful degradation to linters when LSP is unavailable. - Use Case: While implementing a new authentication module, activate the loop so every edit is immediately checked by pyright and AST-grep; the loop keeps fixing type errors and security findings until the codebase is clean or max iterations trigger a stagnation report. ## Quick Start Ask the AI to start the feedback loop with /moai loop so it automatically fixes LSP errors and security findings until all diagnostics are clean.