nesnilnehc/ai-cortex/orchestrate-repair-loop
Claude Code and agent skill by nesnilnehc/ai-cortex
- community
Checking that the SKILL.md file is still in the repository.
Iteratively converge the sibling engineering and functional gates, apply targeted fixes, then re-review and re-verify until both pass or a stop condition is reached.
Install
npx vskill@latest install nesnilnehc/ai-cortex/orchestrate-repair-loopSKILL.md
The same SKILL.md was published earlier as nesnilnehc/ai-cortex/orchestrate-repair-loop.
Skill: Run the repair loop (engineering gate + functional gate + fix)
Purpose
Converge a repository or change set by running two sibling gates and applying the smallest targeted repair:
- Engineering gate —
orchestrate-code-reviewevaluates intrinsic code quality. - Functional gate —
review-implementation-alignmentcompares approved intent with implementation, whileautomate-testsor the acceptance harness executes correctness evidence. - Repair — fix a blocking signal from either gate.
- Repeat — rerun every gate affected by the repair until both pass or a stop condition is reached.
The gates are logically peers. They may run in either order or in parallel when the runtime supports it; passing one never substitutes for the other.
Core Objective
Primary goal: converge the repository to a verified state — no blocking engineering findings, approved intent aligned with production code, and functional checks passing — using a bounded, evidence-driven loop.
Success criteria (all must be met):
- ✅ Definition of done resolved: scope, test mode, loop bound and allowed actions come from the request, repository evidence or stated defaults before the loop starts
- ✅ Both gates evidenced: engineering findings and functional alignment/acceptance evidence are reported separately
- ✅ Affected gates re-run after a fix: every repair is followed by the narrowest functional and engineering checks it can invalidate
- ✅ Bounded loop: the loop terminates on convergence or on an explicit stop condition - no unbounded retrying
- ✅ Structured final report: the output includes a repair-loop report (appendix: output contract) covering the commands run, the failures, the patches, and the remaining risk
Acceptance test: does the final report show either (a) both sibling gates passing with traceable evidence, or (b) an explicit stop condition with remaining engineering and functional problems separated?
Scope Boundaries
This skill covers:
- The multi-iteration engineering-gate + functional-gate → fix loop
- Diff-scoped and codebase-scoped review through
review-diffandorchestrate-code-review - Functional alignment through
review-implementation-alignmentwhen approved artifacts exist - Test and acceptance execution through
automate-testsor the project harness - Minimal targeted patches that preserve the API contract
- Stop-condition detection (no progress, environment blocker, flaky tests, iteration limit)
- A structured repair-loop report as output
This skill does not cover:
- Installing dependencies, making authenticated or state-changing remote requests, or starting Docker/services without authorization
- Large refactors without explicit user approval
- Modifying unrelated sibling repositories
- Disabling tests, weakening assertions, or deleting coverage without explicit user approval
Handoff point: when the loop converges or reaches a stop condition, present the repair-loop report to the user. For a risky change (architecture migration, authentication change, broad refactor), pause and ask for explicit approval before applying it.
Use Cases
- "Keep fixing until the tests pass."
- "Run engineering and functional gates, then fix until both pass."
- "Stabilize this PR/change set with iterative testing and targeted fixes."
- "Run CI-like tests, fix the failures, repeat until stable."
Behavior
1. Preflight (must be resolved once)
If CLAUDE.md or .ai-cortex/config.yaml exists, read test_command and the rest from there first; otherwise fall back to discovery. See docs/guides/project-config.md.
Resolve the following from the request and repository evidence. Apply stated defaults where the choice is routine; ask only when a necessary decision remains ambiguous.
When the input is a defect report or support ticket, inspect the supplied description, attachments, logs and reproduction steps together. Establish expected behavior from current project sources and compare it with observed behavior before selecting a fix. Treat the title as a lead, not a diagnosis. Record missing or conflicting evidence; if it prevents a justified repair, report what would resolve it rather than guessing. A report that matches intended behavior, concerns another system, or requests new behavior is handed back with its basis or routed to the project's existing intake process when needed.
- Target: repository path (default
.) and scope: diff(default): focus on the current changes, preferringreview-diff.codebase: review the given set of paths, preferringreview-codebase/ the language skills throughorchestrate-code-review.- Definition of done:
- Engineering: no
critical/majorfindings remain fromorchestrate-code-review. - Functional alignment: no
critical/majorALN findings remain when an approved artifact chain exists. - Functional execution: the selected test and acceptance plan passes.
- If only "minor"/"suggestion" findings remain, list them as non-blocking unless the user requested further polish.
- Loop bounds:
max_iterationsdefault:5.time_budgetdefault: "best effort"; if the user gives a time limit, honor it strictly.- Allowed actions (ask when unclear; default to the safer choice):
- Modify repository files: yes (this skill exists to repair), but keep the change minimal.
- Install dependencies: confirm before running (a reasonable action, but outside the implicit authorization of "change the code").
- Network access: public read-only sources follow AGENTS.md; authenticated requests, remote writes and downloads that would become runtime dependencies require the user's authorization and the repository's source policy.
- Docker/services (DB/Redis/etc.): confirm before running (start on demand, stop once the tests finish).
- Large refactors: no, not without confirmation.
Read the repair loop examples when you need a worked example for a failing unit test, an environment blocker in CI, or a UI defect reported with a screenshot.
2. The iteration loop
For i = 1..max_iterations:
- Run or refresh the engineering gate
- Run
orchestrate-code-reviewover the selected diff or codebase scope, including untracked additions in diff mode. - A narrow rerun may call only the atomic reviewers whose evidence a repair changed, but the final iteration includes the complete applicable engineering gate.
- Try an existing review skill first; review it yourself only when none can be invoked. Not finding a
skill name does not mean it is absent — different skill-listing interfaces cover different sets, and concluding "not installed" from a single lookup throws away a whole set of ready-made capability. When reviewing inline, write in the report that you "could not invoke <skill name>, reviewed inline", so the reader does not take it for the standard path.
- Run or refresh the functional gate
- When approved requirements, designs or tasks exist, run
review-implementation-alignmentover that artifact chain, the implementation scope and current evidence. - Use
automate-teststo discover and run the best-matching test command in the selected mode: fast(default): unit tests only, minimal setup.ci: stay as close to the CI steps as possible.full: includes integration / e2e (dependencies and services need confirming first).- When changed behavior crosses an integration boundary and the repository provides a runnable integration layer, run it at least once before the loop ends, even if
fastwas used throughout. Otherwise record why it is not applicable or what environment blocks it.
The reason is concrete: unit tests mostly new the object under test directly, so they stay green when a constructor signature changes, while an integration test blows up on the spot — and worse, that explosion often masks the real defect behind it (a missing constructor argument first yields undefined.x, and the real problem surfaces only once that is fixed). A fully green fast run is never a reason to leave integration unrun.
- Capture:
- The first failing command and its exit code
- The most relevant error excerpt (do not dump large logs unless asked)
- For a repair affecting a UI, execute the project's declared acceptance checks for the affected path using the existing UI acceptance guidance. Report visual and interaction evidence separately; screenshots alone do not establish working interactions. Identify checks blocked by the environment and leave those acceptance items unverified. Follow the guidance's trigger/skip conditions: a small repair preserving the existing interaction and visual pattern does not require a new UI design record; a new interface or significant interaction, navigation or visual change still requires applicable design decisions even when reusing existing components. A backend-only repair adds no UI checks.
- Synthesize the fix plan (smallest correct patch)
- Pick the one primary problem to address first:
- The first failing test/command usually wins (highest signal).
- A
criticalengineering, alignment, data or security problem takes precedence over non-critical test cleanup. - Prefer a fix that:
- Changes the smallest surface area
- Preserves the API/contract unless explicitly approved
- Adds or adjusts a test when fixing a bug (where feasible)
- Apply the fix
- For a reported defect, first reproduce it with a failing regression test and confirm the expected failure, then implement the smallest repair. If this is blocked by the environment or cannot be automated, state the limitation and retain the smallest runnable reproduction or acceptance check available; do not claim unexecuted verification.
- Implement the patch.
- Avoid unrelated formatting or churn.
- If the fix requires a risky change (architecture migration, authentication change, broad refactor), pause and ask.
- Re-run every affected gate
- Re-run the most relevant failing test or acceptance subset.
- Re-run alignment when behavior, contracts, data mapping, wiring or tests changed.
- Re-run the affected engineering reviewers when production code, configuration or tests changed.
- If fixed, proceed to the next remaining failure/finding within the same iteration only if it is trivial; otherwise move to the next loop iteration.
- Stop early once converged
- Stop only when both sibling gates pass: no blocking engineering or alignment findings, and all selected functional checks pass.
- But "the tests were green from the start" is not convergence. Green only says the existing
assertions were not broken; it says nothing about whether this batch of changes is sound — a unit test verifies the behavior of a part, and it cannot see what goes wrong between parts or at real scale. When the repository arrives green, all of the loop's forward motion sits in the review half: convergence requires the complete engineering gate and, when artifacts exist, implementation-alignment review. Skipping them and declaring the repo clean turns the loop into an idle spin.
2b. Criteria ownership
This Skill does not maintain another review checklist. Intrinsic quality criteria live in the canonical engineering Rule sets. Missing acceptance behavior, dropped fields, built-but-unwired code and implementation-shaped tests live in implementation-alignment-quality. The loop routes to those owners and consumes their findings.
3. Stop conditions (must not loop forever)
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/orchestrate-repair-loop/SKILL.md
Popularity
- Repository stars
- 7
- Repository forks
- 3
- 7-day trend score
- 15
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nesnilnehc/ai-cortex/orchestrate-repair-loop)