Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Frontend Development
wshobson avatar

Python Design Patterns

wshobson/agents

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.

installs
23K
GitHub stars
41.8K
last updated
Aug 21, 2026
View on GitHubSave

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]()

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. If the list has items from different domains (e.g., HTTP parsing AND business rules AND formatting), split it. If all changes stem from the same domain concern, the class may be appropriately sized.

Injecting all dependencies through the constructor is producing constructors with 7+ parameters. This is a sign of too many responsibilities in one class, not a problem with dependency injection. Split the class into smaller units first, then each constructor naturally becomes smaller.

Composition is producing deeply nested wrapper objects that are hard to trace. Keep the composition shallow (2-3 levels). If wrapping is the only mechanism, consider whether a Protocol-based approach or simple function composition would be cleaner than a chain of decorator objects.

The rule of three says not to abstract yet, but the duplication is causing bugs when one copy is updated but not the other. Duplication that diverges in dangerous ways should be abstracted sooner. The rule of three is a heuristic, not a law. If the copies are already diverging incorrectly, extract immediately and add a test that exercises the shared behavior.

A service layer is importing from the API layer, breaking the dependency direction. This is a layering violation. The service layer must not import from handlers. Introduce a shared types/models layer that both can import from, keeping the dependency arrow pointing downward (API → Service → Repository).

Related Skills

  • python-testing-patterns — Test each layer in isolation using the dependency injection structure established here
  • python-project-structure — Organize modules and directory layout so layer boundaries are explicit from the start
SKILL.md on GitHub

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

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

More from wshobson/agents

All 174
  • Architecture Decision Records22.5K
  • Modern Javascript Patterns21.7K
  • Responsive Design21.1K
  • Stride Analysis Patterns20.9K
  • Rust Async Patterns20.8K
  • Javascript Testing Patterns20.6K
  • Sql Optimization Patterns19.9K
  • Threat Mitigation Mapping19.9K
  • Auth Implementation Patterns19.7K
  • Git Advanced Workflows19.5K
  • Dotnet Backend Patterns19.2K
  • Async Python Patterns18.2K
  • Attack Tree Construction17.7K
  • Database Migration17.6K
  • Github Actions Templates17.6K
  • Godot Gdscript Patterns17.6K
  • Data Storytelling17K
  • Backtesting Frameworks16.9K
  • Python Code Style16.6K
  • Openapi Spec Generation16.5K
  • Kpi Dashboard Design16.3K
  • Interaction Design16.3K
  • Design System Patterns16.1K
  • Terraform Module Library15.7K

Recommended

More Frontend Development
1software-mansion avatarargent-lenssoftware-mansion/argentPropose multiple visual design variants for on-screen elements and let the human pick in the Argent Lens window. Use when the user asks for design alternatives 22.8Kinstalls
2vercel-labs avatarnext-upgradevercel-labs/next-skillsAutomated Next.js version upgrades with official codemods and migration guide integration.22.3Kinstalls
3jakubantalik avatartransitions-devjakubantalik/transitions.devProduction-ready CSS transitions for web apps. Use when implementing notification badges, dropdowns, modals, panel reveals, page transitions, card resizes, numb20.8Kinstalls
4cathrynlavery avatardiagram-designcathrynlavery/diagram-designCreate technical and product diagrams — architecture, IT current-state, flowchart, sequence, state machine, ER / data model, timeline, swimlane, quadrant, radar20.3Kinstalls
5lottiefiles avatarmotion-designlottiefiles/motion-design-skillApplies motion design principles to create emotionally-driven, technically sound animations and transitions. Provides timing, easing, choreography, and Disney a20.2Kinstalls
6hugohe3 avatarppt-masterhugohe3/ppt-masterAI-driven presentation workflow for generating editable PPTX decks and slides, reconstructing page visuals, creating reusable Brand/Style/Layout/Deck workspaces20.1Kinstalls