Use when code is hard to understand, a module has too many parameters or deep nesting, functions exceed 40 lines, abstractions feel leaky, or you need to evaluate deep-module vs shallow-module design per Ousterhout principles
Analyzes code complexity and provides targeted refactoring strategies based on Ousterhout's deep module principles.
/plugin marketplace add jeffweiss/elixir-production/plugin install elixir-production@jeffweissThis skill inherits all available tools. When active, it can use any tool Claude has access to.
escalation-ladder.mdousterhout-principles.mdreferences/metrics.mdreferences/onboarding.mdreferences/patterns.mdComplexity comes from dependencies and obscurity. Reduce it by making modules deeper — simple interfaces hiding significant implementation. Measure depth as implementation power divided by interface complexity.
| Level | Smell | Fix |
|---|---|---|
| L0 | Generic names | Rename to describe domain concepts |
| L1 | >4 params, >3 nesting levels, >40 line functions | Group into structs, extract named functions |
| L2 | Callers duplicate checks, must call in order | Pull complexity downward, deepen the interface |
| L3 | Branching grows with each new type | Protocols to eliminate special cases |
| L4 | Can't find things, features touch 8 files | Organize by domain (Phoenix contexts) |
| L5 | Accumulated tactical debt | Strategic refactoring — one protocol/module per PR |
Code is confusing. Why?
Names are unclear → Level 0 (rename)
Too much to track at once → Level 1 (reduce working memory)
Module is hard to use → Level 2 (deepen the interface)
Branching keeps growing → Level 3 (eliminate special cases)
Can't find things → Level 4 (architectural clarity)
Accumulated debt → Level 5 (strategic refactoring)
DeepCache.put(key, val) beats ShallowCache.put(key, val, ttl, serializer, compression)with internallyprocess, handle, data — forces reading implementation to understand intentRead the file that matches your current problem:
escalation-ladder.md — When: Need thresholds and code examples for each complexity level. Full Complexity Reduction Ladder (L0-L5 with code examples, thresholds)ousterhout-principles.md — When: Evaluating module depth or interface design. Deep modules, information hiding, strategic programming, SRK interface designreferences/metrics.md — When: Measuring cognitive complexity numerically. Cognitive complexity metricsreferences/patterns.md — When: Looking for specific refactoring techniques. Refactoring patterns catalogreferences/onboarding.md — When: Assessing how hard code is for new developers. Onboarding difficulty assessment/cognitive-audit — Full complexity analysis with onboarding difficulty assessment/review [file] — Review code including complexity evaluationActivates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.