Chuyển đến nội dung
Skillpedia
Lập trình chung15k · #10981

principle-minimize-reader-load

Skill này làm gì

Cung cấp cho agent một quy tắc giữ code dễ đọc đối với con người. Dành cho các nhóm có code khó lần theo vì wrapper, tầng gián tiếp hoặc trạng thái dùng chung.

Khi nào nên dùng

  • ✓Khi code khó lần theo từ câu hỏi đến câu trả lời.
  • ✓Khi một wrapper chỉ có một nơi gọi hoặc một adapter không có chỗ dùng thứ hai.
  • ✓Khi trạng thái toàn cục hoặc có thể thay đổi làm hành vi khó đoán.

Liên kết skill

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-minimize-reader-load/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-minimize-reader-load/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Module này có năm tầng wrapper đều làm cùng một việc. Hãy đơn giản hóa để một lập trình viên mới có thể theo dõi được.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đếm số tầng giữa một câu hỏi và câu trả lời, cùng trạng thái ẩn mà người đọc phải theo dõi. Nó gộp các wrapper tốn kém hơn lợi ích, ưu tiên hàm thuần túy, và thu hẹp trạng thái về phạm vi nhỏ nhất hữu ích.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

Câu hỏi thường gặp

Số dòng code có phải là mục tiêu không?

Không. Skill nói nỗ lực của người đọc quan trọng hơn số dòng code hay điểm độ phức tạp.

Khi nào nên gỡ bỏ một tầng?

Khi nó làm tăng nỗ lực đọc mà không mang lại lợi ích thật, chẳng hạn một wrapper chỉ có một nơi gọi.

Còn trạng thái thì sao?

Ưu tiên hàm thuần túy và giá trị cục bộ thay vì các trường, trạng thái module hay biến toàn cục.

Chi tiết

Mô tả gốc của tác giả

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.

repo: cursor/plugins

Độ phổ biến

Sao GitHub
15k
Vị trí xếp hạng
#10981
Giấy phép
—
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự