api-review

Analyzes HTTP API surface areas in code diffs for REST compliance and security.

Updated Jan 6, 2023
One-click install
npx skills add https://github.com/pekral/phpstan-rules --skill api-review-pekral
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-review
Source: https://github.com/pekral/phpstan-rules/tree/main/.claude/skills/api-review
Command: npx skills add https://github.com/pekral/phpstan-rules --skill api-review-pekral

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the risk of shipping inconsistent, insecure, or non-idempotent API contracts by providing a structured, automated review lens for HTTP endpoints and route definitions.

Core Features & Use Cases

  • Contract Validation: Detects leaks of internal database structures and ensures consistent field naming and error envelopes.
  • REST Semantics Enforcement: Flags improper use of HTTP methods, non-idempotent state mutations, and incorrect status code usage.
  • Use Case: When a developer submits a PR adding a new payment endpoint, this Skill automatically verifies that the route uses proper idempotency keys and returns the correct 201/202 status codes instead of generic responses.

Quick Start

Invoke the api-review skill on the current diff to audit all modified routes and controller logic for REST compliance.

Frequently Asked Questions about api-review

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

FAQPage Schema
How do I validate REST API designs in code diffs for contract violations?

HTTP API design review detects improper HTTP method usage, non-idempotent state mutations, and incorrect status codes in route definitions and controller handlers. It validates REST semantics to ensure consistent, consumer-ready API contracts across modified endpoints.

How do I enforce idempotency and correct status codes for new HTTP endpoints?

Enforce idempotency and correct status codes by auditing HTTP endpoints in code diffs against RESTful design principles. This validates that state mutations use proper idempotency keys and return specific 201/202 responses instead of generic errors.

Does this API review process check for database structure leaks in DTOs?

Yes, API contract validation detects leaks of internal database structures by analyzing DTOs and route definitions. It ensures consistent field naming and standardized error envelopes to prevent exposing internal data structures through the API surface.

Can I use this to review controller handlers for trust-boundary bypasses?

Yes, you can review controller handlers for trust-boundary bypasses by analyzing HTTP API surface areas in code diffs. This validates API designs against established security best practices and architectural standards for secure error handling.

What are the limitations of automated REST compliance checking for HTTP APIs?

Automated REST compliance checking operates strictly on route definitions, controller handlers, and DTOs found in code diffs. It cannot detect runtime security vulnerabilities or business logic flaws outside the analyzed API surface area and architectural standards.