jpskill.com
🛠️ 開発・MCP コミュニティ

add-endpoint

Add new HTTP endpoints to Catalyst-Relay server. Use when creating routes, API endpoints, or HTTP handlers.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o add-endpoint.zip https://jpskill.com/download/17280.zip && unzip -o add-endpoint.zip && rm add-endpoint.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17280.zip -OutFile "$d\add-endpoint.zip"; Expand-Archive "$d\add-endpoint.zip" -DestinationPath $d -Force; ri "$d\add-endpoint.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して add-endpoint.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → add-endpoint フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

HTTPエンドポイントの追加

どのような時に使うか

  • 新しいHTTPルートを作成する時
  • APIエンドポイントを追加する時
  • 新しいハンドラーをHonoアプリに接続する時

ルートファイルのパターン

各エンドポイントは、スキーマ、型、ハンドラーが同じ場所に配置された独自のファイルを持ちます。

場所: src/server/routes/{category}/{endpoint}.ts

// src/server/routes/auth/login.ts

import { z } from 'zod';
import type { Context } from 'hono';
import type { ISessionManager } from '../types';

// 1. リクエストスキーマ (同じ場所に配置)
export const loginRequestSchema = z.object({
    url: z.string().url(),
    client: z.string().min(1).max(3),
    auth: authConfigSchema
});

// 2. レスポンスの型 (同じ場所に配置)
export interface LoginResponse {
    sessionId: string;
    username: string;
    expiresAt: number;
}

// 3. 単一のハンドラーのエクスポート (ファクトリーパターン)
export function loginHandler(sessionManager: ISessionManager) {
    return async (c: Context) => {
        const body = await c.req.json();
        const validation = loginRequestSchema.safeParse(body);

        if (!validation.success) {
            return c.json({
                success: false as const,
                error: 'Invalid request',
                code: 'VALIDATION_ERROR'
            }, 400);
        }

        // ... 実装 ...

        return c.json({ success: true as const, data: response });
    };
}

ルートの接続

src/server/routes/index.ts でルートを登録します。

import { loginHandler } from './auth/login';

export function registerRoutes(app: Hono, sessionManager: ISessionManager) {
    // 認証ルート
    app.post('/login', loginHandler(sessionManager));

    // ここに新しいルートを追加します
}

レスポンスのフォーマット

すべてのエンドポイントは一貫したエンベロープを使用します。

// 成功
return c.json({ success: true as const, data: result });

// エラー
return c.json({
    success: false as const,
    error: 'Human-readable message',
    code: 'MACHINE_CODE'
}, statusCode);

判別共用体では、リテラル型に as const を使用してください。

ライブラリモードのマッピング

エンドポイントがコア機能をラップする場合は、ADTClient にメソッドを追加します。

HTTP Endpoint Library Method
POST /login client.login()
GET /packages client.getPackages()
POST /objects/read client.read(objects)

ドキュメントの要件

docs/endpoints/{category}.md にエンドポイントのドキュメントを作成します。

必要な構造:

  1. タイトルと説明
  2. アンカーリンク付きの ## Sections TOC
  3. エンドポイントごと:
    • 説明の段落
    • リクエストテーブル (Method, Path, Auth Required)
    • リクエストボディテーブル (Field, Type, Required, Description)
    • レスポンステーブル (Field, Type, Description)
    • リクエスト/レスポンスJSONの例
    • エラーコードテーブル
    • ユースケースリスト
    • ライブラリの使用方法セクション

完全な例については、docs/endpoints/auth.md を参照してください。

チェックリスト

- [ ] src/server/routes/{category}/ にルートファイルを作成する
- [ ] リクエストの検証に Zod スキーマを追加する
- [ ] レスポンスの型インターフェースを追加する
- [ ] ハンドラー関数をエクスポートする (ファクトリーパターン)
- [ ] src/server/routes/index.ts にルートを接続する
- [ ] 該当する場合は、ADTClient にライブラリメソッドを追加する
- [ ] docs/endpoints/{category}.md にドキュメントを作成する
- [ ] 型チェックを実行する: bun run typecheck
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Adding HTTP Endpoints

When to Use

  • Creating a new HTTP route
  • Adding an API endpoint
  • Wiring a new handler to the Hono app

Route File Pattern

Each endpoint gets its own file with colocated schema, types, and handler.

Location: src/server/routes/{category}/{endpoint}.ts

// src/server/routes/auth/login.ts

import { z } from 'zod';
import type { Context } from 'hono';
import type { ISessionManager } from '../types';

// 1. Request schema (colocated)
export const loginRequestSchema = z.object({
    url: z.string().url(),
    client: z.string().min(1).max(3),
    auth: authConfigSchema
});

// 2. Response type (colocated)
export interface LoginResponse {
    sessionId: string;
    username: string;
    expiresAt: number;
}

// 3. Single handler export (factory pattern)
export function loginHandler(sessionManager: ISessionManager) {
    return async (c: Context) => {
        const body = await c.req.json();
        const validation = loginRequestSchema.safeParse(body);

        if (!validation.success) {
            return c.json({
                success: false as const,
                error: 'Invalid request',
                code: 'VALIDATION_ERROR'
            }, 400);
        }

        // ... implementation ...

        return c.json({ success: true as const, data: response });
    };
}

Wiring Routes

Register routes in src/server/routes/index.ts:

import { loginHandler } from './auth/login';

export function registerRoutes(app: Hono, sessionManager: ISessionManager) {
    // Auth routes
    app.post('/login', loginHandler(sessionManager));

    // Add your new route here
}

Response Format

All endpoints use a consistent envelope:

// Success
return c.json({ success: true as const, data: result });

// Error
return c.json({
    success: false as const,
    error: 'Human-readable message',
    code: 'MACHINE_CODE'
}, statusCode);

Use as const for literal types in discriminated unions.

Library Mode Mapping

If the endpoint wraps core functionality, add a method to ADTClient:

HTTP Endpoint Library Method
POST /login client.login()
GET /packages client.getPackages()
POST /objects/read client.read(objects)

Documentation Requirements

Create endpoint docs in docs/endpoints/{category}.md.

Required structure:

  1. Title and description
  2. ## Sections TOC with anchor links
  3. Per-endpoint:
    • Description paragraph
    • Request table (Method, Path, Auth Required)
    • Request Body table (Field, Type, Required, Description)
    • Response table (Field, Type, Description)
    • Example request/response JSON
    • Error codes table
    • Use cases list
    • Library Usage section

See docs/endpoints/auth.md for a complete example.

Checklist

- [ ] Create route file in src/server/routes/{category}/
- [ ] Add Zod schema for request validation
- [ ] Add response type interface
- [ ] Export handler function (factory pattern)
- [ ] Wire route in src/server/routes/index.ts
- [ ] Add library method to ADTClient if applicable
- [ ] Document in docs/endpoints/{category}.md
- [ ] Run typecheck: bun run typecheck