architecture-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Architecture Review

架构审查

Analyze, audit, and improve project structure.
分析、审计并优化项目结构。

Key Principles

核心原则

  • Measure before changing — Map structure and identify concrete issues before proposing changes
  • Clear boundaries — Layers (UI, logic, data) separated with consistent dependency direction
  • Colocation — Related code together; easy to find, change, and delete features
  • Incremental migration — Refactor in phases, validate each step with tests
  • 先度量再变更 —— 在提出变更前,先梳理现有结构并明确具体问题
  • 清晰的边界 —— 各层级(UI、逻辑、数据)分离,依赖方向保持一致
  • 就近组织 —— 相关代码放在一起;便于查找、修改和删除功能
  • 增量迁移 —— 分阶段重构,每一步都通过测试验证

Quick Assessment

快速评估要点

  • No circular dependencies
  • Consistent directory naming and grouping (by feature or by type)
  • Single responsibility per file/module, reasonable file sizes (<500 lines)
  • External dependencies isolated, shared code properly extracted
  • New developers can navigate and find code for any feature easily
  • 无循环依赖
  • 目录命名与分组保持一致(按功能或按类型)
  • 每个文件/模块单一职责,文件大小合理(少于500行)
  • 外部依赖隔离,共享代码已正确提取
  • 新开发者能够轻松导航并找到任意功能的代码

Quick Start Checklist

快速启动检查清单

  1. Map current structure: directory tree, dependency graph, module boundaries
  2. Identify issues: circular deps, god modules, leaky abstractions, deep nesting
  3. Classify severity: critical (blocks dev), high (maintenance burden), medium/low (friction)
  4. Propose target structure with migration plan
  5. Execute incrementally, validating with tests after each move
  1. 梳理当前结构:目录树、依赖图谱、模块边界
  2. 识别问题:循环依赖、上帝模块、抽象泄漏、过深嵌套
  3. 划分严重程度:严重(阻碍开发)、高(维护负担)、中/低(开发摩擦)
  4. 提出目标结构及迁移计划
  5. 增量执行,每次移动后通过测试验证

References

参考资料

ReferenceDescription
analysis-techniques.mdDependency graphs, complexity metrics, code analysis
refactoring-patterns.mdSafe refactoring techniques, migration strategies
structural-patterns.mdDirectory structures for different project types
dependency-management.mdCircular deps, coupling, module boundaries
cleanup-strategies.mdDead code removal, consolidation, naming conventions
anti-rationalization.mdIron Law, common rationalizations, red flag STOP list for architecture discipline
参考文档描述
analysis-techniques.md依赖图谱、复杂度指标、代码分析
refactoring-patterns.md安全重构技术、迁移策略
structural-patterns.md不同项目类型的目录结构
dependency-management.md循环依赖、耦合性、模块边界
cleanup-strategies.md死代码移除、代码合并、命名规范
anti-rationalization.md铁律、常见合理化借口、架构规范的红色预警停止清单