From looping
OpenAPI나 JSON Schema 같은 API 계약(contract)에 맞춰 계약 테스트를 돌리고, 응답이 스펙과 어긋나면(드리프트) 핸들러 구현이나 스펙을 가장 작은 단위로 고쳐서 계약 테스트가 전부 통과(종료 코드 0)할 때까지 자동으로 반복하는 닫힌 루프입니다. 사용자가 "API가 스펙대로 응답하는지 계약 테스트 돌려줘", "OpenAPI 계약이랑 구현 안 맞는 거 맞춰줘", "API 응답이 스키마랑 일치할 때까지 고쳐줘", "문서랑 구현 드리프트 잡아줘", "contract test until match", "make the API match the OpenAPI/JSON Schema contract", "API Contract Until Match"처럼 요청하거나, 문서와 실제 구현 사이의 계약 불일치를 반복적으로 맞추고 싶을 때 사용하세요. (구분: openapi.yaml 자체를 lint하고 라우트 핸들러와 동기화하는 건 looping:openapi-sync-until-valid, README·API 레퍼런스 등 문서를 코드에 맞추는 건 looping:docs-sync-after-edits, spec.md 체크리스트대로 신규 기능을 구현하는 건 looping:spec-first-ship, 전체 테스트 스위트를 green까지 돌리는 건 looping:test-until-green)
How this skill is triggered — by the user, by Claude, or both
Slash command
/looping:api-contract-until-matchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> API 응답이 OpenAPI나 JSON Schema 계약과 일치할 때까지 반복 — 문서와 구현 사이의 드리프트를 잡는다.
API 응답이 OpenAPI나 JSON Schema 계약과 일치할 때까지 반복 — 문서와 구현 사이의 드리프트를 잡는다.
| 항목 | 값 |
|---|---|
| 카테고리 | API |
| 트리거 | 수동(manual) — 사람이 직접 시작 |
| 종료 조건(Exit) | 계약 테스트 스위트가 종료 코드 0으로 끝날 때 |
| 반복 한도(Max iterations) | 10 |
| 매 반복 체크 명령 | npm run test:contract |
| 가드레일 | 강화됨(Hardened) |
| 지원 에이전트 | Claude Code · Cursor |
OpenAPI 스펙이나 JSON Schema로 API 계약을 정해 뒀는데, 실제 핸들러 응답이 슬그머니 스펙과 어긋나기 시작할 때 씁니다. 필드 이름이 바뀌었거나, 타입이 다르거나, 필수 필드가 빠졌거나 — 문서는 그대로인데 구현만 표류(drift)하는 상황입니다. 한 번 시작하면 에이전트가 계약 테스트 실행 → 불일치 수집 → 최소 수정 → 재실행을 스스로 반복하며 계약과 구현을 다시 맞춥니다. 핵심은 한 번에 가장 작은 변경 하나만 적용해, 핸들러의 타입·검증을 고치거나 (코드가 정답인 경우) 스펙을 바로잡는 것입니다.
수동 시작 → 계약 테스트 실행 → 구현/스펙 수정 → 재실행 →〔피드백 게이트〕계약 테스트 전부 통과?
↑ │ 아니오
└───────────────────────────────────────────────────────┘
│ 예
종료
npm run test:contract
종료 조건을 "가짜로" 통과시키지 못하게 막는 규칙입니다. 반드시 지키세요.
가장 간단합니다. 아래 kickoff 프롬프트를 그대로 붙여넣으면 에이전트가 스스로 반복합니다.
"API 계약 일치까지(API Contract Until Match)" 루프를 시작합니다.
목표: API 구현이 공개된 계약(contract)과 일치한다
최대 반복: 10
매 반복 사이 실행: npm run test:contract
종료 조건: 계약 테스트 스위트가 종료 코드 0으로 끝날 때
1단계: 계약 테스트를 실행한다. 스키마/응답 불일치를 최소 diff로 하나씩 고치고, 다시 실행한다.
이 루프를 스스로 페이싱(self-pace)하라. 매 반복 후 체크 명령을 실행하고 출력을 읽어, 종료
조건이 충족되지 않았을 때만 계속한다. 종료 조건이 통과하거나 최대 반복에 도달하면 멈춘다.
매 회차마다 한 줄 상태 업데이트를 남긴다.
팁:
npm run test:contract는 예시입니다. 프로젝트의 계약 테스트 명령에 맞게 바꾸세요 — 예를 들어 Dredd는dredd openapi.yaml http://localhost:3000, Schemathesis는schemathesis run openapi.yaml --url http://localhost:3000, Pact는npm run test:pact등입니다.
jest-openapi 또는 Dredd, Python은 Schemathesis(schemathesis run ...), 소비자 주도 계약은 Pact를 쓰세요. 핵심은 "응답이 스펙과 맞는지"를 종료 코드로 판정하는 명령이면 됩니다.looping:openapi-sync-until-valid, 코드 변경 후 문서를 맞추려면 looping:docs-sync-after-edits, 전체 테스트를 green까지 돌리려면 looping:test-until-green.Start the "API Contract Until Match" loop.
Goal: API implementation matches the published contract
Max iterations: 10
Between iterations run: npm run test:contract
Exit when: contract test suite exits 0
Step 1: Run contract tests. Fix each schema/response mismatch with minimal diffs, then re-run.
Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.
npx claudepluginhub newturn2017/looping-skills --plugin loopingGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.