api-design

api-design is a skill for Claude Code, Codex from kok-o/contextos-agents. It costs 37 tokens per session (652 once invoked), scanned A, original, Apache-2.0.

A set of practices for designing stable APIs and other software interfaces. It covers defining the contract first, checking data at boundaries, using consistent errors, and making repeated requests safe.

In plain words
What is it for?
Use it when designing REST or GraphQL APIs, RPC services, or internal module contracts. It helps define request and response shapes, validation rules, error formats, and idempotent operations.
Why use it?
It helps prevent clients from depending on accidental details and makes future interface changes less likely to break existing users.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when designing REST or GraphQL APIs, RPC services, or internal module contracts. It helps define request and response shapes, validation rules, error formats, and idempotent operations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kok-o/contextos-agents/api-design
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kok-o/contextos-agents --skill api-design
Clone the repo
git clone --depth 1 https://github.com/kok-o/contextos-agents

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-design

README.md
[![agentmods](https://agentmods.dev/badge/skills/kok-o/contextos-agents/api-design/github.svg)](https://agentmods.dev/skills/kok-o/contextos-agents/api-design)
Your own site
<a href="https://agentmods.dev/skills/kok-o/contextos-agents/api-design"><img src="https://agentmods.dev/badge/skills/kok-o/contextos-agents/api-design/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-design

Your own site · 80×15
<a href="https://agentmods.dev/skills/kok-o/contextos-agents/api-design"><img src="https://agentmods.dev/badge/skills/kok-o/contextos-agents/api-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 652 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.00652
Opus 5.5 $0.00015 $0.00261
Sonnet 5.5 $0.00007 $0.00130
Haiku 4.5 $0.00004 $0.00065

Measured today against content hash 31ee14b4a0b4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

catalog/skills/api-design/SKILL.md · 64 lines

How it starts

The opening of the file, as written. The whole thing — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API and Interface Design

Design stable, self-documenting, and robust interfaces that are hard to misuse. Good interfaces make the right thing easy and the wrong thing difficult. This applies to REST APIs, GraphQL schemas, RPC services, and internal module contracts.

Core Principles

1. Hyrum's Law Awareness

With a sufficient number of users of an API, all observable behaviors of your system will be depended on by somebody, regardless of what you promise in the contract.

Design implications:

  • Never leak internal implementation details: Database column names, raw ORM errors, stack traces, and internal IDs must never escape to clients.
  • Lock down response shapes: Undocumented extra fields or varying JSON key ordering become accidental dependencies.
  • Design for evolution: Additive changes are safe; removing, renaming, or changing types of fields requires a deprecation window.

2. Contract-First Development

Define the interface and data types before implementing handlers or controllers:

  1. Specify TypeScript interfaces, JSON Schemas, or OpenAPI documents.
  2. Review the contract independently of database models.
  3. Generate server stubs and client SDK types from the unified contract.

3. Uniform Error Semantics

All API error responses must adhere to a single predictable schema across the entire application:

interface APIErrorResponse {
  error: {
    code: string;        // Machine-readable uppercase token (e.g., "VALIDATION_FAILED")
    message: string;     // Clear, user-safe human-readable description
    details?: unknown;   // Specific field errors or structured context
  };
}

Standard HTTP status mappings:

  • 400 Bad Request: Malformed syntax or unparseable request body.
  • 401 Unauthorized: Authentication credentials missing or invalid.
  • 403 Forbidden: Authenticated, but lacks required permissions.
  • 404 Not Found: Target resource does not exist.
  • 409 Conflict: Resource state conflict (e.g., duplicate unique key).
  • 422 Unprocessable Entity: Well-formed request failed semantic validation.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: Unhandled server condition (never leak stack details).

Read the full file on GitHub · 64 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 64 lines · 37 tokens per session scan A 31ee14b4a0b4

Subscribe to this mod's changes

api-design is a skill published in the GitHub repository kok-o/contextos-agents (10 stars, last pushed today), licensed Apache-2.0. It adds 37 tokens to every session and 652 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-25.