wshobson avatar

Python Design Patterns

This one cuts through the pattern paralysis that hits when you're staring at a 500-line function or a class that does everything. It focuses on the fundamentals that actually matter: KISS over clever abstractions, single responsibility for each component, and composition instead of inheritance hierarchies. The examples show real refactoring scenarios like breaking apart god classes, separating HTTP concerns from business logic, and deciding when duplication beats premature abstraction. It's particularly solid for code reviews where you need to articulate why something feels wrong structurally, or when you're designing a new service and want to get the layers right from the start.

install copies · 90 days. Times the install command was copied on this site in the last 90 days, bots filtered.
23
skills.sh installs
23.7K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill python-design-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

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

# Simple beats clever
# Instead of a factory/registry pattern:
FORMATTERS = {"json": JsonFormatter, "csv": CsvFormatter}

def get_formatter(name: str) -> Formatter:
    return FORMATTERS[name]()

Sponsors

Details

Repository
github.com/wshobson/agents
Categories
Frontend Development, Testing & QA, Code Review & Quality, Python, Design & UI/UX

More from wshobson/agents

All 174
1hugohe3 avatarppt-masterhugohe3/ppt-masterAI-driven presentation workflow for generating editable PPTX decks and slides, reconstructing page visuals, creating reusable Brand/Style/Layout/Deck workspaces22.3Kskills.sh installs
2vercel-labs avatarnext-upgradevercel-labs/next-skillsAutomated Next.js version upgrades with official codemods and migration guide integration.22.3Kskills.sh installs
3expo avatareas-observeexpo/skillsEAS service (paid). Use for anything related to EAS Observe - adding `expo-observe` to an Expo project (AppMetricsRoot/ObserveRoot HOC, markInteractive, the use22.1Kskills.sh installs
4yuan1z0825 avatarnature-polishingyuan1z0825/nature-skillsPolish, restructure, or translate academic prose into Nature-leaning English using writing-strategy principles, curated Nature/Nature Communications article pat18.6Kskills.sh installs
5warpdotdev avatarreadoutwarpdotdev/common-skillsProduce a polished, self-contained HTML "readout" document under ~/.readouts (with an auto-maintained index page), either by snapshotting the findings accumulat17.7Kskills.sh installs
6langchain-ai avatarlangchain-middlewarelangchain-ai/langchain-skillsINVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output. Covers HumanInTheLoopMiddleware for human approval of dange17Kskills.sh installs