defineRoute Route Builder
bighadj22/codflow
Creates new API endpoints, and converts older ones, with the defineRoute() pattern used in cod-server, including auth strategies, scopes and OpenAPI output.
A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ChenyCHENYU/Robot_Admin api-contract --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/api-contract .claude/skills/api-contract && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .claude/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contractType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ChenyCHENYU/Robot_Admin api-contract --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.github/skills/api-contract .agents/skills/api-contract && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .agents/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ChenyCHENYU/Robot_Admin api-contract --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.github/skills/api-contract .cursor/skills/api-contract && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .cursor/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ChenyCHENYU/Robot_Admin.git --path .github/skills/api-contract--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ChenyCHENYU/Robot_Admin api-contract --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.github/skills/api-contract .gemini/skills/api-contract && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .gemini/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ChenyCHENYU/Robot_Admin api-contractInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .github/skills && cp -r skills-src/.github/skills/api-contract .github/skills/api-contract && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .github/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ChenyCHENYU/Robot_Admin api-contract --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ChenyCHENYU/Robot_Admin.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.github/skills/api-contract .opencode/skills/api-contract && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "api-contract" agent skill from https://github.com/ChenyCHENYU/Robot_Admin/tree/main/.github/skills/api-contract into .opencode/skills/api-contract/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "api-contract", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
api-contractA skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.
API Contract is an agent skill from ChenyCHENYU/Robot_Admin. Use when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs. Triggers on: api contract, api generation, 接口约定, 生成api, swagger to ts, openapi, 接口文件, api层.
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Backend & APIs, covering OpenAPI specifications and API design. It works with OpenAPI and TypeScript. The repository describes itself as: 一款专为开发者省时间、提效率的现代化中后台模板,跳过低质造轮子,上手即开工!Vue 3 + TS + Naive UI,更有 Bun+Vite 双引擎,性能直接拉满💥 毫秒级热更新不卡顿,开发丝滑,您试试!还有49 个成熟组件,演示页+文档双重完善,无残缺、无坑点,复制即用无需额外调试;配套 8 个 @robot-admin…. The licence is MIT.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 48ce6e9. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
API Contract loads about 1.9k tokens when it runs. Until then it costs about 58 tokens; SKILL.md has 184 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from ChenyCHENYU/Robot_Admin at commit 48ce6e9, republished under its MIT licence (© ChenyCHENYU). 184 words, ~1,921 tokens.
.claude/skills/api-contract/SKILL.md (or your agent's skills folder).根据 page-spec JSON(来自 prototype-scan)或 Swagger/OpenAPI/接口文档, 生成符合 Robot Admin 规范的 TypeScript 类型定义 + API 请求函数。
import {
getData,
postData,
putData,
deleteData,
} from '@robot-admin/request-core/axios'| 工具函数 | HTTP Method | 典型场景 |
|---|---|---|
getData<T>(url, params?) | GET | 列表查询、详情获取 |
postData<T>(url, data?) | POST | 新增、登录、复杂查询 |
putData<T>(url, data?) | PUT | 修改更新 |
deleteData<T>(url, params?) | DELETE | 删除 |
/<domain>/<resource> — 列表/新增
/<domain>/<resource>/:id — 详情/修改/删除
/<domain>/<resource>/:id/<sub> — 子资源示例:
GET /sys/users → 用户列表
POST /sys/users → 新增用户
GET /sys/users/:id → 用户详情
PUT /sys/users/:id → 修改用户
DELETE /sys/users/:id → 删除用户
GET /sys/users/:id/roles → 用户角色interface ApiResponse<T = unknown> {
code: string | number // '0' | '200' | 0 | 200 为成功
data: T
msg: string
}列表响应:
interface ListResponse<T = Record<string, unknown>> {
code: string | number
data: {
list: T[]
total: number
}
msg: string
}根据 page-spec JSON 中的 columns、form、query 字段自动生成类型。
命名规则:
| HTTP Method | 命名模式 | 示例 |
|---|---|---|
| GET(列表) | Get{Domain}{Resource}ListResponse | GetSysUsersListResponse |
| GET(详情) | Get{Domain}{Resource}ByIdResponse | GetSysUsersByIdResponse |
| POST(新增) | Post{Domain}{Resource}Response | PostSysUsersResponse |
| PUT(修改) | Put{Domain}{Resource}ByIdResponse | PutSysUsersByIdResponse |
| DELETE(删除) | Delete{Domain}{Resource}ByIdResponse | DeleteSysUsersByIdResponse |
输出文件:src/api/generated/index.ts(追加或更新已有类型)
/*
* @Author: ChenYu ycyplus@gmail.com
* @Date: {{date}}
* @Description: API 自动生成类型 — {{module}} 模块
* Copyright (c) {{year}} by CHENY, All Rights Reserved 😎.
*/
/** {{资源}}列表查询参数 */
export interface Get{{Resource}}ListParams {
page?: number
pageSize?: number
keyword?: string
// ... 从 page-spec.query 推导
}
/** {{资源}}列表响应 */
export interface Get{{Resource}}ListResponse {
code: string
data: {
list: {{Resource}}Item[]
total: number
}
msg: string
}
/** {{资源}}数据项 */
export interface {{Resource}}Item {
id: number | string
// ... 从 page-spec.columns + page-spec.form 合并推导
createTime?: string
updateTime?: string
}
/** {{资源}}新增/编辑表单数据 */
export interface {{Resource}}FormData {
// ... 从 page-spec.form 推导
}
/** {{资源}}详情响应 */
export interface Get{{Resource}}ByIdResponse {
code: string
data: {{Resource}}Item
msg: string
}
/** {{资源}}新增响应 */
export interface Post{{Resource}}Response {
code: string
data: {{Resource}}Item
msg: string
}
/** {{资源}}更新响应 */
export interface Put{{Resource}}ByIdResponse {
code: string
data: {{Resource}}Item
msg: string
}
/** {{资源}}删除响应 */
export interface Delete{{Resource}}ByIdResponse {
code: string
data: Record<string, unknown>
msg: string
}输出文件:src/api/<domain>-<resource>.ts
/*
* @Author: ChenYu ycyplus@gmail.com
* @Date: {{date}}
* @Description: {{模块中文名}} — API 接口
* Copyright (c) {{year}} by CHENY, All Rights Reserved 😎.
*/
import { getData, postData, putData, deleteData } from '@robot-admin/request-core/axios'
import type {
Get{{Resource}}ListResponse,
Get{{Resource}}ByIdResponse,
Post{{Resource}}Response,
Put{{Resource}}ByIdResponse,
Delete{{Resource}}ByIdResponse,
} from './generated'
/**
* * @description: 查询{{资源中文名}}列表
* ? @param {Record<string, any>} params 查询参数
* ! @return {Promise<Get{{Resource}}ListResponse>} 列表响应
*/
export const get{{Resource}}ListApi = (params?: Record<string, any>) =>
getData<Get{{Resource}}ListResponse>('/<domain>/<resource>', params)
/**
* * @description: 新增{{资源中文名}}
* ? @param {Record<string, any>} data 表单数据
* ! @return {Promise<Post{{Resource}}Response>} 新增响应
*/
export const create{{Resource}}Api = (data: Record<string, any>) =>
postData<Post{{Resource}}Response>('/<domain>/<resource>', data)
/**
* * @description: 获取{{资源中文名}}详情
* ? @param {number|string} id 资源ID
* ! @return {Promise<Get{{Resource}}ByIdResponse>} 详情响应
*/
export const get{{Resource}}ByIdApi = (id: number | string) =>
getData<Get{{Resource}}ByIdResponse>(`/<domain>/<resource>/${id}`)
/**
* * @description: 更新{{资源中文名}}
* ? @param {number|string} id 资源ID
* ? @param {Record<string, any>} data 更新数据
* ! @return {Promise<Put{{Resource}}ByIdResponse>} 更新响应
*/
export const update{{Resource}}Api = (id: number | string, data: Record<string, any>) =>
putData<Put{{Resource}}ByIdResponse>(`/<domain>/<resource>/${id}`, data)
/**
* * @description: 删除{{资源中文名}}
* ? @param {number|string} id 资源ID
* ! @return {Promise<Delete{{Resource}}ByIdResponse>} 删除响应
*/
export const delete{{Resource}}Api = (id: number | string) =>
deleteData<Delete{{Resource}}ByIdResponse>(`/<domain>/<resource>/${id}`)当页面模式为 LIST 且使用 C_Table 时,额外输出 useTableCrud 配置:
import { useNaiveTableCrud } from '@robot-admin/request-core/naive'
const table = useNaiveTableCrud({
api: {
list: '/<domain>/<resource>',
create: '/<domain>/<resource>',
update: '/<domain>/<resource>/:id',
remove: '/<domain>/<resource>/:id',
get: '/<domain>/<resource>/:id',
},
columns: [...],
defaultPageSize: 20,
})page-spec 中的 rules 字段转换为 @robot-admin/form-validate 的预设规则:
import { PRESET_RULES } from '@robot-admin/form-validate'| 规则描述 | 转换结果 |
|---|---|
| 必填 | PRESET_RULES.required('字段名') |
| 长度2-20 | PRESET_RULES.length('字段名', 2, 20) |
| 数值 18-65 | PRESET_RULES.range('字段名', 18, 65) |
| 邮箱 | PRESET_RULES.email('邮箱') |
| 手机号 | PRESET_RULES.mobile('手机号') |
| URL | PRESET_RULES.url('URL') |
| 身份证 | PRESET_RULES.idCard('身份证') |
| IP | PRESET_RULES.ip('IP') |
| 文件 | 说明 |
|---|---|
src/api/generated/index.ts | 追加自动生成的 TS 类型(接口响应/参数) |
src/api/<domain>-<resource>.ts | API 请求函数(CRUD 全套) |
src/api/generated/index.ts 采用追加模式,不清空已有类型* @description / ? @param / ! @return)@Author / @Date / @Description 文件头getData<T>(...)@/api/generated,不使用相对路径 ./generated/axios、Naive CRUD 从 /naive 导入,不直接使用 axios 或根兼容入口© ChenyCHENYU, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .github/skills/api-contract of ChenyCHENYU/Robot_Admin.
Open the folder on GitHubat commit 48ce6e9
API Contract next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| API Contract this skillChenyCHENYU/Robot_Admin | 1k | — | ~1.9k | Automated safety check: Pass | MIT | |
| defineRoute Route Builderbighadj22/codflow | 343 | — | ~924 | Automated safety check: Pass | Apache-2.0 | |
| API DesignerJeffallan/claude-skills | 12k | 2 repos | ~2k | Automated safety check: Pass | MIT | |
| OpenAPI to MCP Servermcp-use/mcp-use | 11k | — | ~5.2k | Automated safety check: Pass | Apache-2.0 | |
| Old Coder API DesignAmazingAng/old-coder | 749 | 1 repos | ~3.4k | Automated safety check: Pass | MIT | |
| Api2clialexknowshtml/api2cli | 455 | — | ~2.9k | Automated safety check: Pass | MIT |
bighadj22/codflow
Creates new API endpoints, and converts older ones, with the defineRoute() pattern used in cod-server, including auth strategies, scopes and OpenAPI output.
Jeffallan/claude-skills
Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.
mcp-use/mcp-use
Turns an OpenAPI or Swagger spec into an MCP server with the mcp-use TypeScript SDK, mapping each operation to a tool, wiring auth, testing and deploying.
AmazingAng/old-coder
Reviews or designs an HTTP/JSON API's endpoints, auth, pagination, versioning and deprecations, guarding against inventing a bespoke interface or silently breaking consumers.
alexknowshtml/api2cli
Generate a working CLI from any API, then wrap it in a Claude Code skill.
samchon/nestia
Defines the nestia product contract, workspace layout, package boundaries, the Go plugin composition model, and canonical commands.
ChenyCHENYU/Robot_Admin
A skill your agent uses when: upgrading dependencies, adding common features, or when the user explicitly requests branch sync check.
ChenyCHENYU/Robot_Admin
A skill your agent uses when: reviewing code for compliance with Robot Admin project conventions, or when generating a compliance report.
ChenyCHENYU/Robot_Admin
A skill your agent uses when: generating mock data for development without a backend.
ChenyCHENYU/Robot_Admin
A skill your agent uses when: generating Vue 3 page code from either a page-spec JSON or a natural language description.
ChenyCHENYU/Robot_Admin
A skill your agent uses when: analyzing Axure exported HTML prototype files or detailed design documents to extract page inventory, classify interaction patterns, and produce a structured page-spec…
ChenyCHENYU/Robot_Admin
A skill your agent uses when: registering new pages into the dynamic router system.
Works with
Categories
A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs. API Contract is an agent skill from ChenyCHENYU/Robot_Admin. Use when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.
API Contract fits situations like: : generating TypeScript API layer (type definitions + request functions) from page-spec JSON; swagger/OpenAPI docs.
Run `npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a claude-code`. Or copy the skill folder (.github/skills/api-contract in ChenyCHENYU/Robot_Admin) into .claude/skills/api-contract in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a codex`. Or copy the skill folder (.github/skills/api-contract in ChenyCHENYU/Robot_Admin) into .agents/skills/api-contract in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ChenyCHENYU/Robot_Admin --skill api-contract -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/api-contract, .gemini/skills/api-contract, .github/skills/api-contract and .opencode/skills/api-contract in your project.
SKILL.md names no scripts, command-line tools or credentials: API Contract is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
API Contract is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with API Contract: defineRoute Route Builder (bighadj22/codflow, 343 stars), API Designer (Jeffallan/claude-skills, 12k stars), OpenAPI to MCP Server (mcp-use/mcp-use, 11k stars) and Old Coder API Design (AmazingAng/old-coder, 749 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ChenyCHENYU (a GitHub user) maintains it in ChenyCHENYU/Robot_Admin, which has 1,020 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 6, 2026.
Source: ChenyCHENYU/Robot_Admin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.