AGENT SKILL

api-contract-hardening

Harden REST API contracts with validation, pagination, stable response shapes, and error handling.

License 许可
MIT
最近更新
2026-05-28
Stars
★ 0
Forks
0

01 前言 Front Matter

name
api-contract-hardening
author
Siming
license
MIT
version
1.0.0
metadata
{ "siming": { "tags": [ "backend", "api", "contract" ] } }
description
Harden REST API contracts with validation, pagination, stable response shapes, and error handling.

03 SKILL.md 正文

API Contract Hardening

Use this skill when implementing or reviewing HTTP APIs.

Workflow

  1. Define request DTOs and response shapes before implementation.
  2. Validate pagination, sorting, filters, and IDs.
  3. Keep empty results as valid responses, not errors.
  4. Return stable error codes and messages.
  5. Add tests for invalid input and empty data.

Checks

  • No endpoint returns different shapes for success and empty lists.
  • Pagination metadata is stable.

04 同仓库更多 Skills