api-first-design

A workflow for designing a new API endpoint, which is a programmed interface that other software can call. It covers requirements, data schemas, an OpenAPI specification, implementation, tests, and documentation.

In plain words
What is it for?
Use it when creating an API or endpoint to define operations, access rules, JSON request and response formats, status codes, pagination, server code, and integration tests.
Why use it?
It gives the API a defined contract before implementation, reducing mismatches between request data, responses, validation, errors, and documentation.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/hubertlim/skillforge/api-first-design
Any agent
npx skills add hubertlim/SkillForge --skill api-first-design
Clone the repo
git clone --depth 1 https://github.com/hubertlim/SkillForge

Made for: Claude Code, Codex.

Per session 12 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 213 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00012 $0.00213
Opus 5 $0.00006 $0.00106
Sonnet 5 $0.00002 $0.00043
Haiku 4.5 $0.00001 $0.00021

Measured yesterday against content hash 37ef3263d416, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-first-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 yesterday.

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.

community-skills/api-first-design/SKILL.md · 46 lines

What it actually says

Step 1: Requirements

Gather and document API requirements

  • Identify consumers of the API
  • List required operations (CRUD, search, etc.)
  • Define authentication and authorization needs

Step 2: Schema Design

Define request and response schemas

  • Design resource models and relationships
  • Define JSON schemas for each endpoint
  • Standardize error response format
  • Plan pagination and filtering

Step 3: OpenAPI Spec

Write the API specification

  • Create OpenAPI/Swagger document
  • Add request/response examples
  • Document all status codes

Step 4: Implement

Build the API from the spec

  • Generate server stubs from the spec
  • Implement business logic
  • Add input validation matching the schema

Step 5: Test and Document

Validate and publish

  • Write integration tests for each endpoint
  • Test error cases and edge conditions
  • Generate documentation from the spec
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. yesterday First seen · 46 lines · 12 tokens per session scan A 37ef3263d416

Subscribe to this mod's changes

api-first-design is a skill published in the GitHub repository hubertlim/SkillForge (5 stars, last pushed 4mo ago), licensed MIT. It adds 12 tokens to every session and 213 once invoked, about $0.0001 per session on Opus 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-08-31.

Related

Other skills, from other repositories

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens

react-query-setup

Set up @trpc/tanstack-react-query with createTRPCContext(), TRPCProvider, useTRPC() hook, queryOptions/mutationOptions factories, query invalidation via queryClient.invalidateQueries with queryFilter, and type inference with inferInput/inferOutput.

trpc/trpc · 60 tokens

non-json-content-types

Handle FormData, file uploads, Blob, Uint8Array, and ReadableStream inputs in tRPC mutations. Use octetInputParser from @trpc/server/http for binary data. Route non-JSON requests with splitLink and isNonJsonSerializable() from @trpc/client. FormData and binary inputs only work with mutations (POST).

trpc/trpc · 75 tokens

middlewares

Create and compose tRPC middleware with t.procedure.use(), extend context via opts.next({ ctx }), build reusable middleware with .concat() and .unstablepipe(), define base procedures like publicProcedure and authedProcedure. Access raw input with getRawInput(). Logging, timing, OTEL tracing patterns.

trpc/trpc · 63 tokens

server-side-calls

Call tRPC procedures directly from server code using t.createCallerFactory() and router.createCaller(context) for integration testing, internal server logic, and custom API endpoints. Catch TRPCError and extract HTTP status with getHTTPStatusCodeFromError(). Error handling via onError option.

trpc/trpc · 61 tokens

trpc-router

Entry point for all tRPC skills. Decision tree routing by task: initTRPC.create(), t.router(), t.procedure, createTRPCClient, adapters, subscriptions, React Query, Next.js, links, middleware, validators, error handling, caching, FormData.

trpc/trpc · 59 tokens