Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

openapi-endpointsopenapi 端点

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

489

周安装

21

GitHub Stars

37

下载量

171
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:openapi-endpoints(openapi 端点)
来源仓库:https://github.com/timelessco/recollect
仓库路径:skills/openapi-endpoints
安装命令:
npx skills add https://github.com/timelessco/recollect --skill openapi-endpoints
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/timelessco/recollect --skill openapi-endpoints

简介

openapi-endpoints 用于生成 OpenAPI 端点的详细描述和示例。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中辅助前后端联调时使用。
  • 支持请求/响应示例、参数下拉菜单和错误码覆盖。
  • 安装命令:npx skills add https://github.com/timelessco/recollect --skill openapi-endpoints。
  • 需确保导出命名符合 camelCase,避免路径匹配失败。

SKILL.md

OpenAPI Endpoint Documentation Lab

This skill runs an end-to-end lab: discover → audit schemas → create supplement → verify. Execute all 6 phases autonomously. The spec is generated in two passes: (1) a filesystem scanner auto-infers schemas from handler factories, (2) a merge script overlays human-authored metadata from supplement files.

Execution Loop

Phase 1    Phase 2       Phase 3        Phase 4    Phase 5      Phase 6
DISCOVER → SCHEMA AUDIT → SUPPLEMENT → BARREL → VERIFY SPEC → VERIFY UI
    ↑                                                              |
    └──────────── fix and retry if any verification fails ─────────┘

Phase 1 — Discover

Gather all context autonomously. Never ask the caller for file paths.

Find the route handler

Glob src/app/api/**/<endpoint-name>/route.ts

Read it. Identify:

  • Factory: which of the 4 factories from src/lib/api-helpers/create-handler.ts?

- createGetApiHandlerWithAuth / createPostApiHandlerWithAuth (auth required) - createGetApiHandler / createPostApiHandler (no auth)

  • Method: GET or POST (from the factory name and the export: export const GET or export const POST)
  • ROUTE constant: the kebab-case identifier (used for Sentry, not the URL path)
  • Schemas: inline InputSchema/OutputSchema, or imported from ./schema

Find the schema

Check for colocated schema.ts first:

Glob src/app/api/**/<endpoint-name>/schema.ts

If no schema.ts exists, schemas are inline in route.ts. Note this for Phase 2.

Find the domain barrel

The domain is the first path segment after /api/ (e.g., instagram, profiles, twitter):

Read src/lib/openapi/endpoints/<domain>/index.ts

Read a sibling supplement for pattern reference

Pick any existing supplement in the same domain directory:

Glob src/lib/openapi/endpoints/<domain>/*.ts

Read one (not index.ts, not *-examples.ts, not edge-process-imports.ts). This shows the exact pattern to follow — tags, security, example format.

Determine naming

  • Export name: <camelCaseDomainAndEndpoint>Supplement (e.g., instagramLastSyncedIdSupplement)
  • File name: <endpoint-name>.ts matching the route directory name
  • Path: /<domain>/<endpoint-name> (relative to /api, no /api prefix, no trailing slash)
  • Tags: capitalized domain name matching siblings (e.g., ["Instagram"], ["Profiles"])

Phase 2 — Schema Audit & Fix

Every Zod schema field must have .meta({description: "..."}). This maps directly to field descriptions in the generated OpenAPI spec via @asteasolutions/zod-to-openapi. Without it, fields appear in the spec with no description — bad developer experience.

Check all fields

Read the schema (from schema.ts or inline in route.ts). For every field in both InputSchema and OutputSchema, check for .meta({description: "..."}).

Add missing .meta()

For any field without .meta(), add it:

// Before
z.string()

// After
z.string().meta({ description: "The ID of the last synced Instagram bookmark" })

For nested objects and arrays:

z.array(z.int()).meta({ description: "Updated ordered list of favorite category IDs" })
z.object({
  id: z.string().meta({ description: "Tag identifier" }),
  name: z.string().meta({ description: "Tag display name" }),
}).meta({ description: "The newly created tag" })

Extract inline schemas to schema.ts if needed

If schemas are defined inline in route.ts and don't already have a schema.ts file, extract them to a colocated schema.ts. Follow this pattern:

// src/app/api/<domain>/<endpoint>/schema.ts
import { z } from "zod";

export const <PascalCase>InputSchema = z.object({
  field: z.string().meta({ description: "Field description" }),
});

export const <PascalCase>OutputSchema = z.object({
  field: z.string().meta({ description: "Field description" }),
});

Then update route.ts to import from ./schema instead of defining inline.

Reference examples for .meta() style

Read these files for well-documented schema patterns:

  • src/app/api/category/delete-user-category/schema.ts — 11-field response, boolean default
  • src/app/api/tags/create-and-assign-tag/schema.ts — nested sub-schemas with independent .meta()
  • src/app/api/bookmark/fetch-discoverable-by-id/schema.ts — deeply nested with MetadataSchema

Phase 3 — Create Supplement

Template

Use this template. Fill in applicable fields, delete inapplicable ones:

/**
 * @module Build-time only
 */
