帮助用户识别并降低软件系统复杂度,提升可维护性与开发效率。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "Reducing Complexity" 技能: 1. 下载 https://raw.githubusercontent.com/obra/clank/main/skills/architecture/reducing-complexity/SKILL.md 2. 保存为 ~/.claude/skills/reducing-complexity/SKILL.md 3. 装好后重载技能,告诉我可以用了
请分析这段模块设计,找出导致复杂度过高的关键因素,并给出分步重构建议,重点说明如何减少耦合、简化接口和提升可维护性。
一份复杂度诊断与重构方案,包含问题来源、优化原则和实施步骤。
请评估这个系统架构中哪些部分设计过度复杂,并提出更简单的替代方案,说明对开发、测试和运维的影响。
一份架构简化建议,比较当前方案与替代方案的复杂度和权衡。
请为软件团队整理一套控制复杂度的开发原则,包括代码结构、模块边界、命名、依赖管理和评审检查项。
一套可执行的复杂度控制规范,适合团队在开发和评审中直接使用。
Managing complexity is the most important technical topic in software development. All other technical goals—performance, features, elegance—are secondary to managing complexity.
Core principle: "There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other is to make it so complicated that there are no obvious deficiencies." - C.A.R. Hoare
Always choose the first way.
Use as guiding principle for EVERY technical decision:
Warning signs of complexity overload:
Inherent in the real-world problem itself. Can't be eliminated, only managed.
Examples:
Approach: Minimize what anyone's brain must deal with at one time.
Complexity we introduce through our design and implementation choices. CAN be eliminated.
Examples:
Approach: Keep accidental complexity from needlessly proliferating.
Two fundamental approaches, three practical strategies:
Implemented through three strategies:
Dijkstra's insight: No one's skull is big enough to contain a modern program. Organize programs so you can safely focus on one part at a time.
Think of it as mental juggling: More mental balls to keep in air = more likely to drop one = design or coding error.
At each level:
Goal: Make each piece simple enough to understand fully in isolation.
Good design lets you safely IGNORE most of the program while working on any one part.
Questions to ask:
If answer is no: Design isn't doing its job. Increase encapsulation, reduce coupling.
Each abstraction should:
Example:
# ❌ Low-level, complex
current_font.attribute = current_font.attribute or 0x02
# ✅ High-level, simple
current_font.set_bold_on()
Working with fonts (problem domain) > manipulating bit fields (implementation domain)
All aimed at managing complexity:
| Characteristic | Why It Reduces Complexity |
…
先用伪代码梳理方案与迭代思路,再高效转成可执行代码。
帮助开发者用早返回或表驱动方式简化嵌套条件分支,提升代码可读性。
帮助你为变量选择清晰准确、易维护的命名,提升代码可读性。
帮助开发者保持类接口抽象一致,避免混杂序列化、持久化等无关职责。
帮助你撰写不过时的代码注释,聚焦做什么与为什么而非时序背景。
帮助用户检索过往 Claude Code 对话,快速找回事实、决策与上下文线索。
帮助用户用接口封装实现细节,从业务层面设计与理解系统
帮助你识别职责混杂的例程,并拆分为单一职责的清晰结构。
帮助开发者用单一职责变量提升代码可读性、可维护性与调试效率
帮助开发者用先写测试再实现代码的方式提升质量与可维护性。
将复杂问题拆解为清晰可执行步骤,并可迭代调整方案。