by luoling8192
Claude Code skill: Software design philosophy guide based on A Philosophy of Software Design by John Ousterhout
# Add to your Claude Code skills
git clone https://github.com/luoling8192/software-design-philosophy-skillSource: John Ousterhout, A Philosophy of Software Design Central thesis: The core challenge of software design is managing complexity.
Complexity is anything related to the structure of a software system that makes it hard to understand and modify. Complexity is not the same as system size — a small system can be complex, and a large well-designed system can be manageable.
Think of a module as a rectangle:
Deep module: simple interface, rich implementation. (Good design) Shallow module: complex interface, does very little. (Bad design 🚩)
Redefine semantics so the error condition cannot arise.
unset(key) succeeds even if the key doesn't exist — it simply guarantees "after the call, the key does not exist."substring(start, end) auto-clips out-of-bounds parameters instead of throwing.Exception Masking: Detect and handle exceptions at a low level so they never reach callers.
Exception Aggregation: Handle multiple exception types in one centralized place instead of scattering handlers at every call site.
data, result, tmp, info) — carry no useful information.Use these signals during code reviews and self-reviews:
| Signal | Meaning | |--------|---------| | Shallow Module | Interface is nearly as complex as its implementation | | Information Leakage | Same design decision reflected in multiple modules | | Temporal Decomposition | Modules split by execution order, not information hiding | | Overexposure | Common API forces callers to know about rarely-used features | | Pass-Through Method | Method just forwards args to another method with similar signature | | Repetition | Non-trivial code duplicated across locations | | Special-General Mixture | General-purpose and special-purpose code not cleanly separated | | Conjoined Methods | Understanding one method requires understanding another | | Comment Repeats Code | Comment is just an English translation of the code | | Impl Contaminates Interface | Interface docs expose implementation details users don't need | | Vague Name | Name too generic to convey useful information | | Hard to Pick Name | Can't find a precise, intuitive name — design may be flawed | | Hard to Describe | Documentation must be long to be complete — module may be too complex | | Non-Obvious Code | Behavior or meaning of code is not easily understood |
Reference this guide in the following scenarios:
A reusable agent skill based on John Ousterhout's A Philosophy of Software Design.
This skill provides design philosophy guidance during:
claude install-skill luoling8192/software-design-philosophy-skill
npx skills add luoling8192/software-design-philosophy-skill
MIT
No comments yet. Be the first to share your thoughts!