moai-workflow-loop

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

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/jjjh7401/AI-Lighting_Console --skill moai-workflow-loop-jjjh7401
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: moai-workflow-loop
Source: https://github.com/jjjh7401/AI-Lighting_Console/tree/main/.claude/skills/moai-workflow-loop
Command: npx skills add https://github.com/jjjh7401/AI-Lighting_Console --skill moai-workflow-loop-jjjh7401

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

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 LSP error-fixing loop in Claude Code?▼

Enable the loop by setting ralph.enabled to true in .moai/config/sections/ralph.yaml, then run /moai loop. The PostToolUse hook collects LSP diagnostics after each Write or Edit, and the Stop hook iterates until errors reach zero or max_iterations is hit.

What languages does LSP diagnostic automation support?▼

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

Can I use AST-grep security scanning without an LSP server installed?▼

Yes. When graceful_degradation is enabled, the system falls back to linter-based diagnostics such as ruff or eslint, then compiler errors, then test failures. Missing language servers trigger a warn-and-skip with an install hint rather than a hard failure.

Why is the feedback loop stuck or not completing?▼

The loop stops at max_iterations (default 10) or when completion conditions are unmet. Check that zero_errors, tests_pass, and coverage_threshold settings in ralph.yaml are achievable, and delete .moai/cache/.moai_loop_state.json to reset a stuck state.

How do I integrate the quality loop into GitHub Actions CI?▼

Add a workflow step that runs claude with the /moai loop command and a max-iterations flag, setting MOAI_LOOP_ACTIVE=true. The loop state and diagnostic results can then be checked by a follow-up script to gate the pull request.

What are the limitations of automated error-fixing loops?▼

The loop requires installed language servers or fallback linters, and auto_fix is disabled by default so fixes need confirmation. Iteration limits exist for cost control, so unresolved errors after max iterations must be reported rather than silently ignored.