Agent skill · software engineering · wshobson
python-design-patterns
Python design patterns including KISS, Separation of Concerns, Single Responsibility, and composition over inheritance. Use this skill when designing a new service or component from scratch and choosing how to layer responsibilities, when refactoring a God class or monolithic function that has grown too large, when deciding whether to add a new abstraction or live with duplication, when evaluating a pull request for structural issues like tight coupling or leaking internal types, when choosing between inheritance and composition for a new class hierarchy, or when a codebase is becoming hard to test because of entangled I/O and business logic.
Why this skill is useful
Provides specific design patterns and principles for structuring Python code that the AI wouldn't reliably generate on its own.
What it needs
About 3k tokens when loaded. Last updated 2026-08-05. 38,570 stars on the source repository.
What this skill does
Python Design Patterns Write maintainable Python code using fundamental design principles. These patterns help you build systems that are easy to understand, test, and modify. When to Use This Skill Designing new components or services Refactoring complex or tangled code Deciding whether to create an abstraction Choosing between inheritance and composition Evaluating code complexity and coupling Planning modular architectures Core Concepts 1. KISS (Keep It Simple) Choose the simplest solution that works. Complexity must be justified by concrete requirements. 2. Single Responsibility (SRP) Each unit should have one reason to change. Separate concerns into focused components. 3. Composition Over Inheritance Build behavior by combining objects, not extending classes. 4. Rule of Three Wait until you have three instances before abstracting. Duplication is often better than premature abstraction. Quick Start Detailed patterns and worked examples Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient. Best Practices Summary 1. Keep it simple - Choose the simplest solution that works 2. Single responsibility - Each unit has one reason to change 3. Separate concerns - Distinct layers with clear purposes 4. Compose, don't inherit - Combine objects for flexibility 5. Rule of three - Wait before abstracting 6. Keep functions small - 20-50 lines (varies by complexity), one purpose 7. Inject dependencies - Constructor injection for testability 8. Delete before abstracting - Remove dead code, then consider patterns 9. Test each layer - Isolated tests for each concern 10. Explicit over clever - Readable code beats elegant code Troubleshooting A class is growing and seems to have multiple responsibilities, but splitting it feels wrong. Apply the "reason to change" test: list every change that could require editing this class. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills wshobson/python-design-patterns