ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
OpenAPI 3.1 specification, schema design, code generation
$ npx -y skills add agents-inc/skills --skill api-specs-openapi --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/api-specs-openapiContext preview
The summary Claude sees to decide when to auto-load this skill.
OpenAPI 3.1 specification, schema design, code generation
name: api-specs-openapi description: OpenAPI 3.1 specification, schema design, code generation
> **Quick Guide:** Use OpenAPI 3.1 for API contracts. 3.1 is a superset of JSON Schema Draft 2020-12 -- use `type: ["string", "null"]` instead of `nullable: true`. Define all reusable schemas in `components/schemas` and reference with `$ref`. Always include `operationId` on every operation (it becomes the client method name). Use `openapi-typescript` to generate zero-runtime TypeScript types and `openapi-fetch` for a 6kb type-safe fetch client.
---
<critical_requirements>
> **All code must follow project conventions in CLAUDE.md** (kebab-case, named exports, import ordering, `import type`, named constants)
**(You MUST use OpenAPI 3.1 syntax -- `type: ["string", "null"]` NOT the 3.0 `nullable: true` keyword)**
**(You MUST define reusable schemas in `components/schemas` and reference with `$ref` -- NO inline schema duplication)**
**(You MUST include `operationId` on every path operation -- it becomes the generated client method name)**
**(You MUST use `openapi-typescript` for type generation and import types with `import type` -- types are zero-runtime)**
</critical_requirements>
---
**Auto-detection:** OpenAPI, openapi, swagger, openapi-typescript, openapi-fetch, createClient, paths, components, schemas, operationId, $ref, discriminator, oneOf, allOf, anyOf, openapi: "3.1", spec-first, API contract, API specification, code generation, schema design
**When to use:**
**When NOT to use:**
**Key patterns covered:**
**Detailed Resources:**
---
<philosophy>
**The spec IS the contract.** An OpenAPI document is the single source of truth for your API's shape. Types, documentation, client SDKs, and server validation are all derived from it -- never maintained separately.
**OpenAPI 3.1 aligns with JSON Schema Draft 2020-12.** This means any valid JSON Schema is a valid OpenAPI schema. Use `type` arrays for nullable (`["string", "null"]`), `if/then/else` for conditional schemas, and standard JSON Schema vocabulary.
**Spec-first (design-first) is recommended** for stable, multi-consumer APIs. Define the contract first, get feedback from consumers via mocks, then implement. Code-first works for rapid prototypes where the spec is generated from annotations.
**Use spec-first when:**
**Use code-first when:**
</philosophy>
---
<patterns>
Every OpenAPI 3.1 document has four required top-level fields: `openapi`, `info`, `paths` (or `webhooks`), and implicitly `components` for reusable schemas.
openapi: "3.1.0"
info:
title: Jobs API
version: "1.0.0"
description: Job listings and applications
servers:
- url: https://api.example.com/v1
paths:
/jobs:
get:
operationId: listJobs
# ...
components:
schemas:
Job:
# ...**Why good:** `operationId` becomes the client method name, `servers` enables environment switching, schemas in `components` are reusable via `$ref`
See [examples/core.md](examples/core.md) for complete spec with paths, parameters, and responses.
---
OpenAPI 3.1 uses JSON Schema Draft 2020-12. Key differences from 3.0: `nullable` is removed, use `type` arrays instead. `exclusiveMinimum`/`exclusiveMaximum` are numbers, not booleans.
# 3.1 nullable syntax type: ["string", "null"] # NOT 3.0 syntax: # type: string # nullable: true
components:
schemas:
Salary:
type: object
required: [min, max, currency]
properties:
min:
type: integer
minimum: 0
max:
type: integer
minimum: 0
currency:
type: string
minLength: 3
maxLength: 3
description: ISO 4217 currency code**Why good:** aligns with standard JSON Schema, tooling ecosystem understands it natively, `required` array is explicit
See [examples/core.md](examples/core.md) for enum, format, and composition examples.
---
Define schemas once in `components/schemas`, reference everywhere with `$ref`. Us
The official skills marketplace for Agents Inc. 150+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Repo: agents-inc/skills
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking, virtual keys, and production…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client patterns
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling, embeddings, image generation,…