Communitygithub.com

YepAPI/skills

ZodスキーマからOpenAPI 3.1仕様を生成し、Swagger/Scalarによるインタラクティブなドキュメント、バージョン管理、全エンドポイントのリクエスト例を提供します。

skills とは?

このスキルは、ZodスキーマからOpenAPI 3.1仕様を生成し、APIドキュメントを自動化・一元管理するためのものです。開発者は手動でYAMLを書く代わりに、`zod-openapi`や`@asteasolutions/zod-to-openapi`を使ってスキーマを定義するだけで、検証とドキュメント生成を同時に行えます。生成された仕様に基づき、ScalarやSwagger UIでインタラクティブなドキュメントを`/docs`などで提供し、全エンドポイントに要約、説明、リクエスト・レスポンスの具体例を自動付与します。また、URLパスによるシンプルなバージョン管理戦略(`/api/v1/`)や、エラーレスポンスの統一スキーマ、認証方式のドキュメント化など、実用的なパターンを推奨しています。主にzod-to-openapiとHono/Expressの組み合わせで動作し、コードとドキュメントの乖離を防ぎます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/api-documentation

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

APIドキュメント

ルール

  • OpenAPI 3.1仕様を唯一の真実の情報源とする — コードから生成し、手動で記述しない
  • ZodスキーマからOpenAPIへ: zod-openapiまたは@asteasolutions/zod-to-openapiを使用 — 一度定義すれば、バリデーションとドキュメント作成が可能
  • インタラクティブドキュメント: Scalar(モダンで高速)またはSwagger UI — /docsまたは/api-docsで提供
  • すべてのエンドポイントに以下を必須とする: 要約、説明、リクエストボディスキーマ、すべてのレスポンスコードとその例
  • 全エンドポイントにリクエスト/レスポンスの例 — 現実的なデータを使用し、"string"のようなプレースホルダーは避ける
  • バージョン管理戦略: 破壊的変更にはURLパス(/api/v1/、/api/v2/) — ヘッダーベースのバージョン管理よりもシンプル
  • エラーレスポンス: すべてのエラー形式を一貫して文書化 — { error: string, code: string, details?: object }
  • 認証: セキュリティスキームセクションに認証方式(Bearerトークン、APIキー)を文書化
  • エンドポイントをリソースごとにグループ化: /users、/products、/orders — ドキュメントUIでのグループ化にタグを使用

パターン

// zod-to-openapiとHono/Expressの組み合わせ
import { z } from "zod";
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
extendZodWithOpenApi(z);

const UserSchema = z.object({
  id: z.string().uuid().openapi({ example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }),
  name: z.string().openapi({ example: "Jane Smith" }),
  email: z.string().email().openapi({ example: "[email protected]" }),
}).openapi("User");

const CreateUserSchema = UserSchema.omit({ id: true }).openapi("CreateUser");

// エンドポイントの登録
registry.registerPath({
  method: "post",
  path: "/api/v1/users",
  summary: "ユーザーを作成",
  request: { body: { content: { "application/json": { schema: CreateUserSchema } } } },
  responses: {
    201: { description: "ユーザー作成完了", content: { "application/json": { schema: UserSchema } } },
    400: { description: "バリデーションエラー" },
  },
});

避けるべきこと

  • OpenAPI YAMLを手動で記述 — Zodスキーマまたはルート定義から生成する
  • エラーレスポンスのドキュメント化漏れ — 400、401、403、404、500を必ず文書化
  • "string"や0のような汎用的な例 — 実際のデータ構造を示す現実的な値を使用
  • 実装から乖離したドキュメント — バリデーションに使用するのと同じスキーマから仕様を生成する

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

関連スキル