Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate API contracts and OpenAPI specifications from code or design documents. Use when documenting API contracts and specifications. Trigger with phrases like "generate API contract", "create OpenAPI spec", or "document API contract".
.claude/skills/jeremylongshore-generating-api-contracts/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 13% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 67% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 74% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 28% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 46% | 0% |
Generate OpenAPI 3.0/3.1 specifications and consumer-driven contract tests from existing API implementations, design documents, or database schemas. Produce machine-readable contracts that serve as the single source of truth for code generation, documentation, testing, and gateway configuration, with Pact integration for consumer-driven contract verification.
info (title, version, description), servers (environment URLs), paths (operations), and components (reusable schemas).type, format, required, minimum/maximum, pattern (regex), enum, and example values for every property.bearerAuth, apiKey, oauth2) and apply them to appropriate operations using the security field.See ${CLAUDE_SKILL_DIR}/references/implementation.md for the full implementation guide.
${CLAUDE_SKILL_DIR}/openapi.yaml - Complete OpenAPI 3.0/3.1 specification${CLAUDE_SKILL_DIR}/contracts/pact/ - Consumer-driven contract definitions (Pact JSON)${CLAUDE_SKILL_DIR}/contracts/postman/ - Generated Postman collection for API testing${CLAUDE_SKILL_DIR}/tests/contract/consumer/ - Consumer contract test implementations${CLAUDE_SKILL_DIR}/tests/contract/provider/ - Provider verification test suite${CLAUDE_SKILL_DIR}/scripts/generate-contract.sh - Contract generation automation script| Error | Cause | Solution | |-------|-------|----------| | Spec-code divergence | API implementation changed without updating the OpenAPI spec | Add CI check that generates spec from code and diffs against committed spec | | Pact verification failure | Provider response does not match consumer expectation | Review consumer contract for correctness; update provider if contract is valid | | Missing operation ID | Endpoint has no operationId, preventing code generation | Generate deterministic operation IDs from method + path (e.g., getUsers, createUser) | | Circular schema reference | Components reference each other creating infinite recursion | Break cycles with allOf composition or introduce intermediate types | | Example/schema mismatch | Example values do not validate against their own schema | Auto-validate all examples during spec generation; reject mismatched examples |
Refer to ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error patterns.
Code-first OpenAPI generation: Scan Express route decorators and Zod validation schemas to auto-generate a complete OpenAPI 3.1 spec with accurate request/response schemas, examples, and descriptions.
Consumer-driven contract testing: Frontend team publishes Pact contracts defining the API interactions they depend on; backend CI verifies every contract on each deployment, preventing breaking changes.
Design-first workflow: Author OpenAPI spec in Stoplight Studio, generate server stubs and client SDKs from the spec, then implement business logic in the stubs -- spec stays as the single source of truth.
See ${CLAUDE_SKILL_DIR}/references/examples.md for additional examples.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 40,757 | 13,308 | -67% | 1 | 1 | 0% | 8,287 | 1,223 | -85% | 0 | 0 | — |
case-02 | fail→fail | 40,249 | 4,840 | -88% | 1 | 1 | 0% | 8,246 | 1,393 | -83% | 0 | 0 | — |
case-03 | fail→pass | 39,691 | 34,852 | -12% | 1 | 1 | 0% | 8,271 | 9,334 | +13% | 0 | 0 | — |
case-04 | pass→pass | 21,487 | 14,232 | -34% | 1 | 1 | 0% | 2,766 | 3,536 | +28% | 0 | 0 | — |
case-05 | pass→pass | 13,827 | 18,934 | +37% | 1 | 1 | 0% | 2,387 | 3,489 | +46% | 0 | 0 | — |
case-06 | fail→pass | 18,537 | 20,089 | +8% | 1 | 1 | 0% | 2,300 | 3,846 | +67% | 0 | 0 | — |
case-07 | fail→pass | 16,008 | 23,923 | +49% | 1 | 1 | 0% | 2,587 | 4,506 | +74% | 0 | 0 | — |
case-08 | pass→pass | 18,015 | 18,837 | +5% | 1 | 1 | 0% | 2,187 | 3,447 | +58% | 0 | 0 | — |
case-09 | pass→pass | 10,569 | 17,744 | +68% | 1 | 1 | 0% | 1,898 | 3,481 | +83% | 0 | 0 | — |
case-10 | pass→pass | 19,148 | 11,029 | -42% | 1 | 1 | 0% | 3,176 | 3,332 | +5% | 0 | 0 | — |
case-11 | pass→pass | 12,922 | 10,108 | -22% | 1 | 1 | 0% | 2,928 | 3,177 | +9% | 0 | 0 | — |
case-12 | pass→pass | 9,707 | 15,069 | +55% | 1 | 1 | 0% | 2,343 | 3,400 | +45% | 0 | 0 | — |
case-13 | pass→pass | 17,020 | 13,463 | -21% | 1 | 1 | 0% | 2,768 | 4,149 | +50% | 0 | 0 | — |
case-14 | pass→pass | 14,923 | 12,635 | -15% | 1 | 1 | 0% | 2,945 | 3,864 | +31% | 0 | 0 | — |
case-15 | pass→pass | 15,137 | 15,481 | +2% | 1 | 1 | 0% | 3,055 | 4,254 | +39% | 0 | 0 | — |
case-16 | pass→pass | 13,716 | 10,721 | -22% | 1 | 1 | 0% | 2,608 | 3,240 | +24% | 0 | 0 | — |
case-17 | fail→fail | 23,810 | 32,288 | +36% | 1 | 1 | 0% | 3,499 | 5,711 | +63% | 0 | 0 | — |
case-18 | pass→pass | 15,774 | 31,276 | +98% | 1 | 1 | 0% | 2,601 | 6,361 | +145% | 0 | 0 | — |
case-19 | pass→pass | 15,392 | 29,215 | +90% | 1 | 1 | 0% | 2,305 | 5,678 | +146% | 0 | 0 | — |
case-20 | pass→pass | 14,511 | 25,655 | +77% | 1 | 1 | 0% | 2,937 | 5,416 | +84% | 0 | 0 | — |
case-21 | pass→pass | 12,033 | 15,917 | +32% | 1 | 1 | 0% | 2,396 | 3,121 | +30% | 0 | 0 | — |
case-22 | pass→pass | 10,950 | 11,894 | +9% | 1 | 1 | 0% | 2,172 | 3,481 | +60% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +14 percentage points is the difference between those two pass rates over the 20 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.