Api doc template

From jie023/trae-setting · View interactive version

Api doc template is an AI agent skill from the GitHub repository jie023/trae-setting. Provides API documentation template and standards for RESTful API, gRPC, and other interfaces. Includes request/response format, parameter definitions, error codes, and Markdown documentation structure. Invoke when generating API documentation or interface specifications.

How to use this skill

Skill file

API文档模版规范

本技能提供标准化的API接口文档模版,适用于RESTful API、gRPC等主流接口规范。确保接口文档结构清晰、内容完整、术语准确。

接口文档规范

标准模版格式

##### 简要描述

- 获取全部摄像头报警

##### 请求URL
- `/Api/V1_0/AppAdmin/CameraReportPolice/GetAllCameraReportPoliceTable`

##### 请求方式
- POST

##### 参数

|参数名|必选|类型|说明|
|:----    |:---|:----- |-----   |
|token |是  |string |企业用户token   |

##### 请求示例

{

"iStart": 0,

"iLength": 10,

"data": {}

}


##### 返回示例

{

"code": 0,

"message": "",

"data": {

"allSize": 1,

"pageSize": 1,

"list": [

{

"cameraReportPoliceEventType": ""

}

]

}

}


##### 返回参数说明

|参数名|类型|说明|
|:-----  |:-----|-----                           |
|code |int   |返回码  |
|message |String   |返回码描述  |
|data |   |返回数据  |
|allSize |int   |全部数据数量  |

文档规范要求

1. 简要描述

2. 请求URL

3. 请求方式

4. 参数说明表格

|参数名|必选|类型|说明|

|:---- |:---|:----- |----- |

5. 请求示例

6. 返回示例

7. 返回参数说明表格

|参数名|类型|说明|

|:----- |:-----|----- |

常用返回码规范

|返回码|说明|

|:----- |:----- |

|0 |成功 |

|-1 |系统异常 |

|-2 |参数错误 |

|-3 |未登录 |

|-4 |无权限 |

|-5 |数据不存在 |

特殊场景处理

分页接口

列表查询接口

文件上传接口

文件下载接口

文档命名规范

文件存储规范

注意事项

  1. 参数验证:所有参数必须说明是否必选、数据类型、取值范围
  2. 返回码:必须说明所有可能的返回码及其含义
  3. 示例完整:请求和返回示例必须完整、真实可用
  4. 术语统一:文档中使用的术语必须与代码保持一致
  5. 版本管理:接口变更时需要更新文档版本号
  6. 错误处理:必须说明异常情况下的返回格式和错误信息
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.