/harness-claude:test-contract-testingfrom harness-claude
Sets up and runs Pact consumer-driven contract tests to verify API compatibility between services.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:test-contract-testing still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Verify service compatibility using Pact consumer-provider contract tests
npm install -D @pact-foundation/pact
import { PactV4 } from '@pact-foundation/pact';
const provider = new PactV4({
consumer: 'OrderService',
provider: 'UserService',
});
describe('UserService API', () => {
it('returns user by ID', async () => {
await provider
.addInteraction()
.given('a user exists with ID 123')
.uponReceiving('a request for user 123')
.withRequest('GET', '/api/users/123', (builder) => {
builder.headers({ Accept: 'application/json' });
})
.willRespondWith(200, (builder) => {
builder.headers({ 'Content-Type': 'application/json' }).jsonBody({
id: '123',
name: 'Alice',
email: '[email protected]',
});
})
.executeTest(async (mockServer) => {
const client = new UserClient(mockServer.url);
const user = await client.getUser('123');
expect(user).toEqual({
id: '123',
name: 'Alice',
email: '[email protected]',
});
});
});
});
Generate the pact file — running the consumer test creates a contract file (e.g., pacts/OrderService-UserService.json).
Verify on the provider side:
import { Verifier } from '@pact-foundation/pact';
describe('Pact Verification', () => {
it('validates the OrderService contract', async () => {
const verifier = new Verifier({
providerBaseUrl: 'http://localhost:3001',
pactUrls: ['./pacts/OrderService-UserService.json'],
stateHandlers: {
'a user exists with ID 123': async () => {
await seedUser({ id: '123', name: 'Alice', email: '[email protected]' });
},
},
});
await verifier.verifyProvider();
});
});
// Consumer publishes
await publishPacts({
pactFilesOrDirs: ['./pacts'],
pactBroker: 'https://your-broker.pactflow.io',
consumerVersion: process.env.GIT_SHA,
tags: ['main'],
});
// Provider verifies from broker
const verifier = new Verifier({
providerBaseUrl: 'http://localhost:3001',
pactBrokerUrl: 'https://your-broker.pactflow.io',
providerVersionTags: ['main'],
publishVerificationResult: true,
});
stateHandlers: {
'no users exist': async () => {
await db.user.deleteMany();
},
'a user exists with ID 123': async () => {
await db.user.upsert({
where: { id: '123' },
create: { id: '123', name: 'Alice', email: '[email protected]' },
update: {},
});
},
},
import { like, eachLike, regex } from '@pact-foundation/pact';
.jsonBody({
id: like('123'), // any string
name: like('Alice'), // any string
email: regex(/.*@.*/, '[email protected]'), // matches regex
posts: eachLike({ title: like('Post') }), // array of objects
})
Contract testing verifies that two services agree on the format of their communication. The consumer defines its expectations as a "contract," and the provider verifies it can fulfill that contract.
Consumer-driven contracts: The consumer writes the contract because it knows what it needs. The provider verifies it can deliver. This ensures the provider does not make breaking changes that affect consumers.
Contract vs integration vs E2E:
Contract tests are faster and more focused than integration tests but do not verify business logic.
Pact workflow:
Trade-offs:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communication/a11y-image-text-altImage and Text Alternatives> Write effective alt text for images and provide text alternatives for all non-text content/a11y-keyboard-navigationKeyboard Navigation> Ensure all interactive elements are reachable and operable via keyboard alone without requiring a mouse/a11y-modal-patternsAccessible Modal Dialog Patterns> Build accessible modal dialogs with focus trapping, escape dismissal, background inertness, and screen reader announcementsOther plugins' skills for the same job