85 lines
1.8 KiB
Plaintext
85 lines
1.8 KiB
Plaintext
---
|
||
description: 规则审查员检查清单
|
||
alwaysApply: false
|
||
---
|
||
|
||
# 规则审查员检查清单
|
||
|
||
## 一、后端检查
|
||
|
||
### 分层架构
|
||
- [ ] API 是否只调用 Service?
|
||
- [ ] Service 是否调用 Repository?
|
||
- [ ] Repository 是否只负责数据访问?
|
||
|
||
### 统一处理
|
||
- [ ] 是否使用 `handleRequest`?
|
||
- [ ] 是否使用 `jsonSuccess/jsonError`?
|
||
|
||
### 错误处理
|
||
- [ ] 是否使用 `AppError + ErrorCode`?
|
||
- [ ] 禁止 `throw new Error()`
|
||
|
||
### 事务处理
|
||
- [ ] 多表操作是否使用 `$transaction`?
|
||
|
||
---
|
||
|
||
## 二、前端检查
|
||
|
||
### 元组件
|
||
- [ ] 是否使用 `@/components/ui/` 元组件?
|
||
- [ ] 禁止原生 `<button>` / `<input>` / `<select>`
|
||
|
||
### 颜色规范
|
||
- [ ] 是否使用 `text-apple-label-*`?
|
||
- [ ] 是否使用 `bg-apple-bg-*`?
|
||
- [ ] 禁止 `text-gray-*` / `bg-gray-*`
|
||
|
||
### 圆角规范
|
||
- [ ] 是否使用 `rounded-apple-md/lg`?
|
||
|
||
---
|
||
|
||
## 三、审查报告格式
|
||
|
||
```
|
||
## 审查结果
|
||
|
||
### 通过项 ✅
|
||
- 使用了 Service 层
|
||
- 使用了 Button 元组件
|
||
|
||
### 违规项 ❌
|
||
- API 中直接使用 prisma(第 15 行)
|
||
→ 修复:将数据库查询移到 Repository 层
|
||
|
||
- 使用了 text-gray-500(第 23 行)
|
||
→ 修复:改为 text-apple-label-secondary
|
||
|
||
### 评分:X/10
|
||
```
|
||
|
||
---
|
||
|
||
## 四、快速对照表
|
||
|
||
### 后端
|
||
|
||
| 正确 | 错误 |
|
||
|------|------|
|
||
| `await xxxService.getXxx()` | `await prisma.xxx.findMany()` 在 API 中 |
|
||
| `handleRequest(request, ...)` | 自己写 try-catch |
|
||
| `jsonSuccess(data)` | `NextResponse.json({...})` |
|
||
| `AppError(ErrorCode.XXX)` | `throw new Error('xxx')` |
|
||
| `$transaction(...)` | 多个独立 prisma 调用 |
|
||
|
||
### 前端
|
||
|
||
| 正确 | 错误 |
|
||
|------|------|
|
||
| `<Button>` | `<button>` |
|
||
| `text-apple-label-*` | `text-gray-*` |
|
||
| `bg-apple-bg-*` | `bg-gray-*` |
|
||
| `rounded-apple-md/lg` | `rounded-lg/xl` |
|