clerk-backend-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOptions context
选项上下文
User Prompt: $ARGUMENTS
用户提示:$ARGUMENTS
API specs context
API规范上下文
Before doing anything, fetch the available spec versions and tags by running:
bash
bash scripts/api-specs-context.shUse the output to determine the latest version and available tags.
Caching: If you already fetched the spec context earlier in this conversation, do NOT fetch it again. Reuse the version and tags from the previous call.
在执行任何操作前,请先运行以下命令获取可用的规范版本和标签:
bash
bash scripts/api-specs-context.sh使用输出结果确定最新版本和可用标签。
缓存规则: 如果您在本次对话中早些时候已经获取过规范上下文,请勿重复获取,直接复用之前调用得到的版本和标签即可。
Rules
规则
- Always disregard endpoints/schemas related to .
platform - Always confirm before performing write requests.
- For write operations (POST/PUT/PATCH/DELETE), check if includes the required scope. If not, ask the user upfront: "This is a write/delete operation and your current scopes don't allow it. Run with --admin to bypass?" Do NOT attempt the request first and fail — ask before executing.
CLERK_BAPI_SCOPES
- 始终忽略与相关的端点/模式。
platform - 执行写请求前必须始终确认。
- 对于写操作(POST/PUT/PATCH/DELETE),请检查是否包含所需的权限范围。如果不包含,请提前询问用户:"这是一个写/删除操作,您当前的权限范围不允许该操作。是否添加--admin参数运行以绕过限制?" 请勿先尝试请求再报错——执行前先询问。
CLERK_BAPI_SCOPES
Modes
模式
Determine the active mode based on the user prompt in Options context:
| Mode | Trigger | Behavior |
|---|---|---|
| Prompt is empty, or contains only | Print usage examples (step 0) |
| Prompt is | List all tags or endpoints for a tag |
| Specific endpoint (e.g. | Look up endpoint, execute request |
| Endpoint + | Show endpoint schema, don't execute |
根据选项上下文中的用户提示确定激活的模式:
| 模式 | 触发条件 | 行为 |
|---|---|---|
| 提示为空,或仅包含 | 打印使用示例(第0步) |
| 提示为 | 列出所有标签或对应标签的所有端点 |
| 特定端点(例如 | 查找端点,执行请求 |
| 端点 + | 展示端点模式,不执行请求 |
Your Task
你的任务
Use the LATEST VERSION from API specs context by default. If the user specifies a different version (e.g. ), use that version instead.
--version 2024-10-01Determine the active mode, then follow the applicable steps below.
0. Print usage
0. 打印使用说明
Modes: only — Skip for , , and .
helpbrowseexecutedetailPrint the following examples to the user verbatim:
Browse
/clerk-backend-api tags — list all tags
/clerk-backend-api Users — browse endpoints for the Users tag
/clerk-backend-api Users version 2025-11-10.yml — browse using a different version
Execute
/clerk-backend-api GET /users — fetch all users
/clerk-backend-api get user john_doe — natural language works too
/clerk-backend-api POST /invitations — create an invitation
Inspect
/clerk-backend-api GET /users help — show endpoint schema without executing
/clerk-backend-api POST /invitations -h — view request/response details
Options
--admin — bypass scope restrictions for write/delete
--version [date], version [date] — use a specific spec version
--help, -h, help — inspect endpoint instead of executingStop here.
适用模式: 仅 —— 、和模式跳过此步。
helpbrowseexecutedetail逐字向用户打印以下示例:
Browse
/clerk-backend-api tags — list all tags
/clerk-backend-api Users — browse endpoints for the Users tag
/clerk-backend-api Users version 2025-11-10.yml — browse using a different version
Execute
/clerk-backend-api GET /users — fetch all users
/clerk-backend-api get user john_doe — natural language works too
/clerk-backend-api POST /invitations — create an invitation
Inspect
/clerk-backend-api GET /users help — show endpoint schema without executing
/clerk-backend-api POST /invitations -h — view request/response details
Options
--admin — bypass scope restrictions for write/delete
--version [date], version [date] — use a specific spec version
--help, -h, help — inspect endpoint instead of executing执行完毕后停止。
1. Fetch tags
1. 获取标签
Modes: (when prompt is or no tag specified) — Skip for , , and .
browsetagshelpexecutedetailIf using a non-latest version, fetch tags for that version:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | node scripts/extract-tags.jsOtherwise, use the TAGS already in API specs context.
Share tags in a table and prompt the user to select a query.
适用模式: (当提示为或未指定标签时) —— 、和模式跳过此步。
browsetagshelpexecutedetail如果使用非最新版本,请获取对应版本的标签:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | node scripts/extract-tags.js否则,直接使用API规范上下文中已有的TAGS。
以表格形式分享标签,并提示用户选择查询内容。
2. Fetch tag endpoints
2. 获取标签对应端点
Modes: (when a tag name is provided) — Skip for , , and .
browsehelpexecutedetailFetch all endpoints for the identified tag:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | bash scripts/extract-tag-endpoints.sh "${tag_name}"Share the results (endpoints, schemas, parameters) with the user.
适用模式: (提供了标签名称时) —— 、和模式跳过此步。
browsehelpexecutedetail获取指定标签对应的所有端点:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | bash scripts/extract-tag-endpoints.sh "${tag_name}"将结果(端点、模式、参数)分享给用户。
3. Fetch endpoint detail
3. 获取端点详情
Modes: , — Skip for and .
executedetailhelpbrowseFor natural language prompts in mode, first identify the matching endpoint by searching the tags in context. Fetch tag endpoints if needed to resolve the exact path and method.
executeExtract the full endpoint definition:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | bash scripts/extract-endpoint-detail.sh "${path}" "${method}"- — e.g.
${path}/users/{user_id} - — lowercase, e.g.
${method}get
detailexecute适用模式: 、 —— 和模式跳过此步。
executedetailhelpbrowse对于模式下的自然语言提示,首先通过搜索上下文中的标签确定匹配的端点。如果需要解析准确的路径和方法,可以获取标签对应的端点列表。
execute提取完整的端点定义:
bash
curl -s https://raw.githubusercontent.com/clerk/openapi-specs/main/bapi/${version_name} | bash scripts/extract-endpoint-detail.sh "${path}" "${method}"- — 例如
${path}/users/{user_id} - — 小写,例如
${method}get
detailexecute4. Execute request
4. 执行请求
Modes: only.
executeUse the endpoint definition from step 3 to build the request:
- Identify required and optional parameters from the spec.
- Ask the user for any required path/query/body parameters.
- Execute via the request script:
bash
bash scripts/execute-request.sh [--admin] ${METHOD} "${path}" ['${body_json}']- — pass this if the user confirmed admin bypass (see Rules)
--admin - — uppercase HTTP method
${METHOD} - — resolved path with parameters filled in (e.g.
${path})/users/user_abc123 - — optional JSON body for POST/PUT/PATCH
${body_json}
- Share the response with the user.
适用模式: 仅。
execute使用第3步得到的端点定义构建请求:
- 从规范中识别必填和可选参数。
- 向用户询问所有必填的路径/查询/请求体参数。
- 通过请求脚本执行:
bash
bash scripts/execute-request.sh [--admin] ${METHOD} "${path}" ['${body_json}']- — 如果用户确认要绕过管理员限制则传递该参数(参见规则部分)
--admin - — 大写的HTTP方法
${METHOD} - — 参数填充完成后的解析路径(例如
${path})/users/user_abc123 - — POST/PUT/PATCH请求可选的JSON请求体
${body_json}
- 将响应结果分享给用户。