code-complexity

Featured

Keep each unit comprehensible while the code grows: deep modules over shallow ones, information hiding, honest names, small functions with one job, error handling that does not lose the error, DRY and orthogonality, design by contract, and not leaving broken windows. Merges module-complexity management with naming/function/error-handling discipline and the pragmatic meta-rules. Use when writing or reviewing a function, class or module; when an interface feels wide, a class feels shallow, or a change in one place forces edits in three; when the user says "this is hard to follow", "clean this up", "review this code", "is this a good abstraction", "too many parameters", "pass-through method", "duplicated logic", or asks about naming, comments, error handling or unit tests. Do NOT use to decide where a new module LIVES or which modules exist (use architecture-first), to plan capacity or storage (use system-and-data-design), to execute a named transformation on a file that is already too large (use refactoring-saf

AI & Automation 150 stars 24 forks Updated 3 days ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Code complexity — keeping a unit comprehensible Complexity is not how clever the code is. It is how much you must hold in your head to change one line safely. It accumulates by increments that each look acceptable, which is why it is never one bad commit's fault and always everyone's problem. ## The two symptoms worth memorising **Change amplification** — one decision, many edits. If changing a timeout means editing five files, that decision was not encapsulated anywhere. **Cognitive load** — how much you must know to be safe. A function that is correct only if you know that the caller already took a lock has exported its complexity to everyone who reads it. Both are properties of the *interface*, not the implementation. Which gives the rule: ## Deep over shallow A module's value is `functionality it provides ÷ interface you must learn`. Deep = small interface, substantial behaviour behind it. Shallow = large interface, little behind it. - A pass-through method that only calls one other method with the same arguments is negative value: it adds an interface without adding behaviour. - "One class per concept, many tiny classes" is not automatically good. Many shallow classes cost more total interface than a few deep ones. - The right question is never "is this class small?" but "how much do I need to know to use it?" ## Information hiding — and its inverse Every design decision that might change should be known to exactly one module. The inverse — **informatio...

Details

Author
AnastasiyaW
Repository
AnastasiyaW/codex-claude-code-config
Created
5 months ago
Last Updated
3 days ago
Language
Python
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category

Code & Development Featured

software-design-philosophy

Manage software complexity through deep modules, information hiding, and strategic programming. Use when the user mentions "module design", "API too complex", "shallow class", "complexity budget", "strategic vs tactical", "deep module", "information leakage", "pass-through method", "this code is over-engineered", or "simplify this design". Also trigger when reviewing an interface for simplicity, evaluating whether an abstraction is pulling its weight, deciding whether a comment is worth writing, or choosing between general-purpose and special-purpose approaches. Covers deep vs shallow modules, red flags for complexity, and comments as design documentation. For code quality, see clean-code. For architecture boundaries, see clean-architecture.

2,147 Updated today
wondelai
Code & Development Listed

designing-deep-modules

Guides designing, reviewing, and refactoring modules for depth — maximizing functionality hidden behind minimal interfaces. Analyzes module boundaries, identifies shallow modules and classitis, applies deep module heuristics (pull complexity downward, define errors out of existence, design for the common case), and produces refactoring plans. Covers information hiding, leaky abstractions, and abstraction boundaries based on Ousterhout's A Philosophy of Software Design. Use when designing module interfaces, reviewing code for shallow abstractions, refactoring pass-through layers, evaluating API surface area, reducing interface complexity, or applying deep module principles at any scale (functions, classes, packages, services, APIs).

0 Updated 4 weeks ago
msewell
Code & Development Solid

software-design-philosophy

Manage software complexity through deep modules, information hiding, and strategic programming. Use when the user mentions "module design", "API too complex", "shallow class", "complexity budget", "strategic vs tactical", "deep module", "information leakage", or "pass-through method". Also trigger when reviewing interface designs for simplicity, evaluating whether an abstraction is pulling its weight, or choosing between general-purpose and special-purpose approaches. Covers deep vs shallow modules, red flags for complexity, and comments as design documentation. For code quality, see clean-code. For boundaries, see clean-architecture.

26 Updated 4 days ago
xiaohei-info