| name | pipeline-loop |
| description | Automate the build-verify-capture cycle for multiple components. Use when you have several components to build, verify, and promote, or want continuous iteration until quality gates pass. |
| when | After the design system is stable and you need to produce multiple passing components efficiently. |
| workflow | pipeline |
| commands | ["loop","generate --batch","capture --all","doctor all --gate","ds validate --strict"] |
Pipeline & Automation Skill
Purpose
Move from manual one-at-a-time component building to automated batch pipelines. The loop command implements a double-loop architecture: it alternates between building (generating code) and verifying (linting, rendering, gating) until the component passes โ all without manual intervention.
Workflow
1. Batch Generate โ generate --batch <manifest.json>
2. Loop Verify โ loop <component> [--max-iterations <n>]
3. Batch Capture โ capture --all [--baseline]
4. Validate DS โ ds validate --strict
5. Report โ doctor all --gate (final sign-off)
Step-by-Step
1. Batch Generate
emdesign generate --batch manifest.json
The manifest is a JSON array of component specs:
[
{ "name": "RevenueCard", "source": "import React from 'react'; ..." },
{ "name": "TransactionsTable", "source": "import React from 'react'; ..." }
]
Each component is generated in sequence and lint-checked automatically.
2. Double-Loop Verify
emdesign loop <component> [--max-iterations 5]
The loop runs this cycle:
โโโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโ โโโโโโโโโ
โ Builder โ โ โ Lint โ โ โ Render โ โ โ Gate โ
โ (agent) โ โ (rule) โ โ (spatial)โ โ (score)โ
โโโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโ โโโโโโโโโ
โ โ
โโโโโโ revise โโโโโโโโโโโโโโโโโ
Phase 1: Lint โ Fast token-rule compliance check. Blocks on P0 violations.
Phase 2: Visual โ If Storybook is available, runs pixel-diff comparison.
Phase 3: Gate โ Composite score check. If mustFix === 0 && tokenScore >= 0.8, passes.
Output: SHIP (pass) or REVISE (needs more work) after configured iterations.
3. Batch Capture
emdesign capture --all
emdesign capture --all --baseline
Iterates over all generated components, captures each one (promotes from src/generated/ to src/components/).
4. Final Validation
emdesign test validate --json
After capture, validate the design system contract remains intact.
5. Full Gate
emdesign test doctor <component> --json --gate
Runs all verification kinds and exits with code 0 (ship) or 1 (revise).
Batch vs Iterative
| Approach | When to Use |
|---|
generate --batch + loop per component | Components independent, each needs verification |
loop <component> | Single component, iterate until gate passes |
capture --all | Multiple components ready to promote |
doctor all --gate | CI/CD or pre-commit hook |
Command Reference
| Command | Purpose | Use Case |
|---|
generate --batch <file> | Generate multiple components from manifest | Bulk initial build |
loop <comp> | Iterative build-verify cycle | Single component refinement |
capture --all | Capture all generated components | Batch promotion |
doctor all --gate | Full verification as CI gate | Pre-commit / CI |
ds validate --strict | Token contract completeness | Post-capture validation |
Common Pitfalls
- Loop is not a replacement for human review โ it gates on deterministic metrics (lint score, mustFix count). Visual quality still needs human or vision-critic review.
- Batch generate doesn't handle dependencies โ if Component A depends on Component B, generate B first. Batch processes in array order.
- --max-iterations default is 10 โ if a component doesn't pass by then, it's flagged for manual review. Don't increase this to infinity.
- Capture --all overwrites โ if a component with the same name exists in
src/components/, it's overwritten. Use version control.