moai-workflow-loop

Automates iterative code fixing using LSP diagnostics, AST-grep scanning, and test validation loops.

Updated Aug 29, 2026
One-click install
npx skills add https://github.com/Seung-zedd/secure-file-upload --skill moai-workflow-loop-seung-zedd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-workflow-loop
Source: https://github.com/Seung-zedd/secure-file-upload/tree/main/.claude/skills/moai-workflow-loop
Command: npx skills add https://github.com/Seung-zedd/secure-file-upload --skill moai-workflow-loop-seung-zedd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Manually chasing compiler errors, linter warnings, and security issues after every code change is slow and error-prone. This Skill runs an automated feedback loop that collects LSP diagnostics and AST-grep scan results after each edit, 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 after every Write/Edit operation via a PostToolUse hook. - AST-grep Security Scanning: Detects structural issues such as SQL injection, XSS, and hardcoded secrets using configurable AST-grep rules. - Configurable Completion Conditions: Stops only when zero errors, passing tests, and coverage thresholds (default 85%) are satisfied, with a max-iteration safety limit. - Use Case: While implementing a new feature, activate the loop so every edit is immediately checked by the language server and security scanner, with the loop continuing automatically until all diagnostics are resolved. ## Quick Start Ask the AI to start the feedback loop with /moai:loop so it iteratively fixes all LSP errors and security findings until the code is clean.

Frequently Asked Questions about moai-workflow-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up an automated error-fixing loop with LSP diagnostics?▼

Enable ralph in .moai/config/sections/ralph.yaml, ensure your language server is installed, then run /moai:loop. The PostToolUse hook collects diagnostics after each edit and the Stop hook iterates until errors reach zero or max_iterations is hit.

What languages does LSP-based diagnostic checking support?▼

The loop supports 16 languages including Python, TypeScript, Go, Rust, Java, C++, C#, Kotlin, Ruby, PHP, Swift, Scala, Elixir, R, JavaScript, and Flutter. It detects the project language via marker files like go.mod or pyproject.toml and spawns the matching language server.

Can I use AST-grep security scanning without the full feedback loop?▼

Yes, AST-grep scanning can run independently via moai ast-grep scan with security rules for SQL injection, XSS, and hardcoded secrets. The loop simply integrates these scans into its completion checks.

Why is the feedback loop stuck or not completing?▼

Common causes are unreachable completion conditions, a max_iterations limit that is too low, or errors that keep recurring. Check .moai/cache/.moai_loop_state.json, relax conditions like zero_warnings, or delete the state file to reset the loop.

What happens when the LSP server is unavailable?▼

With graceful_degradation enabled, the system falls back to linter-based diagnostics such as ruff or eslint, then to compiler error detection, and finally to test failure detection, so the loop keeps functioning without LSP.