Decomposes complex functions into smaller, testable helper functions based on Peter Norvig’s clean code patterns.
The Function Decomposition skill empowers Claude to identify and refactor bloated, monolithic functions by applying elegant code patterns inspired by Peter Norvig's 'pytudes.' It systematically breaks down complex logic into cohesive, named units that typically span 1-5 lines, significantly reducing nesting levels and cognitive load. By transforming hard-to-read blocks into a series of descriptive helper functions, this skill improves the overall narrative flow of the code while making individual logic components independently testable and easier to maintain.
主な機能
01Extracts cohesive logic 'chunks' into descriptive helper functions
02Identifies functions exceeding optimal length and complexity thresholds
03Enhances unit testability by isolating discrete logic components
04Applies Peter Norvig's signature minimalist and expressive coding style
051 GitHub stars
06Reduces deep nesting to improve code readability and flow
ユースケース
01Refactoring legacy monolithic functions into clean, modular architecture
02Simplifying deeply nested conditional logic for better code maintenance
03Improving the unit testability of complex business logic and algorithms