import { type EndpointSupplement } from "@/lib/openapi/supplement-types";
import { bearerAuth } from "@/lib/openapi/registry";

export const <camelCaseName>Supplement = {
	path: "/<domain>/<endpoint-name>",
	method: "<get|post>",
	tags: ["<Domain>"],
	summary: "<One-line summary for Scalar heading>",
	description: "<Detailed explanation. Supports markdown.>",
	security: [{ [bearerAuth.name]: [] }, {}],
	// --- Request examples (POST only) ---
	// Single: requestExample: { field: "value" },
	// Named:  requestExamples: { "key": { summary, description, value } },
	// --- Response examples ---
	// Single: responseExample: { data: { ... }, error: null },
	// Named:  responseExamples: { "key": { summary, description, value } },
	// --- Error examples ---
	// response400Examples: { "key": { summary, description, value: { data: null, error: "..." } } },
	// --- Additional response codes ---
	// additionalResponses: { 400: { description: "..." } },
	// --- Parameter examples (GET only) ---
	// parameterExamples: { paramName: { "key": { summary, description, value } } },
} satisfies EndpointSupplement;

Rules

  • path relative to /api — NOT /api/bookmarks/check-url, just /bookmarks/check-url
  • method lowercase: "get" or "post"
  • Tags capitalized: "Bookmarks", "Categories", "Twitter", "iPhone"
  • Security: [{[bearerAuth.name]: []}, {}]{} means cookie auth also accepted
  • No-auth endpoints: security: []
  • Export name: <camelCaseName>Supplement
  • File header: /** @module Build-time only */
  • Use realistic example data (actual IDs, realistic strings — not "test-123")
  • Response examples must include the {data:..., error: null} wrapper
  • Named example keys: kebab-case, both summary and description required
  • When supplement exceeds 250 lines, extract examples to <endpoint-name>-examples.ts with as const

Choosing single vs named examples

ScenarioUse
One obvious happy pathresponseExample (singular)
Multiple success scenariosresponseExamples (named, creates dropdown in Scalar)
Endpoint can return validation errorsAdd response400Examples + additionalResponses: {400}
GET with query paramsAdd parameterExamples (creates dropdown per param in "Try It")

Phase 4 — Barrel Export

Read the domain barrel at src/lib/openapi/endpoints/<domain>/index.ts. Add the new export in alphabetical order among existing exports:

export { <camelCaseName>Supplement } from "./<endpoint-name>";

The collectSupplements() function in the merge script auto-discovers any export with path and method properties from these barrels — no registration needed beyond the barrel export.


Phase 5 — Verify (Script-Based)

This phase does NOT require a running dev server. These are all build-time operations.

5a. Regenerate the spec

npx tsx scripts/generate-openapi.ts

Check the output line: Supplements applied: X/Y. Verify X increased by 1 compared to before. If X < Y, a supplement path or method doesn't match — check Phase 3 rules.

