Skip to content
Development
Command

/create-contract

Create a Pact contract definition for consumer-driven contract testing.

From plugin
rohitg00-claude-code-toolkit
2.5k199 skills138 agents199 commands
Install
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/create-contract

Context preview

What this command does when you run it.

Create a Pact contract definition for consumer-driven contract testing.

Command definition

create-contract.md

/create-contract - Create API Contract

Create a Pact contract definition for consumer-driven contract testing.

Steps

1. Ask the user for the consumer service name and provider service name 2. Identify the API interactions to define (endpoints, methods, request/response schemas) 3. Check if Pact is installed in the project; if not, suggest installation 4. Create the contract test file with consumer and provider configuration 5. Define each interaction: request method, path, headers, query params, and body 6. Specify expected response status codes, headers, and body matchers 7. Use Pact matchers (like, eachLike, term) for flexible matching instead of exact values 8. Add provider states for each interaction describing required preconditions 9. Generate the contract test and run it to produce the Pact file 10. Validate the generated Pact JSON file is well-formed 11. Save the Pact file to the pacts directory for sharing with the provider team

Rules

  • Use semantic versioning for consumer and provider names
  • Prefer Pact matchers over exact value matching for resilient contracts
  • Each interaction must have a unique description
  • Include both success and error response scenarios
  • Do not include authentication tokens in the contract; use provider states instead
  • Keep contracts focused on the data structure, not specific values
  • Name contract files as `consumer-provider.json`
Read more
Ships withrohitg00-claude-code-toolkit

The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.

Get the whole plugin