Files
everything-claude-code/docs/zh-CN/rules/common/patterns.md
zdoc.app 95f63c3cb0 docs(zh-CN): sync Chinese docs with latest upstream changes (#202)
* docs(zh-CN): sync Chinese docs with latest upstream changes

* docs: improve Chinese translation consistency in go-test.md

* docs(zh-CN): update image paths to use shared assets directory

- Update image references from ./assets/ to ../../assets/
- Remove zh-CN/assets directory to use shared assets

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
2026-02-13 01:04:58 -08:00

914 B
Raw Blame History

常见模式

骨架项目

当实现新功能时:

  1. 搜索经过实战检验的骨架项目
  2. 使用并行代理评估选项:
    • 安全性评估
    • 可扩展性分析
    • 相关性评分
    • 实施规划
  3. 克隆最佳匹配作为基础
  4. 在已验证的结构内迭代

设计模式

仓库模式

将数据访问封装在一个一致的接口之后:

  • 定义标准操作findAll, findById, create, update, delete
  • 具体实现处理存储细节数据库、API、文件等
  • 业务逻辑依赖于抽象接口,而非存储机制
  • 便于轻松切换数据源,并使用模拟对象简化测试

API 响应格式

对所有 API 响应使用一致的信封格式:

  • 包含一个成功/状态指示器
  • 包含数据载荷(出错时可为空)
  • 包含一个错误消息字段(成功时可为空)
  • 为分页响应包含元数据(总数、页码、限制)