api-contract-review

Audit REST API controllers for HTTP semantics, versioning, and backward compatibility.

Updated Apr 20, 2020
One-click install
npx skills add https://github.com/UnterrainerInformatik/java-rdb-utils --skill api-contract-review-unterrainerinformatik
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-contract-review
Source: https://github.com/UnterrainerInformatik/java-rdb-utils/tree/main/.agents/skills/api-contract-review
Command: npx skills add https://github.com/UnterrainerInformatik/java-rdb-utils --skill api-contract-review-unterrainerinformatik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? REST APIs often ship with subtle design flaws—wrong HTTP verbs, missing versioning, leaked JPA entities, or 200 responses carrying error bodies—that break clients and complicate maintenance. This Skill audits existing API controllers against REST best practices so issues are caught before release. ## Core Features & Use Cases - HTTP Semantics Audit: Verifies correct verb usage (GET vs POST vs PUT vs PATCH vs DELETE), idempotency, and safe-method rules. - Versioning & Compatibility Checks: Detects unversioned endpoints and identifies breaking changes such as removed fields, renamed paths, or newly required request parameters. - Response & Error Design Review: Flags entity leaks, inconsistent response structures, missing pagination, improper status codes, and stack traces exposed in error responses. - Use Case: Before merging a pull request that modifies Spring controllers, run this review to confirm endpoints use proper status codes, DTOs instead of entities, and that no breaking changes were introduced into the current API version. ## Quick Start Review the REST API in UserController for HTTP semantics, versioning, and backward compatibility issues.

Frequently Asked Questions about api-contract-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review a REST API for best practices?▼

Review each endpoint for correct HTTP verb usage, URL versioning, DTO-based request and response bodies, proper status codes, and consistent error formats. A structured checklist covering semantics, design, and compatibility ensures nothing is missed.

What are common REST API design mistakes in Spring Boot?▼

Common mistakes include using POST for idempotent updates, returning JPA entities directly, omitting API versioning, returning HTTP 200 with error bodies, and exposing stack traces in error responses. Each of these breaks client expectations or leaks internals.

Which API versioning strategy should I use?▼

URL path versioning like /api/v1/users is recommended because it is explicit, easy to route, and simple to test. Header and query-parameter versioning keep URLs clean but are harder to discover and easier to forget.

What counts as a breaking change in a REST API?▼

Breaking changes include removing endpoints or response fields, adding required request fields, changing field types, renaming fields, and changing URL paths. Safe changes include adding optional request fields, new response fields, and new endpoints.

Why should APIs not return JPA entities directly?▼

Returning JPA entities exposes internal fields like password hashes and internal IDs, and can trigger lazy-loading N+1 query problems. Mapping entities to response DTOs exposes only intended public fields and decouples the API from the database schema.