降低代码阅读负担原则
principle-minimize-reader-load
在审查或调整难以追踪的代码时应用。计算从问题到答案之间跨越了多少层,以及读者脑中需要维持多少隐藏状态;合并只有一个调用方的包装函数,缩小可变状态的作用域。
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- principle-minimize-reader-load
- description
- Apply when reviewing or shaping code that's hard to trace. Count layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope.
- disable-model-invocation
- true
03 SKILL.md 正文
Minimize Reader Load
Maintainability is the work a reader must do to understand code. Track two axes: layers to trace (indirections between the question and the answer) and state to hold (hidden or mutable context the reader must keep in their head). LOC, cyclomatic complexity, and "clean architecture" are proxies. Reader load is the thing that matters. The two axes are independent. A flat file with 50 globals can be as hard to reason about as a 6-layer adapter stack. Guard both. This is the human analog of Guard the Context Window. Working memory is finite for readers too.
- Collapse layers that cost more than they save: wrappers with one caller, adapters with no second implementation, speculative indirection that was never needed. Inline them.
- Make adjacent layers change the abstraction. A layer that repeats the same methods and arguments adds reader load without compression. Collapse pass-through layers.
- Demand interface compression. A broad interface that hides little complexity makes readers learn both the surface and the implementation. Prefer boundaries that hide meaningful decisions.
- Shrink state scope: prefer pure functions (returns over mutations), locals over fields, fields over module state, and module state over globals. Derive instead of sync.
- Name the invariant at the boundary, not in every consumer, so the reader learns it once.
- Before adding a layer or a piece of state, ask: does it reduce reader load elsewhere by at least as much?
The test: can a new reader answer "where does X come from?" and "what can change X?" in under 30 seconds? If not, cut layers or cut state.
04 同仓库更多 Skills
Claude 技能创建指南
skill-creator
创建有效技能的指南。当用户想要创建新技能(或更新现有技能),以通过专业知识、工作流或工具集成来扩展 Claude 的能力时,应使用此技能。
素材成文逐段撰写
writing-shape
写作,利用(exploit):将原始素材逐段塑造成一篇文章。
Playwright 网页应用测试
webapp-testing
使用 Playwright 测试本地 Web 应用。适用于验证前端功能、调试 UI 行为、截取浏览器截图或查看浏览器日志。
消息重述
wait-what
停。上一条消息没有被理解(没说清楚):换一种方式重新表述。
快速原型构建
prototype
构建一个一次性原型来回答设计问题。当用户想要验证某个状态模型或逻辑是否合理,或探索 UI 应该是什么样子时使用。
代码库架构优化分析
improve-codebase-architecture
扫描代码库以发现可深化改进的机会,将其以可视化 HTML 报告的形式呈现,然后对你选中的某一项进行深入质询。