What problem does it solve? Single-pass AI generation often produces artifacts that miss requirements, and manual review cycles are slow and inconsistent. This Skill automates a structured refinement loop that plans, produces, evaluates against explicit rules, critiques failures, and refines until quality thresholds are met or iteration limits are reached. ## Core Features & Use Cases - Phased Iteration Loop: Executes PLAN, PRODUCE, PREPARE, EVALUATE, CRITIQUE, and REFINE phases with parallel Task agents, two-tier quality gates (Phase A then stricter Phase B), and stagnation detection. - Persistent Resumable State: Stores loop state in run.json, history.jsonl, and artifact.md so loops can be stopped, resumed, listed, and cleaned across sessions. - Rule-Based Evaluation: Ships criteria templates for API specs, code, documentation, and configuration, with weighted scoring, severity levels, and materialized executable/content checks. - Use Case: Ask for an OpenAPI 3.1 spec for a courses API; the loop drafts it, runs schema and completeness checks, critiques missing endpoints, and refines until the spec passes the 0.9 threshold. ## Quick Start Start a new refinement loop by asking to run /aif-loop new followed by your task, such as generating an OpenAPI spec with DDD notes and JSON examples.