api-docs について
api-docs は、API ドキュメントと OpenAPI 仕様を作成するスキルです。API のリファレンスやガイド、スキーマ、Postman コレクションを整備する開発者向けです。
主な機能
- 01OpenAPI 仕様の作成
- 02API リファレンスの構成
- 03認証とエラーの記述
- 04SDK ドキュメントの生成
- 05Postman コレクションの作成
活用シーン
- 01新しい API のドキュメント作成
- 02コードからの API ドキュメント生成
- 03OpenAPI または Swagger 仕様の作成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ htlin222/ dotfiles --skill api-docsインストール後、Claude Code で/api-docsを入力して読み込まれたか確認します。
詳細
API ドキュメント
包括的な API ドキュメントと OpenAPI 仕様を作成します。
使用する場面
- 新しい API のドキュメントを作成するとき
- OpenAPI/Swagger 仕様を作成するとき
- SDK ドキュメントを生成するとき
- API ガイドを作成するとき
- Postman コレクションを作成するとき
OpenAPI テンプレート
openapi: 3.0.3
info:
title: API Name
version: 1.0.0
description: API description
servers:
- url: https://api.example.com/v1
description: Production
paths:
/users:
get:
summary: List users
operationId: listUsers
parameters:
- name: limit
in: query
schema:
type: integer
default: 20
responses:
"200":
description: Success
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/User"
post:
summary: Create user
operationId: createUser
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateUser"
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: "#/components/schemas/User"
components:
schemas:
User:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
email:
type: string
format: email
required:
- id
- name
- email
CreateUser:
type: object
properties:
name:
type: string
email:
type: string
format: email
required:
- name
- email
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
security:
- bearerAuth: []
ドキュメントの構成
# API Reference
## Authentication
All requests require a Bearer token in the Authorization header.
## Endpoints
### Users
#### List Users
`GET /users`
**Parameters:**
| Name | Type | Required | Description |
| ----- | ------- | -------- | ---------------- |
| limit | integer | No | Results per page |
**Response:**
```json
[{ "id": "...", "name": "...", "email": "..." }]
```
#### Create User
`POST /users`
**Request Body:**
```json
{ "name": "John", "email": "[email protected]" }
```
## Error Codes
| Code | Description |
| ---- | --------------------- |
| 400 | Bad Request |
| 401 | Unauthorized |
| 404 | Not Found |
| 500 | Internal Server Error |
例
入力:「ユーザー API のドキュメントを作成」 **アクション:**すべてのエンドポイント、スキーマ、例、エラーコードを含む OpenAPI 仕様を作成
入力:「コードから API ドキュメントを生成」 **アクション:**エンドポイントを抽出し、型を推定して、構造化されたドキュメントを作成
コメント
Markdown 対応