Agent SkillsRightNow-AI/openfang › openapi-expert

openapi-expert

GitHub

OpenAPI专家技能,专注于API规范设计、验证与代码生成。指导使用OpenAPI 3.x构建清晰一致的API契约,涵盖模式组合、安全定义及开发者体验优化。

crates/openfang-skills/bundled/openapi-expert/SKILL.md RightNow-AI/openfang

Trigger Scenarios

API规范设计与评审 OpenAPI文档编写 API代码生成配置

Install

npx skills add RightNow-AI/openfang --skill openapi-expert -g -y
More Options

Non-standard path

npx skills add https://github.com/RightNow-AI/openfang/tree/main/crates/openfang-skills/bundled/openapi-expert -g -y

Use without installing

npx skills use RightNow-AI/openfang@openapi-expert

指定 Agent (Claude Code)

npx skills add RightNow-AI/openfang --skill openapi-expert -a claude-code -g -y

安装 repo 全部 skill

npx skills add RightNow-AI/openfang --all -g -y

预览 repo 内 skill

npx skills add RightNow-AI/openfang --list

SKILL.md

Frontmatter
{
    "name": "openapi-expert",
    "description": "OpenAPI\/Swagger expert for API specification design, validation, and code generation"
}

OpenAPI Expert

An API design architect with deep expertise in the OpenAPI Specification, RESTful API conventions, and the tooling ecosystem for validation, documentation, and code generation. This skill provides guidance for designing clear, consistent, and evolvable API contracts using OpenAPI 3.0 and 3.1, covering schema composition, security definitions, versioning strategies, and developer experience optimization.

Key Principles

  • Design the API specification before writing implementation code; the spec serves as the contract between frontend, backend, mobile, and third-party consumers
  • Use $ref extensively to define reusable schemas, parameters, and responses in the components section; duplication across paths leads to inconsistency and maintenance burden
  • Version your API explicitly through URL path prefixes (/v1/, /v2/) or custom headers; never break existing consumers by changing response shapes without a version boundary
  • Write meaningful descriptions for every path, parameter, schema property, and response; the spec doubles as your API documentation and should be understandable without reading source code
  • Validate the spec in CI using linting tools to catch breaking changes, missing descriptions, inconsistent naming, and schema errors before they reach production

Techniques

  • Structure the OpenAPI document with info (title, version, contact), servers (base URLs per environment), paths (endpoints), and components (schemas, securitySchemes, parameters, responses)
  • Compose schemas using allOf for inheritance (base object + extension), oneOf for polymorphism (exactly one match), and anyOf for flexible unions (at least one match)
  • Provide request and response examples at both the schema level and the media type level; tools like Swagger UI and Redoc render these prominently for developer reference
  • Define security schemes (Bearer JWT, API key, OAuth2 flows) in components/securitySchemes and apply them globally or per-operation with the security field
  • Distinguish path parameters (/users/{id}), query parameters (?page=2&limit=20), and header parameters for different use cases; path parameters identify resources, query parameters filter or paginate
  • Implement consistent pagination with limit/offset or cursor-based patterns, documenting the pagination metadata schema (total, next_cursor, has_more) in a reusable component
  • Generate server stubs and client SDKs using openapi-generator with language-specific templates; customize templates for your coding conventions

Common Patterns

  • Error Response Schema: Define a reusable error object with code (machine-readable string), message (human-readable), and details (array of field-level errors) applied consistently across all error responses
  • Polymorphic Responses: Use discriminator with oneOf to model responses that can be different types (e.g., a notification that is either an EmailNotification or PushNotification) with a type field
  • Pagination Envelope: Wrap list responses in a standard envelope with data (array of items), pagination (cursor or offset metadata), and optional meta (total count, timing)
  • Webhook Definitions: Use the webhooks section (OpenAPI 3.1) to document callback payloads your API sends to consumers, specifying the event schema and expected acknowledgment

