360 Secure SkillHub
360 安全技能中心

principle-minimize-reader-load

该 Skill 提供代码可读性审查原则:识别问题与答案之间的多余层级,以及读者需在脑中维护的隐藏或可变状态;建议内联单调用包装器、减少可变作用域并在边界处声明不变量。

分类:开发
michael-denyer
热度 0.00
最近更新 2026-11-25 17:33:00

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add michael-denyer/pstack-claude/principle-minimize-reader-load
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
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.
user-invocable
false

Minimize Reader Load

Reader load is the work a reader must do to understand code. It has two independent axes: layers to trace between the question and the answer, and hidden or mutable state to hold in their head. Guard both.

  • Collapse layers that only forward: wrappers with one caller, adapters with no second implementation, pass-through methods. Inline them.
  • Shrink state scope: returns over mutations, locals over fields, fields over module state, module state over globals. Derive instead of sync.
  • Name an invariant once at the boundary, not in every consumer.

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.