<< All versions

Skill v1.0.0

currentAutomated scan100/100
evgeniy-mikhailove/rlm-claude-code-os/loop-build
──Details
PublishedNovember 15, 2026 at 06:37 AM
Content Hashsha256:20e0f70e608e593c...
Git SHA0618f6138c74
──Files
Files (1 file, 5.0 KB)
SKILL.md5.0 KBactive
SKILL.md · 166 lines · 5.0 KB

name: loop-build description: "Self-correcting build loop: spec -> build -> adversarial review -> fix -> repeat until review passes clean. Combines spec-driven-development with adversarial verification in an automated cycle. Threshold: 95%." triggers:

  • "loop build"
  • "петля сборки"
  • "зацикль билд"
  • "build until clean"
  • "собери и проверь"
  • "build loop"
  • "loop-build"

id: loop-build runtime: claude-only canonical_path: ~/.claude/skills/loop-build/SKILL.md updated: 2026-06-23 tags: [loop, build, review, spec, adversarial, quality] group: development metadata: version: "1.0.0"


Loop Build - Self-Correcting Build Cycle

Inspired by: MAMA MOZG "Petlya" methodology, adapted for adversarial multi-agent architecture.

Core Idea

Build from spec, review against spec with a SEPARATE agent (blind review), fix failures, repeat. Stop when review passes clean or diminishing returns detected.

When to Use

  • Building features from a spec (spec-driven-development output)
  • Any build task with >3 requirements to verify
  • Multi-file implementations where drift is likely
  • When you want to "fire and forget" - launch and get clean result

Skip for: single-file fixes, typos, config changes, tasks under 10 min.

Prerequisites

A spec file must exist at specs/<name>.md (created by spec-driven-development or manually). If no spec exists, prompt user to run /spec-driven-development first or provide requirements inline.

The Loop Protocol

PHASE 1: BUILD
Read specs/<name>.md
Build exactly what it describes
Output: checklist of covered requirements
PHASE 2: REVIEW (adversarial, separate agent)
Spawn review agent with ONLY:
- The spec file
- The current code/output
- NO access to build reasoning
Review agent checks requirement-by-requirement
Output: PASS (all met) or FAIL (list of gaps with spec item references)
PHASE 3: FIX (if FAIL)
Read review agent's gap list
Fix each gap, referencing specific spec item
Return to PHASE 2
STOP CONDITIONS (any triggers exit):
- Review returns PASS (all requirements met)
- Score >= 95% of spec items satisfied AND remaining are cosmetic
- 5 iterations reached (hard cap - report what's left)
- Score delta < 3% between iterations (diminishing returns)

Implementation

Step 1: Read Spec

spec_file = specs/<name>.md
Parse into discrete, checkable requirements
Number each requirement: R1, R2, R3...

Step 2: Build

Build strictly from spec.
NO features beyond spec.
NO refactoring of unrelated code.
After build, self-report:
COVERED: R1, R2, R3, R5
SKIPPED: R4 (reason)
ADDED: nothing (if anything added - flag as scope creep)

Step 3: Adversarial Review (SEPARATE AGENT)

Spawn Agent with:
description: "Blind spec review - iteration N"
prompt: |
You are a strict QA reviewer. You have never seen the build reasoning.
SPEC (source of truth):
<paste spec content>
CURRENT BUILD (what to review):
<paste code/files/output>
For each requirement in the spec:
1. State the requirement (quote it)
2. Check if the build satisfies it: PASS / PARTIAL / FAIL
3. If not PASS: describe exactly what's missing or wrong
Final verdict:
- SCORE: X/Y requirements passed (percentage)
- VERDICT: PASS (all met) or FAIL (list gaps)
- FIXES NEEDED: numbered list of specific changes

Step 4: Fix or Finish

IF verdict == PASS or score >= 95%:
Report to user:
LOOP COMPLETE after N iterations
Score trajectory: 60% -> 80% -> 95%
Final state: <summary>
IF verdict == FAIL and iterations < 5:
Apply fixes from review
Go to Step 3
IF iterations == 5:
Report to user:
LOOP STOPPED at iteration 5
Current score: X%
Remaining gaps: <list>
Recommendation: manual review needed for <specific items>

Output Format

After loop completion, always report:

LOOP-BUILD COMPLETE
Spec: specs/<name>.md
Iterations: N/5
Score trajectory: X% -> Y% -> Z%
Final score: Z%
Status: PASSED / STOPPED (max iterations) / STOPPED (diminishing returns)
Gaps remaining: none / <list>

Integration Points

SkillHow it connects
spec-driven-developmentProduces the spec that loop-build consumes
code-reviewReview agent uses code-review checklist as additional layer
doubt-driven-developmentApplied inside review agent for architectural decisions
verification-before-completionFinal check after loop exits
test-driven-developmentTests serve as additional PASS/FAIL signal in the loop

Anti-Patterns

  • Don't self-review: always use a SEPARATE agent for review. Self-review has confirmation bias.
  • Don't exceed spec: if build adds features not in spec, that's a FAIL even if the feature is good.
  • Don't skip diminishing returns check: if score goes 92% -> 93% -> 93%, stop. The last 2% isn't worth another iteration.
  • Don't run on trivial tasks: the overhead of 2-5 iterations is only justified for substantial builds.
All versions