docyrus-api-doctor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDocyrus API Doctor
Docyrus API Doctor
Post-implementation checklist for Docyrus API code. Run through each applicable check after writing or modifying API logic. Fix every issue found before considering the task complete.
How to use: After implementing API logic, scan the changed code against each check below. Skip checks that don't apply to the code at hand. For detailed explanations and fix examples, read .
references/checklist-details.mdDocyrus API代码的实现后检查清单。在编写或修改API逻辑后逐一完成所有适用的检查。在认为任务完成之前,修复所有发现的问题。
使用方法: 实现API逻辑后,对照以下每个检查项扫描修改后的代码。跳过与当前代码无关的检查项。如需详细说明和修复示例,请阅读。
references/checklist-details.mdBUG — Will Cause Errors
BUG — 会引发错误
| # | Check | What to look for |
|---|---|---|
| B1 | Missing | Any |
| B2 | | |
| B3 | Child query key not in | If |
| B4 | Formula key not in | If |
| B5 | Aggregation via | Using |
| B6 | | These are mutually exclusive. Use |
| B7 | Formula | |
| B8 | Formula | |
| B9 | Formula | |
| B10 | Formula math operand count | Math operations ( |
| B11 | Formula | |
| B12 | Uncast literal in | String literals inside |
| # | 检查项 | 检查点 |
|---|---|---|
| B1 | **缺少 | 任何未携带 |
| B2 | 查询负载中存在 | |
| B3 | **子查询key不在 | 如果 |
| B4 | 公式key不在 | 如果 |
| B5 | 通过 | 在列中使用 |
| B6 | | 这两个参数互斥。聚合操作请使用 |
| B7 | 公式 | |
| B8 | 公式 | |
| B9 | 公式 | |
| B10 | 公式数学运算操作数数量错误 | 数学运算( |
| B11 | | |
| B12 | | |
PERFORMANCE — Degrades Speed or Wastes Resources
性能 — 降低运行速度或浪费资源
| # | Check | What to look for |
|---|---|---|
| P1 | Unnecessary | When using |
| P2 | | If you only need the count (not the rows), use |
| P3 | Unnecessary | When using |
| P4 | Over-fetching columns | Columns selected in |
| P5 | Large | |
| P6 | Missing | Rendering relation/enum/user field |
| P7 | Fetching rows for existence checks | Fetching records just to check if any exist. Use |
| P8 | Redundant overlapping queries | Multiple queries on the same data source fetching overlapping columns that could be combined into one. |
| # | 检查项 | 检查点 |
|---|---|---|
| P1 | **聚合查询上存在不必要的 | 当使用 |
| P2 | **仅为获取总数时使用 | 如果你只需要总数(不需要行数据),请使用 |
| P3 | **仅使用 | 当使用 |
| P4 | **过度拉取列数据 | |
| P5 | **未做分页但 | |
| P6 | 缺少 | 渲染关联/枚举/用户字段的 |
| P7 | 拉取行数据仅用于存在性检查 | 拉取记录仅为了检查是否存在。请改用 |
| P8 | 冗余的重复查询 | 对同一数据源发起多次查询拉取重叠的列,这些查询可以合并为一个。 |
CODE QUALITY — Causes Maintenance Pain
代码质量 — 导致维护困难
| # | Check | What to look for |
|---|---|---|
| Q1 | Heavy | Casting API responses with |
| Q2 | Missing | |
| Q3 | No error handling on mutations | |
| Q4 | Missing query invalidation after mutations | After create/update/delete, related query keys must be invalidated so lists refresh. |
| Q5 | Serial cache invalidations | Multiple |
| Q6 | Using deprecated | Replace with the |
| Q7 | Hardcoded data source paths | Raw |
| Q8 | | |
| # | 检查项 | 检查点 |
|---|---|---|
| Q1 | 对响应进行过重的 | 没有运行时校验直接用 |
| Q2 | 依赖型查询缺少 | 依赖运行时值(例如 |
| Q3 | 变更操作没有错误处理 | 调用 |
| Q4 | **变更操作后没有失效相关查询 | 增删改操作后,必须失效相关的查询key,这样列表才会刷新。 |
| Q5 | 串行执行缓存失效 | 串行执行多个 |
| Q6 | **使用已废弃的 | 请替换为 |
| Q7 | 硬编码数据源路径 | 直接写 |
| Q8 | | |
How to Run
运行方式
- Identify all files changed in this task that contain Docyrus API calls
- For each file, scan for ,
.list(,.get(,.create(,.update(,.delete(,client.get(,client.post(,client.patch(client.delete( - Check each call site against the BUG checks (B1-B12)
- Check query payloads against PERFORMANCE checks (P1-P8)
- Check surrounding code (hooks, error handling, invalidation) against CODE QUALITY checks (Q1-Q8)
- Fix all issues found, starting with BUG category
- 识别本次任务中所有包含Docyrus API调用的已修改文件
- 对每个文件,扫描查找,
.list(,.get(,.create(,.update(,.delete(,client.get(,client.post(,client.patch(client.delete( - 对照BUG检查项(B1-B12)检查每个调用位点
- 对照性能检查项(P1-P8)检查查询负载
- 对照代码质量检查项(Q1-Q8)检查周边代码(钩子、错误处理、失效逻辑)
- 修复所有发现的问题,优先修复BUG类问题
References
参考资料
- — Detailed explanation, detection pattern, and before/after fix example for every check item
references/checklist-details.md
- — 每个检查项的详细说明、检测模式以及修复前后的示例
references/checklist-details.md