finish-work
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFinish Work - Pre-Commit Checklist
完成工作 - 预提交检查清单
Before submitting or committing, use this checklist to ensure work completeness.
Timing: After code is written and tested, before commit
在提交或代码入库前,使用本检查清单确保工作的完整性。
时机:代码编写并测试完成后,提交前
Checklist
检查清单
1. Code Quality
1. 代码质量
bash
undefinedbash
undefinedMust pass
必须通过
pnpm lint
pnpm type-check
pnpm test
- [ ] `pnpm lint` passes with 0 errors?
- [ ] `pnpm type-check` passes with no type errors?
- [ ] Tests pass?
- [ ] No `console.log` statements (use logger)?
- [ ] No non-null assertions (the `x!` operator)?
- [ ] No `any` types?pnpm lint
pnpm type-check
pnpm test
- [ ] `pnpm lint` 执行通过,无错误?
- [ ] `pnpm type-check` 执行通过,无类型错误?
- [ ] 所有测试用例通过?
- [ ] 未遗留 `console.log` 语句(请使用日志工具)?
- [ ] 未使用非空断言符(`x!` 运算符)?
- [ ] 未使用 `any` 类型?2. Code-Spec Sync
2. 代码与规范同步
Code-Spec Docs:
- Does need updates?
.trellis/spec/cli/backend/- New patterns, new modules, new conventions
- Does need updates?
.trellis/spec/cli/frontend/- New components, new hooks, new patterns
- Does need updates?
.trellis/spec/guides/- New cross-layer flows, lessons from bugs
Key Question:
"If I fixed a bug or discovered something non-obvious, should I document it so future me (or others) won't hit the same issue?"
If YES -> Update the relevant code-spec doc.
代码规范文档:
- 是否需要更新 ?
.trellis/spec/cli/backend/- 新增模式、模块或约定
- 是否需要更新 ?
.trellis/spec/cli/frontend/- 新增组件、钩子或模式
- 是否需要更新 ?
.trellis/spec/guides/- 新增跨层流程、从bug中总结的经验
核心问题:
"如果我修复了一个bug或发现了某个非显而易见的点,是否应该记录下来,避免未来的自己(或其他人)遇到同样的问题?"
如果答案是是 -> 更新相关的代码规范文档。
2.5. Code-Spec Hard Block (Infra/Cross-Layer)
2.5. 代码与规范强制检查(基础架构/跨层)
If this change touches infra or cross-layer contracts, this is a blocking checklist:
- Spec content is executable (real signatures/contracts), not principle-only text
- Includes file path + command/API name + payload field names
- Includes validation and error matrix
- Includes Good/Base/Bad cases
- Includes required tests and assertion points
Block Rule:
If infra/cross-layer changed but the related spec is still abstract, do NOT finish. Run manually first.
/trellis:update-spec若本次变更涉及基础架构或跨层契约,以下为阻塞性检查项:
- 规范内容具备可执行性(包含真实的签名/契约),而非仅为原则性文字
- 包含文件路径 + 命令/API名称 + 载荷字段名
- 包含校验规则与错误矩阵
- 包含正向/基准/反向测试用例
- 包含必填测试用例与断言点
阻塞规则:
若基础架构/跨层已变更,但相关规范仍停留在抽象描述层面,请勿完成提交。需先手动运行 更新规范。
/trellis:update-spec3. API Changes
3. API变更
If you modified API endpoints:
- Input schema updated?
- Output schema updated?
- API documentation updated?
- Client code updated to match?
若你修改了API端点:
- 输入 schema 是否已更新?
- 输出 schema 是否已更新?
- API文档 是否已更新?
- 客户端代码是否已同步更新以匹配变更?
4. Database Changes
4. 数据库变更
If you modified database schema:
- Migration file created?
- Schema file updated?
- Related queries updated?
- Seed data updated (if applicable)?
若你修改了数据库 schema:
- 是否已创建迁移文件?
- Schema文件 是否已更新?
- 相关查询语句 是否已更新?
- 种子数据 是否已更新(如适用)?
5. Cross-Layer Verification
5. 跨层验证
If the change spans multiple layers:
- Data flows correctly through all layers?
- Error handling works at each boundary?
- Types are consistent across layers?
- Loading states handled?
若变更涉及多个层级:
- 数据是否能在所有层级间正确流转?
- 每个边界的错误处理是否正常工作?
- 各层级间的类型是否保持一致?
- 加载状态是否已妥善处理?
6. Manual Testing
6. 手动测试
- Feature works in browser/app?
- Edge cases tested?
- Error states tested?
- Works after page refresh?
- 功能在浏览器/应用中正常工作?
- 边缘情况已测试?
- 错误状态已测试?
- 页面刷新后功能仍正常?
Quick Check Flow
快速检查流程
bash
undefinedbash
undefined1. Code checks
1. 代码检查
pnpm lint && pnpm type-check
pnpm lint && pnpm type-check
2. View changes
2. 查看变更
git status
git diff --name-only
git status
git diff --name-only
3. Based on changed files, check relevant items above
3. 根据变更文件,检查上述相关项
---
---Common Oversights
常见遗漏项
| Oversight | Consequence | Check |
|---|---|---|
| Code-spec docs not updated | Others don't know the change | Check .trellis/spec/ |
| Spec text is abstract only | Easy regressions in infra/cross-layer changes | Require signature/contract/matrix/cases/tests |
| Migration not created | Schema out of sync | Check db/migrations/ |
| Types not synced | Runtime errors | Check shared types |
| Tests not updated | False confidence | Run full test suite |
| Console.log left in | Noisy production logs | Search for console.log |
| 遗漏项 | 后果 | 检查方式 |
|---|---|---|
| 代码规范文档未更新 | 其他成员不了解变更内容 | 检查 .trellis/spec/ 目录 |
| 规范仅为抽象文字描述 | 基础架构/跨层变更易出现回归 | 要求包含签名/契约/错误矩阵/测试用例/断言点 |
| 未创建迁移文件 | Schema与实际数据不同步 | 检查 db/migrations/ 目录 |
| 类型未同步更新 | 出现运行时错误 | 检查共享类型定义 |
| 测试用例未更新 | 产生错误的信心 | 运行完整测试套件 |
| 遗留 console.log | 生产环境日志冗余 | 搜索代码中的 console.log |
Relationship to Other Commands
与其他命令的关联
Development Flow:
Write code -> Test -> /trellis:finish-work -> git commit -> /trellis:record-session
| |
Ensure completeness Record progress
Debug Flow:
Hit bug -> Fix -> /trellis:break-loop -> Knowledge capture
|
Deep analysis- - Check work completeness (this command)
/trellis:finish-work - - Record session and commits
/trellis:record-session - - Deep analysis after debugging
/trellis:break-loop
开发流程:
编写代码 -> 测试 -> /trellis:finish-work -> git commit -> /trellis:record-session
| |
确保工作完整性 记录开发进度
调试流程:
发现bug -> 修复 -> /trellis:break-loop -> 知识沉淀
|
深度分析问题- - 检查工作完整性(即本命令)
/trellis:finish-work - - 记录开发会话与提交记录
/trellis:record-session - - 调试完成后的深度分析
/trellis:break-loop
Core Principle
核心原则
Delivery includes not just code, but also documentation, verification, and knowledge capture.
Complete work = Code + Docs + Tests + Verification
交付内容不仅包含代码,还需包含文档、验证及知识沉淀。
完整工作 = 代码 + 文档 + 测试 + 验证