본문으로 건너뛰기
Skillpedia
테스트48k · #3765

api-contract-testing

하는 일

API 계약(시스템 간 통신 규칙)의 변경이 문제를 일으키는지 확인하는 도구입니다. API 제공자와 사용자가 변경 후에도 계속 함께 작동하도록 보장합니다.

사용하는 경우

  • ✓API 응답의 필드나 규칙이 바뀔 때.
  • ✓코드는 컴파일되지만 실행 중에 시스템 간 통신이 실패할 때.
  • ✓변경이 호환성을 깨는지 아니면 단지 새 기능인지 알아야 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/api-contract-testing/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/api-contract-testing/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 API 변경을 검토해 주세요. 영향을 받는 사용자와 지원되는 버전 조합을 나열해 주세요. 기존 테스트 러너를 사용해 유효, 무효, 오류 응답에 대한 로컬 계약 테스트를 추가해 주세요. 실제로 실행한 검사와 아직 증명이 필요한 부분을 보고해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

공식 API 정의와 실제 동작을 비교하고, 더미 데이터를 사용한 작은 테스트를 만듭니다. 이를 통해 변경이 API를 사용하는 시스템 간 통신을 깨뜨리지 않는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

API Contract Testing

Overview

Turn an API change into explicit provider and consumer checks. Start from the actual contract and affected clients, then verify wire-level behavior rather than relying on generated types or a successful build. Default to local fixtures and existing test tools; this skill does not provision a testing service.

When to Use

  • A response field, endpoint, event schema or error envelope changes.
  • A client and server build successfully but disagree at runtime.
  • A team needs to distinguish a breaking change from a compatible extension.
  • A reported regression needs a minimal provider/consumer reproduction.

Do not use this as authorization to call production endpoints, bypass access controls or publish a new API version.

How It Works

1. Bind the contract and scope

Identify the provider, transport, contract source and version, known consumers and the requested behavior. Read the real OpenAPI/JSON Schema/protobuf definition or documented examples and the corresponding server/client code. Record missing consumers and stale specifications as coverage gaps; do not invent interfaces or claim complete coverage from one client.

Keep these distinct: documented schema, actual provider output, generated client types and runtime parsing. A type assertion alone is not validation. Preserve the existing protocol and test runner instead of introducing a new platform by default.

2. Classify the change

Review fields, requiredness, nullability, enum values, status codes, headers, content type, pagination and error behavior. Inspect whether clients tolerate extra fields and unknown enum values. Even an added optional field can break a strict consumer. Explicitly identify affected versions and assumptions before calling a change compatible.

For events, include duplicate delivery, ordering and version envelopes. For request changes, check serialization and server validation as well as responses.

3. Build a small test matrix

Use deterministic synthetic fixtures for:

  • Valid success, including optional and empty values.
  • Missing required fields, wrong types and explicit nulls.
  • Extra fields and unknown enums according to the actual compatibility policy.
  • Declared error envelopes, non-success statuses and malformed bodies.
  • Old consumer against new provider and new consumer against retained old provider, where those combinations are supported.

Assert the behavior promised by the contract. Do not silently coerce malformed values or make the fixture match a defect just to get a passing test.

4. Verify each boundary

Run the existing schema validator against fixtures. Exercise the provider handler locally and pass its serialized result through the real consumer parser. Check failure cases reject or map errors as specified. Use an authorized isolated integration environment only when fixtures cannot establish the required property; report that boundary explicitly.

A mock verifies assumptions encoded in the mock. It does not establish that the real provider implements them. Record exact commands, fixture versions and observed outcomes separately from unrun checks.

5. Report and hand off

Deliver the change classification, affected consumers, test matrix, observed failures, minimal reproduction and remaining coverage gaps. For a breaking change, propose versioning, a compatibility adapter or a staged migration with owners and rollback criteria. Deployment and consumer migration require their own task authorization.

Example

Synthetic documented response:

{"id":"invoice-demo","amount_minor":1250,"currency":"EUR"}

Contract: id and currency are strings; amount_minor is a non-negative integer in minor units. This fixture does not represent an actual customer or payment.

Fixture change Expected check
amount_minor becomes "1250" Runtime parser rejects the string; compile-time generated types alone cannot detect wire drift.
amount_minor is missing or null Reject when the field is required and non-nullable.
Extra display_label field Verify the consumer's documented extra-field policy before declaring compatibility.
HTTP error with an HTML body Produce the declared transport/protocol error, rather than treating it as a valid invoice.

Reusable prompt:

Review this API change against the actual contract and supplied client/server code.

…
자주 묻는 질문

‘API 계약’이란 무엇인가요?

한 시스템(제공자)이 다른 시스템(사용자)과 어떻게 통신하는지, 데이터 형식과 엔드포인트, 기대되는 규칙을 정의한 문서입니다.

실제 운영 데이터를 사용하지 않는 이유는 무엇인가요?

실제 데이터를 사용하면 민감한 정보가 노출될 수 있고, 모든 오류 상황이 테스트된다는 보장도 없습니다. 최소한의 합성 데이터가 더 안전하고 효과적입니다.

이 도구가 API를 배포하거나 관리하나요?

아니요, 이 도구는 API 계약을 계획하고 검증하는 데 중점을 둡니다. API를 배포하거나 테스트 서비스를 관리하지는 않습니다.

상세 정보

작성자의 원본 설명

Design and review API contract tests across providers and consumers. Use for schema changes, compatibility regressions and client integration failures.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#3765
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