5b. Verify in JSON

cat public/openapi.json | jq '.paths["/<domain>/<endpoint-name>"].<method> | {summary, tags, description}'

All three fields should be non-null and match what you wrote in the supplement.

5c. Auto-fix formatting

pnpm fix

5d. Type check

pnpm lint:types

If either fails, fix and re-run from 5a.


Phase 6 — Verify (Browser-Based)

6a. Ensure dev server is running

lsof -i :3000

If no process on port 3000, start the dev server:

pnpm dev &

Wait for it to be ready (check with curl -s http://localhost:3000 > /dev/null).

6b. Check Scalar UI

Use Chrome MCP to navigate to http://localhost:3000/api-docs. Search or scroll to find the endpoint under its tag group. Confirm:

  • Endpoint appears with correct summary
  • Tag grouping matches (e.g., under "Instagram")
  • Examples render in the "Try It" panel
  • Field descriptions from .meta() appear in the schema viewer

If the endpoint doesn't appear, re-run Phase 5a and check for merge warnings.


Updating an Existing Endpoint

For updates, start at Phase 2 (schema audit) and run through Phase 6. Common updates:

Schema changes

Modify Zod schema in schema.ts — scanner picks it up automatically. Ensure all new fields have .meta({description}).

Adding/updating examples

Edit the supplement file. Use named examples for multiple scenarios.

Adding error examples

Add response400Examples and additionalResponses: {400: {description}}.


Supplement Reference

EndpointSupplement fields

FieldTypeWhen to use
pathstringAlways (required)
methodstringAlways (required)
tagsstring[]Always — groups endpoint in Scalar sidebar
summarystringAlways — one-line heading
descriptionstringAlways — detailed explanation, supports markdown
securityArray<Record<string, string[]>>Always — auth requirements
requestExampleRecord<string, unknown>POST with one obvious request body
requestExamplesNamed examplesPOST with multiple request scenarios
responseExampleRecord<string, unknown>One obvious success response
responseExamplesNamed examplesMultiple success scenarios (dropdown in Scalar)
response400ExampleRecord<string, unknown>One obvious validation error
response400ExamplesNamed examplesMultiple validation error scenarios
additionalResponsesRecord<number, {description}>Custom descriptions for 400/403/404/409/500
parameterExamplesRecord<string, NamedExamples>GET endpoints with query params (dropdown per param)

Response components (auto-registered by scanner)

  • ValidationError (400) — {data: null, error: string}
  • Unauthorized (401) — {data: null, error: "Not authenticated"}
  • InternalError (500) — {data: null, error: "Failed to process request"}

additionalResponses overrides the 400 description while preserving the schema.

Naming conventions

  • Export: <camelCaseName>Supplement (e.g., checkUrlSupplement)
  • Example keys: kebab-case ("single-tweet", "validation-error")
  • Example files: <endpoint-name>-examples.ts (use as const)
  • Tags: capitalized ("Bookmarks", "iPhone")
  • Named examples require both summary and description

Edge Functions

Edge functions use a different workflow (manual registerPath() with raw SchemaObject). See reference.md for the complete pattern.


Troubleshooting

Supplement not appearing in spec

  1. Exported from domain index.ts barrel?
  2. path matches route exactly (relative to /api, no trailing slash)?
  3. method matches handler export ("get" for GET, "post" for POST)?
  4. Check console — mergeSupplements prints warnings for unmatched supplements

400 examples not showing

  1. Has additionalResponses: {400: {description}}?
  2. Using response400Examples (not responseExamples)?

Common mistakes

  • /api/bookmarks/check-url instead of /bookmarks/check-url
  • Forgetting as const on example data in -examples.ts files
  • responseExample (singular) when you need responseExamples (named)
  • Missing summary or description on named examples
  • Forgetting .meta({description}) on schema fields — run Phase 2 again

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.24%
按下载量换算62

Claude

29.55%
按下载量换算51

Cursor

19.31%
按下载量换算33

Gemini CLI

8.66%
按下载量换算15

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills