contract-testing

仓库创建 2026年3月24日最近提交 1 个月前SkillHot 收录 2 天前
▸ 精选理由

支持 can-i-deploy 等网关策略,适合微服务间强契约场景保障集成安全。

▸ 风险提示

依赖 Pact Broker 与凭据,部署与证书管理需要额外运维权限

这个 Skill 做什么

使用 Pact-JS 实现消费者驱动的契约测试与 Broker 驱动的提供者验证流程。

用 Pact-JS 做消费者驱动的契约测试,消费者声明需要的 API,提供方在 CI 里验证自己能满足,并通过 Pact Broker/`can-i-deploy` 把兼容性作为部署门禁。适合需要避免前后端契约不一致在生产暴雷的微服务团队。特点是把契约当成 CI 流程的一等公民,支持 pending pact、Webhook 驱动的验证和部署阻断。

▸ 展开 SKILL.md 英文原文

Implement consumer-driven contract testing with Pact-JS (v16). Covers consumer test writing, broker-driven provider verification, Pact Broker setup, can-i-deploy as a deployment gate, webhook-triggered verification, pending pacts, and schema-first vs consumer-first approaches (OpenAPI/Ajv, Schemathesis). Use when: "contract test," "Pact," "consumer-driven," "API contract," "provider verification," "can-i-deploy." Not for: stubbing or mocking a dependency to isolate a test — use service-virtualization; general REST/GraphQL endpoint assertions against your own API — use api-testing. Related: api-testing, service-virtualization, ci-cd-integration, test-environments.

开发编程契约测试Pact服务契约通用
47
Stars
10
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/contract-testing/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/contract-testing/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
<objective>
A provider renames a response field. Both services pass their own unit tests, and the
mismatch only surfaces in production when the consumer's frontend breaks. Contract testing
catches that in CI: the consumer declares exactly what it needs, the provider verifies it
can deliver, and `can-i-deploy` blocks the deploy until the broker confirms both sides are
compatible. This skill produces Pact consumer tests, broker-driven provider verification,
and the deployment gate that ties them together — so services can be deployed independently
without a shared integration environment.
</objective>

## Discovery Questions

Check `.agents/qa-project-context.md` first — if it exists, use it a
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有