मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग48k · #3765

api-contract-testing

यह क्या करती है

यह टूल जाँचने में मदद करता है कि API contract (system के आपस में बात करने के नियम) में बदलाव से कोई समस्या तो नहीं होती। यह सुनिश्चित करता है कि बदलाव के बाद API देने वाला और उसका इस्तेमाल करने वाला, दोनों सही तरीके से साथ काम करते रहें।

कब इस्तेमाल करें

  • ✓जब API response में किसी field या नियम में बदलाव हो।
  • ✓जब कोड compile हो जाए, लेकिन runtime पर system का आपस में संवाद फेल हो।
  • ✓यह जानना हो कि बदलाव compatibility तोड़ता है या वह बस एक नया फ़ीचर है।

Skill का लिंक

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 में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/api-contract-testing/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस API बदलाव की समीक्षा करो। प्रभावित consumers और supported version combinations की सूची बनाओ। मौजूदा test runner का उपयोग करके valid, invalid और error responses के लिए local contract tests जोड़ो। बताओ कि कौन सी जाँचें असल में चलीं और किस चीज़ का अभी भी प्रमाण चाहिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह आधिकारिक API परिभाषा की तुलना असली व्यवहार से करता है और नकली (dummy) डेटा के साथ छोटे-छोटे tests बनाता है। इससे पता चलता है कि बदलाव से API इस्तेमाल करने वाले systems के बीच संवाद टूटता तो नहीं।

तकनीकी सामग्री (मूल 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 contract' क्या है?

यह एक दस्तावेज़ है जो बताता है कि एक system (provider) दूसरे system (consumer) से कैसे बात करेगा। इसमें डेटा का फ़ॉर्मेट, endpoints और अपेक्षित नियम लिखे होते हैं।

असली production डेटा का इस्तेमाल क्यों नहीं करते?

असली डेटा से संवेदनशील जानकारी उजागर हो सकती है, और उससे सारे error वाले हालात टेस्ट होने की गारंटी भी नहीं होती। छोटा, नकली (synthetic) डेटा ज़्यादा सुरक्षित और असरदार होता है।

क्या यह टूल API deploy या मैनेज करता है?

नहीं, यह टूल API contracts की योजना बनाने और उन्हें जाँचने पर केंद्रित है। यह API deploy नहीं करता और न ही testing services मैनेज करता है।

जानकारी

लेखक का मूल विवरण

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
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

00-andruia-consultant

48k

आपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।

AI और एजेंटएजेंट

007

48k

आपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।

कोडिंगसिक्योरिटी

10-andruia-skill-smith

48k

आपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।

AI और एजेंटएजेंट

20-andruia-niche-intelligence

48k

आपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।

लेखन और डॉक्यूमेंटरिसर्च

मिलती-जुलती skills