Przejdź do treści
Biblioteka skilli
Programowanie · Planowanie

api-design

/api-design

Pomaga projektować i przeglądać API HTTP: modelowanie zasobów, kody statusu, paginacja, idempotencja, wersjonowanie i formaty błędów, które łamią klientów.

Licencja
MIT
Ostatnia zmiana repozytorium
24.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
1
Przestarzałość

Brak sygnałów. Repozytorium zmienione 24.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pomaga projektować i przeglądać API HTTP: modelowanie zasobów, kody statusu, paginacja, idempotencja, wersjonowanie i formaty błędów, które łamią klientów.

Wyzwalacze z opisu

design the endpoints for thiswhat status code should this returnhow should we paginate this apireview our openapi spec
Oryginalny opis (EN)

Use when designing or reviewing an HTTP API. Covers resource modeling, status codes, pagination, idempotency, versioning, error formats, and the contract details that break clients when you get them wrong. Trigger on "design the endpoints for this", "what status code should this return", "how should we paginate this api", "review our openapi spec". Do not use for GraphQL schemas — see the graphql skill.

Jak działa

  1. Purpose
  2. When to Use
  3. Capabilities
  4. Inputs
  5. Outputs
  6. Workflow
  7. Best Practices
  8. Examples
  9. Notes
Sekcje z nagłówków SKILL.md, w oryginale · 91 linii, 585 słów
Podgląd SKILL.md
---
name: api-design
description: Use when designing or reviewing an HTTP API. Covers resource modeling, status codes, pagination, idempotency, versioning, error formats, and the contract details that break clients when you get them wrong. Trigger on "design the endpoints for this", "what status code should this return", "how should we paginate this api", "review our openapi spec". Do not use for GraphQL schemas — see the graphql skill.
metadata:
  category: backend
  version: 1.0.0
  tags: [api, rest, http, openapi, versioning]
---

# API Design

## Purpose

Design HTTP APIs that clients can use correctly without reading your source code, and that you can evolve without breaking them.

## When to Use

- Designing a new API or a new endpoint on an existing one.
- Reviewing an API before it becomes public and therefore permanent.
- Introducing versioning, pagination, or idempotency to an API that lacks them.
- Writing or auditing an OpenAPI specification.

## Capabilities

- Resource and URL modeling.
- Status-code semantics and consistent error payloads (RFC 9457 problem details).
- Pagination strategies and their trade-offs.
- Idempotency for unsafe methods.
- Versioning and deprecation without breaking clients.
- OpenAPI specification as the source of truth.

## Inputs

- The domain operations the API must expose.
- Client types: first-party, third-party, mobile, machine.
- Expected volume, page sizes, and latency requirements.

## Outputs

- An OpenAPI 3.1 specification.
- Consistent error and pagination formats across every endpoint.
- A documented versioning and deprecation policy.

## Workflow

1. **Model resources, not procedures** — `POST /orders/{id}/refunds` rather than `POST /refundOrder`. When an operation genuinely is not a resource, it is fine to say so, but check first.
2. **Fix the status codes** — 200 for a body, 201 with a `Location` for creation, 202 for accepted-but-not-done, 400 for malformed, 401 versus 403 correctly, 409 for conflict, 422 for semantically invalid, 429 with `Retry-After`.
3. **Standardize errors** — One shape, every endpoint. RFC 9457 problem details, with a machine-readable `type` and field-level detail.
4. **Choose pagination deliberately** — Cursor-based for anything that mutates or is large. Offset only for small, static datasets.
5. **Make unsafe methods idempotent** — Accept an `Idempotency-Key` header on POST; return the original response on replay.
6. **Version from day one** — Even if the first version is the only one. Retrofitting a version is far worse than carrying one.

## Best Practices

- Never return a bare array as a top-level response. `{"data": [...], "next_cursor": "..."}` leaves room to add fields; `[...]` does not.
- 200 with `{"error": ...}` is a defect. Clients branch on status codes.
- Field names are permanent. Choose them as carefully as a database column.
- Do not expose internal identifiers or enum integers. Use opaque IDs and string enums.
- Any list endpoint without a limit will eventually be called with a million rows behind it. Cap it, and document the cap.
- Deprecate with headers (`Deprecation`, `Sunset`) and a timeline, not with an announcement nobody reads.

## Examples

**Cursor pagination and problem-details errors:**

```http
GET /v1/orders?limit=50&cursor=eyJpZCI6IjAxSFgifQ HTTP/1.1

200 OK
{
  "data": [ { "id": "ord_01HX...", "total_cents": 4200, "currency": "USD" } ],
  "next_cursor": "eyJpZCI6IjAxSFkifQ",
  "has_more": true
}
```

```http
POST /v1/orders HTTP/1.1
Idempotency-Key: 4f3a2b1c-...

422 Unprocessable Content
Content-Type: application/problem+json
{
  "type": "https://api.example.com/errors/validation",
  "title": "Order validation failed",
  "status": 422,
  "detail": "One or more line items are invalid.",
  "errors": [
    { "field": "items[0].quantity", "code": "min", "message": "must be at least 1" }
  ]
}
```

## Notes

- Cursor pagination is stable under concurrent inserts; offset pagination silently skips and duplicates rows. If the data mutates, offset is a correctness bug, not a performance one.
- Idempotency keys must be stored with the response and a TTL, keyed by (key, endpoint, request-hash). Returning a cached response for a *different* body under the same key is worse than not having idempotency at all.
- URL versioning (`/v1/`) is the least elegant and the most operationally forgiving. Header-based versioning is cleaner and much harder to debug in a proxy log.

Wersje

RepozytoriumWynikLicencja
Ta strona · nimadorostkar/Claude-Skills-collection100MIT
proyecto26/system-design-skills100MIT
ericrisco/rsc-harness100MIT
yonatangross/orchestkit100MIT
travisjneuman/.claude100MIT
wrongstack/wrongstack100MIT
komluk/scaffolding100MIT
OKHP3/skillz100MIT
event4u-app/agent-config100MIT

Migawka bazy z 28.10.2026 · wersja paczki 1ec29e2eab1b (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100api-design-expert
    Wspiera projektowanie i recenzję API REST i GraphQL: modelowanie zasobów, kody statusu, wersjonowanie, paginacja kursorowa, idempotencja, błędy, limity i kontrakty.
  • 100api
    Pomaga projektować, recenzować i zmieniać API HTTP, REST lub GraphQL: endpointy, nazwy zasobów, odpowiedzi błędów, paginacja, wersjonowanie, idempotencja i kontrakty między usługami.
  • 85backend-api-design-review
    Sprawdza projekt API REST i GraphQL: modelowanie zasobów, semantykę metod, kody statusu, idempotentność, wersjonowanie i paginację.
  • 100api-designer
    Pomaga projektować API REST lub GraphQL i pisać specyfikacje OpenAPI: modelowanie zasobów, wersjonowanie, paginacja i standardy obsługi błędów.
  • 100api-designer
    Projektuje API REST i GraphQL, tworzy specyfikacje OpenAPI i planuje architekturę API: modelowanie zasobów, wersjonowanie, paginacja i standardy błędów.
  • 90api-design-review
    Przegląda kontrakt API REST lub GraphQL: nazwy zasobów, kody statusu, kształt błędów, paginację i zgodność wsteczną, z konkretnymi poprawkami.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.