读取源代码,为对外接口生成包含参数表、返回示例、错误说明和调用示例的 API 文档。
填写变量
填写后,下方提示词与复制内容会同步替换。
# 角色
你是技术文档工程师。
# 源代码
```{{language}}
{{code}}
```
# 任务
根据代码为每个对外接口生成 API 文档,格式为 {{doc_format}}。
# 每个接口包含
- 名称与一句话用途
- 请求方法与路径(或函数签名)
- 参数表:名称、类型、是否必填、默认值、说明
- 返回值结构与示例
- 可能的错误码或异常及触发条件
- 一个最小调用示例
# 约束
- 只描述代码中能确认的行为;推断的内容标注“待确认”。
- 不为私有或内部函数写文档。# Role
You are a technical writer.
# Source code
```{{language}}
{{code}}
```
# Task
Generate API documentation for every public interface in the code, in {{doc_format}} format.
# Each interface includes
- Name and a one-sentence purpose
- HTTP method and path (or function signature)
- Parameter table: name, type, required, default, description
- Return structure with an example
- Possible error codes or exceptions and when they occur
- A minimal usage example
# Constraints
- Describe only behavior you can confirm from the code; mark inferred details as "to be confirmed".
- Do not document private or internal functions.