Backend API Brief
Goal
Turn a loose business request into two backend planning documents:
Default outputs, in the order a beginner should read them:
outputs/api-explainer.md: a plain-language explanation for the requester.
outputs/backend-handoff.md: a developer-facing backend handoff.
This skill is for planning and handoff. It does not implement code, run migrations, connect to production systems, or modify databases.
Core Rules
- Do not write or edit backend code unless the user explicitly starts a separate implementation task.
- Do not generate production SQL, destructive migration commands, real credentials, or live database instructions.
- Use the user's facts first. If something is unclear, mark it under
待确认 instead of inventing it.
- Ask at most 5 targeted clarifying questions when the request is too vague to produce a useful API brief.
- Prefer plain Chinese when the user's input is Chinese.
- Separate what the requester needs to understand from what the developer needs to implement.
- Treat backend authorization as server-side. Never accept "the frontend hides the button" as a permission solution.
- Keep outputs practical: enough for a developer to act, not a textbook.
- Explain unavoidable backend terms in plain language the first time they appear, for example
migration(数据库结构变更) or backfill(补齐历史数据).
- Label every inferred item as
建议 or 假设, not as a final decision.
- If the input contains customer data, secrets, account IDs, internal URLs, prices, contracts, or unreleased business details, ask whether to redact before finalizing.
Input Handling
When working in a starter folder, read input in this order:
inputs/api-request.md
inputs/put-your-request-here.md
- Other clearly relevant files under
inputs/
- Pasted requirements in the user message
Ignore unrelated files. If there is no starter folder, use the user's pasted request.
Extract these fields when present:
- feature name
- target user or actor
- business goal
- current system context
- roles and permissions
- data objects
- state changes
- list, search, filter, or sort requirements
- compatibility constraints
- email, SMS, invite link, reset link, or share link flows
- known risks or open questions
Clarifying Questions
Ask questions only when needed. Prefer questions that unblock API design:
- Who can perform this action, and who cannot?
- What should happen after the action succeeds?
- Can the action be undone or restored?
- Should old data be migrated or backfilled?
- Does this affect existing clients, pages, reports, or integrations?
- If this uses email, SMS, or an external link, how should the token expire, be revoked, retried, and protected from log leakage?
If the user asks to continue without answers, proceed with clearly labeled assumptions.
Two-Document Output Policy
Default to two documents:
api-explainer.md is for the requester. It should explain what backend work is involved, which decisions they need to make, and what to ask the developer.
backend-handoff.md is for the developer or coding agent. It should contain the concise API proposal, permissions, data reminders, test suggestions, and technical confirmation points.
- Keep
api-explainer.md plain and reassuring. Avoid endpoint overload; explain only the minimum API terms needed.
- Keep
backend-handoff.md specific and compact. It can use endpoint paths, status codes, and migration reminders.
- Keep each file practical, not exhaustive. For simple features, target 700-1200 Chinese characters per file.
- Put risk checks inside the relevant section of each document. Do not create a separate risk file unless the user asks.
- Put deep details under
待确认 instead of expanding every possible backend option.
- Use tables only when they make permissions, endpoints, or risks easier to scan.
Workflow
1. Restate the Feature
Summarize the user's request in 3-5 bullets:
- what problem it solves
- who uses it
- what changes in the system
- what is out of scope if stated
- what is unknown
2. Model the Backend Surface
Identify conceptual backend pieces:
- Actors: user roles, services, admins, external systems.
- Resources: domain objects such as projects, tasks, comments, files, orders.
- Actions: create, update, archive, restore, approve, reject, export.
- State rules: allowed status values and transitions.
- Permission boundaries: record-level, field-level, project/team/tenant-level.
- External links: token creation, expiry, revocation, replay protection, rate limits, and delivery failure handling.
Keep this conceptual. Mention possible database changes only as reminders, not final schema.
3. Write Requester Explainer
Write outputs/api-explainer.md first with this structure:
# 给自己看的接口说明:{功能名}
## 这件事后端要做什么
## 你需要先决定什么
## 它大概会有哪些接口
## 哪些地方容易出问题
## 你可以这样问开发
## 暂时不要做什么
This file should help a beginner understand and discuss the backend work. Avoid pretending the requester must understand backend implementation.
4. Write Developer Handoff
Write outputs/backend-handoff.md with this structure:
# 后端开发交接:{功能名}
## 需求摘要
## 建议接口
| 方法 | 路径 | 用途 | 权限 | 备注 |
| --- | --- | --- | --- | --- |
## 权限规则
## 数据变更提醒
## 错误码与状态码
## 测试建议
## 待确认
Keep this file short enough to paste into an issue, ticket, or chat message. It should be usable as an implementation starting point, but not as final code.
5. Optional Detailed API Brief
Only write outputs/api-brief.md if the user asks for a detailed API brief, OpenAPI draft, or full design document. Use this structure:
# 后端接口说明书:{功能名}
## 1. 小白版结论
## 2. 本次假设
## 3. 需求摘要
## 4. 范围与非目标
## 5. 用户角色与权限
## 6. 核心数据对象
## 7. 状态与业务规则
## 8. 建议接口清单
| 方法 | 路径 | 用途 | 谁可以用 | 备注 |
| --- | --- | --- | --- | --- |
## 9. 请求 / 响应示例
## 10. 错误码与状态码
## 11. 数据变更提醒
## 12. 测试与验收用例
## 13. 待确认
For endpoint design:
- Use nouns for resources where possible.
- Use action endpoints only when they clarify domain behavior, such as
POST /tasks/{id}/archive.
- Include permission notes per endpoint.
- Include 400, 401, 403, 404, 409, and 422 only when relevant.
- Include idempotency notes only when the action may be repeated, such as archive, restore, payment, import, export, or webhook-like actions.
- Avoid OpenAPI unless the user explicitly asks for it.
6. Review Risks
Do not create a separate risk file by default. Fold risk review into:
api-explainer.md under 哪些地方容易出问题
backend-handoff.md under 数据变更提醒, 测试建议, and 待确认
If the user asks for a separate risk review, write outputs/api-risk-review.md with this structure:
# API 风险检查:{功能名}
## 结论
{Ready / Ready with changes / Needs more design work 的中文判断}
## 风险清单
| 严重程度 | 领域 | 问题 | 影响 | 建议 |
| --- | --- | --- | --- | --- |
## 重点检查
### API 设计
### 权限与越权
### 数据与迁移
### 兼容性
### 测试与上线验证
## 待确认问题
Use severity levels:
高: could cause data leakage, data loss, production incident, incompatible API change, or broken permission boundary.
中: likely to cause bugs, support cost, migration risk, or unclear implementation.
低: useful improvement, naming cleanup, documentation gap, or future optimization.
优点: a good design choice worth keeping.
Always check:
- API names and HTTP methods match behavior.
- Lists have pagination when they can grow.
- Errors are structured and actionable.
- Permission checks happen on the backend.
- Field-level permission is explicit when some fields are more sensitive.
- Archived, deleted, restored, approved, or rejected states have clear rules.
- Data migration or backfill is called out when old records are affected.
- Existing clients or reports are not silently broken.
- Email, invite, reset-password, verification, or share-link flows call out token storage, expiry, replay, revocation, log leakage, rate limiting, and delivery failure handling.
File Writing Rules
When the user asks to generate files in a workspace:
- Create
outputs/ if it does not exist.
- Write
outputs/api-explainer.md.
- Write
outputs/backend-handoff.md.
- Write optional
outputs/api-brief.md or outputs/api-risk-review.md only when requested.
- In the final response, mention the files and any major assumptions or blocked questions.
If file writing is not possible, return the two Markdown documents in chat with clear filenames.
Final Checks
Before finishing, verify:
- The output does not claim code was implemented.
- No production SQL or destructive command is included.
- Permissions are server-side and specific.
- Data changes are reminders, not unsafe instructions.
- Risks include impact and suggested handling.
- Open questions are visible and not hidden in prose.
- A beginner can understand what to send to a developer next.
api-explainer.md is understandable without backend experience.
backend-handoff.md is specific enough for a developer to review.
1---2name: backend-api-brief3description: Backend API Brief4---56# Backend API Brief78## Goal910Turn a loose business request into two backend planning documents:1112Default outputs, in the order a beginner should read them:1314- `outputs/api-explainer.md`: a plain-language explanation for the requester.15- `outputs/backend-handoff.md`: a developer-facing backend handoff.1617This skill is for planning and handoff. It does not implement code, run migrations, connect to production systems, or modify databases.1819## Core Rules20211. Do not write or edit backend code unless the user explicitly starts a separate implementation task.222. Do not generate production SQL, destructive migration commands, real credentials, or live database instructions.233. Use the user's facts first. If something is unclear, mark it under `待确认` instead of inventing it.244. Ask at most 5 targeted clarifying questions when the request is too vague to produce a useful API brief.255. Prefer plain Chinese when the user's input is Chinese.266. Separate what the requester needs to understand from what the developer needs to implement.277. Treat backend authorization as server-side. Never accept "the frontend hides the button" as a permission solution.288. Keep outputs practical: enough for a developer to act, not a textbook.299. Explain unavoidable backend terms in plain language the first time they appear, for example `migration(数据库结构变更)` or `backfill(补齐历史数据)`.3010. Label every inferred item as `建议` or `假设`, not as a final decision.3111. If the input contains customer data, secrets, account IDs, internal URLs, prices, contracts, or unreleased business details, ask whether to redact before finalizing.3233## Input Handling3435When working in a starter folder, read input in this order:36371. `inputs/api-request.md`382. `inputs/put-your-request-here.md`393. Other clearly relevant files under `inputs/`404. Pasted requirements in the user message4142Ignore unrelated files. If there is no starter folder, use the user's pasted request.4344Extract these fields when present:4546- feature name47- target user or actor48- business goal49- current system context50- roles and permissions51- data objects52- state changes53- list, search, filter, or sort requirements54- compatibility constraints55- email, SMS, invite link, reset link, or share link flows56- known risks or open questions5758## Clarifying Questions5960Ask questions only when needed. Prefer questions that unblock API design:6162- Who can perform this action, and who cannot?63- What should happen after the action succeeds?64- Can the action be undone or restored?65- Should old data be migrated or backfilled?66- Does this affect existing clients, pages, reports, or integrations?67- If this uses email, SMS, or an external link, how should the token expire, be revoked, retried, and protected from log leakage?6869If the user asks to continue without answers, proceed with clearly labeled assumptions.7071## Two-Document Output Policy7273Default to two documents:7475- `api-explainer.md` is for the requester. It should explain what backend work is involved, which decisions they need to make, and what to ask the developer.76- `backend-handoff.md` is for the developer or coding agent. It should contain the concise API proposal, permissions, data reminders, test suggestions, and technical confirmation points.77- Keep `api-explainer.md` plain and reassuring. Avoid endpoint overload; explain only the minimum API terms needed.78- Keep `backend-handoff.md` specific and compact. It can use endpoint paths, status codes, and migration reminders.79- Keep each file practical, not exhaustive. For simple features, target 700-1200 Chinese characters per file.80- Put risk checks inside the relevant section of each document. Do not create a separate risk file unless the user asks.81- Put deep details under `待确认` instead of expanding every possible backend option.82- Use tables only when they make permissions, endpoints, or risks easier to scan.8384## Workflow8586### 1. Restate the Feature8788Summarize the user's request in 3-5 bullets:8990- what problem it solves91- who uses it92- what changes in the system93- what is out of scope if stated94- what is unknown9596### 2. Model the Backend Surface9798Identify conceptual backend pieces:99100- **Actors**: user roles, services, admins, external systems.101- **Resources**: domain objects such as projects, tasks, comments, files, orders.102- **Actions**: create, update, archive, restore, approve, reject, export.103- **State rules**: allowed status values and transitions.104- **Permission boundaries**: record-level, field-level, project/team/tenant-level.105- **External links**: token creation, expiry, revocation, replay protection, rate limits, and delivery failure handling.106107Keep this conceptual. Mention possible database changes only as reminders, not final schema.108109### 3. Write Requester Explainer110111Write `outputs/api-explainer.md` first with this structure:112113```text114# 给自己看的接口说明:{功能名}115116## 这件事后端要做什么117118## 你需要先决定什么119120## 它大概会有哪些接口121122## 哪些地方容易出问题123124## 你可以这样问开发125126## 暂时不要做什么127```128129This file should help a beginner understand and discuss the backend work. Avoid pretending the requester must understand backend implementation.130131### 4. Write Developer Handoff132133Write `outputs/backend-handoff.md` with this structure:134135```text136# 后端开发交接:{功能名}137138## 需求摘要139140## 建议接口141142| 方法 | 路径 | 用途 | 权限 | 备注 |143| --- | --- | --- | --- | --- |144145## 权限规则146147## 数据变更提醒148149## 错误码与状态码150151## 测试建议152153## 待确认154```155156Keep this file short enough to paste into an issue, ticket, or chat message. It should be usable as an implementation starting point, but not as final code.157158### 5. Optional Detailed API Brief159160Only write `outputs/api-brief.md` if the user asks for a detailed API brief, OpenAPI draft, or full design document. Use this structure:161162```text163# 后端接口说明书:{功能名}164165## 1. 小白版结论166167## 2. 本次假设168169## 3. 需求摘要170171## 4. 范围与非目标172173## 5. 用户角色与权限174175## 6. 核心数据对象176177## 7. 状态与业务规则178179## 8. 建议接口清单180181| 方法 | 路径 | 用途 | 谁可以用 | 备注 |182| --- | --- | --- | --- | --- |183184## 9. 请求 / 响应示例185186## 10. 错误码与状态码187188## 11. 数据变更提醒189190## 12. 测试与验收用例191192## 13. 待确认193```194195For endpoint design:196197- Use nouns for resources where possible.198- Use action endpoints only when they clarify domain behavior, such as `POST /tasks/{id}/archive`.199- Include permission notes per endpoint.200- Include 400, 401, 403, 404, 409, and 422 only when relevant.201- Include idempotency notes only when the action may be repeated, such as archive, restore, payment, import, export, or webhook-like actions.202- Avoid OpenAPI unless the user explicitly asks for it.203204### 6. Review Risks205206Do not create a separate risk file by default. Fold risk review into:207208- `api-explainer.md` under `哪些地方容易出问题`209- `backend-handoff.md` under `数据变更提醒`, `测试建议`, and `待确认`210211If the user asks for a separate risk review, write `outputs/api-risk-review.md` with this structure:212213```text214# API 风险检查:{功能名}215216## 结论217218{Ready / Ready with changes / Needs more design work 的中文判断}219220## 风险清单221222| 严重程度 | 领域 | 问题 | 影响 | 建议 |223| --- | --- | --- | --- | --- |224225## 重点检查226227### API 设计228229### 权限与越权230231### 数据与迁移232233### 兼容性234235### 测试与上线验证236237## 待确认问题238```239240Use severity levels:241242- `高`: could cause data leakage, data loss, production incident, incompatible API change, or broken permission boundary.243- `中`: likely to cause bugs, support cost, migration risk, or unclear implementation.244- `低`: useful improvement, naming cleanup, documentation gap, or future optimization.245- `优点`: a good design choice worth keeping.246247Always check:248249- API names and HTTP methods match behavior.250- Lists have pagination when they can grow.251- Errors are structured and actionable.252- Permission checks happen on the backend.253- Field-level permission is explicit when some fields are more sensitive.254- Archived, deleted, restored, approved, or rejected states have clear rules.255- Data migration or backfill is called out when old records are affected.256- Existing clients or reports are not silently broken.257- Email, invite, reset-password, verification, or share-link flows call out token storage, expiry, replay, revocation, log leakage, rate limiting, and delivery failure handling.258259## File Writing Rules260261When the user asks to generate files in a workspace:2622631. Create `outputs/` if it does not exist.2642. Write `outputs/api-explainer.md`.2653. Write `outputs/backend-handoff.md`.2664. Write optional `outputs/api-brief.md` or `outputs/api-risk-review.md` only when requested.2675. In the final response, mention the files and any major assumptions or blocked questions.268269If file writing is not possible, return the two Markdown documents in chat with clear filenames.270271## Final Checks272273Before finishing, verify:274275- The output does not claim code was implemented.276- No production SQL or destructive command is included.277- Permissions are server-side and specific.278- Data changes are reminders, not unsafe instructions.279- Risks include impact and suggested handling.280- Open questions are visible and not hidden in prose.281- A beginner can understand what to send to a developer next.282- `api-explainer.md` is understandable without backend experience.283- `backend-handoff.md` is specific enough for a developer to review.