Skip to content
Back to skills

Api Contract Tester

ASecurity

Implement consumer-driven contract testing with Pact to ensure API compatibility.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
ai-agentsjavascriptgojavatestingapici/cd

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill api-contract-tester --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Contract Tester?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Contract Tester
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/atulpurohit-api-contract-tester/badge)](https://www.skillsdirectory.com/skills/atulpurohit-api-contract-tester)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-contract-tester
description: "Implement consumer-driven contract testing with Pact to ensure API compatibility."
category: testing
tags: [api,contract,pact,integration,consumer-driven]
complexity: advanced
risk: low
compatibility: [claude-code, antigravity, gemini-cli, cursor, copilot, codex-cli, autohand, kiro]
source: antigravity-official
version: "1.0.0"
date_added: "2026-07-10"
last_updated: "2026-07-10"
---

# API Contract Tester

## Purpose
Prevent API breaking changes from reaching production by testing contracts between services.

## Pact Contract Testing

### Consumer Test
```javascript
const { Pact, like, term } = require('@pact-foundation/pact');

const provider = new Pact({ consumer: 'WebApp', provider: 'UsersAPI', port: 1234 });

test('GET /users/:id returns user', async () => {
  await provider.addInteraction({
    state: 'user 123 exists',
    uponReceiving: 'a request for user 123',
    withRequest: { method: 'GET', path: '/users/123', headers: { Accept: 'application/json' } },
    willRespondWith: {
      status: 200,
      body: {
        id: '123',
        email: like('user@example.com'),
        name: like('John Doe'),
        role: term({ generate: 'user', matcher: '^(user|admin)$' }),
      },
    },
  });
  const user = await UserService.getUser('123');
  expect(user.id).toBe('123');
});
```

### Provider Verification
```javascript
test('verifies consumers', () =>
  new Verifier({
    provider: 'UsersAPI',
    providerBaseUrl: 'http://localhost:3000',
    pactUrls: ['./pacts/WebApp-UsersAPI.json'],
    stateHandlers: {
      'user 123 exists': () => db.users.upsert({ id: '123', email: 'test@example.com' }),
    },
  }).verifyProvider()
);
```

## Outputs
1. Consumer pact tests
2. Provider verification setup
3. Pact broker configuration
4. CI/CD contract testing integration
5. Contract versioning strategy

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…