api-contract-testing
Qué hace
Esta herramienta ayuda a comprobar si los cambios en un contrato de API (las reglas de comunicación entre sistemas) causan problemas. Asegura que el proveedor de la API y quienes la consumen sigan funcionando juntos después de los cambios.
Cuándo usarla
- ✓Cuando cambia un campo o una regla en la respuesta de la API.
- ✓Cuando el código compila, pero la comunicación entre sistemas falla en tiempo de ejecución.
- ✓Cuando necesitas saber si un cambio rompe la compatibilidad o es solo una nueva función.
Link de la skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/api-contract-testing/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Revisa este cambio en la API. Enumera los consumidores afectados y las combinaciones de versiones compatibles. Añade pruebas de contrato locales para respuestas válidas, inválidas y de error usando el ejecutor de pruebas que ya tienes. Informa de las comprobaciones que realmente se han ejecutado y de lo que todavía necesita pruebas.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Compara la definición oficial de la API con su comportamiento real, creando pruebas pequeñas con datos de prueba. Así se asegura de que los cambios no rompan la comunicación entre los sistemas que usan la API.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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.
…
Preguntas frecuentes
¿Qué es un 'contrato de API'?
Es un documento que define cómo un sistema (proveedor) se comunica con otro (consumidor), especificando formatos de datos, endpoints y reglas esperadas.
¿Por qué no usar datos reales de producción?
Los datos reales pueden exponer información sensible y no garantizan que se prueben todos los escenarios de error. Los datos mínimos y sintéticos son más seguros y eficaces para probar.
¿Esta herramienta despliega o gestiona APIs?
No, esta herramienta se centra en planificar y verificar contratos de API. No despliega APIs ni gestiona servicios de pruebas.
Detalles
Descripción original del autor
Design and review API contract tests across providers and consumers. Use for schema changes, compatibility regressions and client integration failures.
Popularidad
- Estrellas en GitHub
- 48 mil
- Posición en el ranking
- #3765
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
00-andruia-consultant
48 milAyuda a tu agente a iniciar o mejorar proyectos de IA. Analiza código, sugiere herramientas y crea planes de acción en español.
007
48 milPermite que tu agente realice auditorías de seguridad y modelado de amenazas. Es útil para proteger proyectos contra ataques y vulnerabilidades.
10-andruia-skill-smith
48 milAyuda a tu agente a crear o mejorar herramientas de IA. Define cómo funcionan, escribe la documentación y valida la estructura.
20-andruia-niche-intelligence
48 milPermite que tu agente cree un resumen de un sector específico. Es útil para entender su contexto, normas, patrones de uso y riesgos, usando fuentes fiables.
Skills parecidas
test-driven-development
311 milEnseña a tu agente a escribir primero una prueba que falle, verla fallar y después escribir el código más pequeño que la hace pasar, antes de construir cualquier función o corrección.
verification-before-completion
311 milEnseña a tu agente a ejecutar comprobaciones reales y leer su resultado antes de afirmar que una tarea, una corrección o una compilación está completa o en buen estado.
migrate-to-shoehorn
310 milSustituye los casts de tipo arriesgados de tus archivos de prueba por la librería shoehorn, para que las pruebas usen datos parciales y sigan pasando las comprobaciones de tipos.