Skip to content
Back to skills

Design Api Contract

ASecurity

Designs an API contract before implementation, with operations, schemas, errors, pagination, idempotency and evolution rules. Use when adding an API that other teams or clients will call.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 26, 2026
ai-agentsgoapi

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill design-api-contract --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Design Api Contract?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Design Api Contract
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-design-api-contract/badge)](https://www.skillsdirectory.com/skills/hermes-hq-design-api-contract)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: design-api-contract
description: Designs an API contract before implementation, with operations, schemas, errors, pagination, idempotency and evolution rules. Use when adding an API that other teams or clients will call.
license: CC0-1.0
arguments:
  - capability
  - consumers
  - style
  - conventions
argument-hint: <capability> [consumers] [style] [conventions]
disable-model-invocation: true
metadata:
  version: 1.0.0
  kind: prompt
  category: architecture
  source: https://hermes-ide.com/prompts/design-api-contract
  catalog: 2026.1014.1
---

# Design an API contract

## Inputs

- `capability` (required): What the API must let its clients do, in plain words or as user stories.
- `consumers` (optional): Who calls the API (web app, mobile app, partners, internal services) and their constraints.
- `style` (optional; one of: auto, rest, graphql, grpc; default: auto): API style. auto picks one and justifies it.
- `conventions` (optional): Existing API conventions to follow (naming, error format, auth, pagination), or a sample of an existing endpoint.

Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.

<context>
An API contract is a promise that outlives its first implementation: once clients depend on it, every field name, error shape and default is expensive to change. Designing the contract first, from the consumers' point of view, catches the expensive mistakes while they are still cheap to fix.
</context>

<task>
Design the API contract for: $capability
Only if consumers was provided: 
Consumers and their constraints:
$consumers
Only if conventions was provided: 
Existing conventions to follow exactly:
$conventions
Style: $style. If it is auto, choose REST, GraphQL or gRPC and justify the choice in one sentence based on the consumers.

1. Restate the capability as the operations consumers need, phrased from their side ("list my open orders", not "query the orders table").
2. Model the resources (or types, or services) and the operations on them. Keep names consistent, plural for collections, and free of internal storage details.
3. Define every request and response schema: field names, types, required or optional, formats and constraints (length, range, enum values). Use opaque string ids, RFC 3339 UTC timestamps, and money as an integer amount in minor units plus an ISO 4217 currency code, unless the conventions say otherwise.
4. Define the error model: one consistent shape (for HTTP, RFC 9457 problem details unless the conventions differ), the status or error codes each operation can return, and which errors are safe to retry.
5. Add the cross-cutting behaviour that applies: pagination for lists (cursor-based by default), filtering and sorting, idempotency keys for operations that create or charge, optimistic concurrency (ETag and If-Match, or a version field) for updates, authentication and authorization scopes per operation, and rate limits.
6. Write the evolution rules: what counts as a compatible change, how breaking changes are versioned, and how fields are deprecated.
</task>

<constraints>
- Design the contract only. No server implementation code.
- Do not invent business rules (limits, states, permissions, pricing). When the contract needs one that was not given, choose a placeholder, mark it as an assumption and list it under Assumptions and open questions.
- Follow the given conventions over these defaults whenever they conflict.
- Include one realistic request and response example for each main operation.
- Prefer fewer, well-shaped operations over one endpoint per screen.
- Separate what you verified from what you inferred. Mark inferences as such.
- When you do not know, say "I don't know" once and state what would settle it.
</constraints>

<output_format>
## Summary
Style chosen and why, the resources, and the main design choices, in at most 6 lines.
## Operations
Table: operation, method and path (or query, mutation or RPC name), purpose, auth scope, idempotent (yes or no).
## Contract
One fenced block with the machine-readable contract: OpenAPI 3.1 YAML for REST, SDL for GraphQL, proto3 for gRPC. Include the examples.
## Errors
Table: code, when it happens, retryable (yes or no).
## Evolution and compatibility
Bullets.
## Assumptions and open questions
Numbered. Each assumption says what it affects.
</output_format>

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.