writing-openapi-specs

Apply standardized best practices to draft and validate OpenAPI specifications.

19|6|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/speakeasy-api/skills --skill writing-openapi-specs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-openapi-specs
Source: https://github.com/speakeasy-api/skills/tree/main/skills/writing-openapi-specs
Command: npx skills add https://github.com/speakeasy-api/skills --skill writing-openapi-specs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive reference for OpenAPI specification best practices, naming conventions, and expressing complex REST API patterns such as polymorphism, enums, file uploads, and server-sent events. It helps teams write clearer, more maintainable specs to drive reliable SDK generation and tooling.

Core Features & Use Cases

  • Standards-driven drafting: Guides on operationId naming, component organization, and consistent tag usage to produce SDK-friendly OpenAPI files.
  • Complex pattern guidance: Covers polymorphism with oneOf/allOf/anyOf, discriminators, enums, file uploads, streaming, and server-sent events.
  • SDK-oriented documentation: Aligns specs with patterns that improve code generation, testing, and cross-team collaboration.
  • Use cases: Ideal for drafting new specs, auditing existing definitions, and refactoring large OpenAPI documents for clarity and reuse.

Quick Start

Begin drafting or auditing an OpenAPI spec by applying the conventions in this guide, then validate results against the reference materials in the repository. Then iterate by converting a small endpoint example to follow the naming, components, and pattern recommendations.

Frequently Asked Questions about writing-openapi-specs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for writing OpenAPI specs to support SDK generation?

OpenAPI specs for SDK generation should apply standardized naming conventions for operationId, organize components consistently, and ensure documentation aligns with code generation patterns to produce reliable client libraries.

How do I use polymorphism and discriminators in an OpenAPI specification?

Polymorphism in an OpenAPI specification is expressed using oneOf, allOf, and anyOf keywords alongside discriminators to define complex object hierarchies, allowing APIs to return varying data structures based on specific property values.

How do you define file uploads and streaming endpoints in OpenAPI?

File uploads and streaming in OpenAPI are defined by applying specific best practice patterns for binary data and server-sent events, ensuring the specification accurately documents multipart payloads and continuous data streams.

Can I audit an existing OpenAPI definition against standard naming conventions?

Yes, existing OpenAPI definitions can be audited and refactored by validating them against established conventions for component organization, tag usage, and complex pattern documentation to improve maintainability and clarity.

What is the best way to organize components in a large OpenAPI document?

The best way to organize components in a large OpenAPI document is by applying standardized best practices for component organization, ensuring reusable schemas, parameters, and responses are structured for maximum clarity and reuse across endpoints.

When should I use enums in my OpenAPI specification?

Enums should be used in an OpenAPI specification when a property requires a fixed set of string or integer values, applying best practices to ensure the schema strictly validates inputs and improves SDK type safety.