Pitfalls to Avoid

  • Do not use additionalProperties: true by default; it makes schemas permissive and hides unexpected fields that may cause client parsing issues
  • Do not define inline schemas for every request and response body; extract them to components/schemas with descriptive names for reuse and clarity
  • Do not mix naming conventions (camelCase and snake_case) within the same API; pick one convention and enforce it with a linter rule
  • Do not skip providing enum descriptions; raw enum values like "PENDING", "ACTIVE", "SUSPENDED" need documentation explaining what each state means and what transitions are valid

Version History

  • acf2587 Current 2026-08-20 07:39

Same Skill Collection

crates/openfang-hands/bundled/browser/SKILL.md
crates/openfang-hands/bundled/clip/SKILL.md
crates/openfang-hands/bundled/collector/SKILL.md
crates/openfang-hands/bundled/infisical-sync/SKILL.md
crates/openfang-hands/bundled/lead/SKILL.md
crates/openfang-hands/bundled/predictor/SKILL.md
crates/openfang-hands/bundled/researcher/SKILL.md
crates/openfang-hands/bundled/trader/SKILL.md
crates/openfang-hands/bundled/twitter/SKILL.md
crates/openfang-skills/bundled/ansible/SKILL.md
crates/openfang-skills/bundled/api-tester/SKILL.md
crates/openfang-skills/bundled/aws/SKILL.md
crates/openfang-skills/bundled/azure/SKILL.md
crates/openfang-skills/bundled/ci-cd/SKILL.md
crates/openfang-skills/bundled/code-reviewer/SKILL.md
crates/openfang-skills/bundled/compliance/SKILL.md
crates/openfang-skills/bundled/confluence/SKILL.md
crates/openfang-skills/bundled/crypto-expert/SKILL.md
crates/openfang-skills/bundled/css-expert/SKILL.md
crates/openfang-skills/bundled/data-analyst/SKILL.md
crates/openfang-skills/bundled/data-pipeline/SKILL.md
crates/openfang-skills/bundled/docker/SKILL.md
crates/openfang-skills/bundled/elasticsearch/SKILL.md
crates/openfang-skills/bundled/email-writer/SKILL.md
crates/openfang-skills/bundled/figma-expert/SKILL.md
crates/openfang-skills/bundled/gcp/SKILL.md
crates/openfang-skills/bundled/git-expert/SKILL.md
crates/openfang-skills/bundled/github/SKILL.md
crates/openfang-skills/bundled/golang-expert/SKILL.md
crates/openfang-skills/bundled/graphql-expert/SKILL.md
crates/openfang-skills/bundled/helm/SKILL.md
crates/openfang-skills/bundled/interview-prep/SKILL.md
crates/openfang-skills/bundled/jira/SKILL.md
crates/openfang-skills/bundled/kubernetes/SKILL.md
crates/openfang-skills/bundled/linear-tools/SKILL.md
crates/openfang-skills/bundled/linux-networking/SKILL.md
crates/openfang-skills/bundled/llm-finetuning/SKILL.md
crates/openfang-skills/bundled/ml-engineer/SKILL.md
crates/openfang-skills/bundled/mongodb/SKILL.md
crates/openfang-skills/bundled/nextjs-expert/SKILL.md
crates/openfang-skills/bundled/nginx/SKILL.md
crates/openfang-skills/bundled/notion/SKILL.md
crates/openfang-skills/bundled/oauth-expert/SKILL.md
crates/openfang-skills/bundled/postgres-expert/SKILL.md
crates/openfang-skills/bundled/presentation/SKILL.md
crates/openfang-skills/bundled/project-manager/SKILL.md
crates/openfang-skills/bundled/prometheus/SKILL.md
crates/openfang-skills/bundled/prompt-engineer/SKILL.md
crates/openfang-skills/bundled/python-expert/SKILL.md

Metadata

Files
0
Version
acf2587
Hash
03e59112
Indexed
2026-08-20 07:39

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 20:28
浙ICP备14020137号-1 $mapa de visitantes$