Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ahgraber avatar

Python Design Modularity

  • 53 installs
  • 5 repo stars
  • Updated August 1, 2026
  • ahgraber/skills

python-design-modularity is a Claude Code skill that guides Python module boundary design, refactor planning, and architecture review.

About

python-design-modularity is a Claude Code skill for designing module boundaries, planning refactors, and reviewing architecture in Python codebases. A developer uses it when facing tangled dependencies, god classes, deep inheritance, or risky structural changes. It pushes explicit control flow, composition over inheritance, and separating behavior changes from structural refactors so code stays safe to change.

  • Readability-first Python module design with explicit contracts and ownership boundaries
  • Codifies composition-over-inheritance and Functional Core / Imperative Shell separation
  • Rule to never mix behavior changes with structural refactors in one commit

Python Design Modularity by the numbers

  • 53 all-time installs (skills.sh)
  • Ranked #149 of 290 Python skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
At a glance

python-design-modularity capabilities & compatibility

Capabilities
code review · refactoring
Use cases
refactoring · code review
From the docs

What python-design-modularity says it does

Use when designing module boundaries, planning refactors, or reviewing architecture in Python codebases.
SKILL.md
Separate behavior changes from structural refactors — never mix in the same commit.
SKILL.md
Prefer composition by default.
SKILL.md
npx skills add https://github.com/ahgraber/skills --skill python-design-modularity

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs53
repo stars5
Last updatedAugust 1, 2026
Repositoryahgraber/skills

What it does

Restructure Python modules and plan refactors with explicit ownership boundaries and composition-first design.

Who is it for?

Python developers restructuring modules, breaking apart god classes, or planning multi-module refactors.

Skip if: Pure performance optimization, error-handling design, type contracts, or one-off throwaway scripts.

When should I use this skill?

Restructuring modules, breaking apart god classes, choosing composition vs inheritance, or reviewing architectural clarity.

What you get

Code that is easy to reason about, modify, and test under change, with explicit module contracts.

  • refactor plan
  • explicit module public APIs
  • composition-based structure

By the numbers

  • 5 References files (design-rules, readability-and-complexity, module-boundaries, functional-core-shell, refactor-guideli
  • 5 documented common mistakes

Files

SKILL.mdMarkdownGitHub ↗

Python Design and Modularity

Overview

Readability-first design with explicit module contracts. Keep control flow, data movement, and ownership boundaries visible so code stays maintainable and safe to change.

Treat these recommendations as preferred defaults. When a default conflicts with project constraints, suggest a better-fit alternative and call out tradeoffs and compensating controls (tests, observability, migration, rollback).

When to Use

  • Restructuring modules, packages, or ownership boundaries
  • Breaking apart god classes or deeply nested hierarchies
  • Choosing between composition and inheritance
  • Applying Functional Core / Imperative Shell separation
  • Planning a refactor that touches multiple modules
  • Reviewing code for readability or architectural clarity

When NOT to use:

  • Pure performance optimization — see python-concurrency-performance
  • Error handling and resilience patterns — see python-errors-reliability
  • Type contracts and protocol design — see python-types-contracts
  • One-off script or throwaway code with no maintenance horizon

Quick Reference

  • Keep control flow and data movement explicit.
  • Keep module ownership and invariants explicit.
  • Prefer composition by default.
  • Apply Functional Core / Imperative Shell where it improves testability and separation of concerns.
  • Separate behavior changes from structural refactors — never mix in the same commit.

Common Mistakes

  • Refactoring behavior and structure simultaneously — conflates two kinds of risk, makes rollback harder, and obscures review.

Do one, then the other.

  • Reaching for inheritance first — deep hierarchies couple unrelated concerns and make reasoning non-local.

Default to composition; inherit only when the "is-a" relationship is genuinely stable.

  • Hidden module coupling — importing implementation details across boundaries creates invisible contracts.

Expose explicit public APIs and keep internals private.

  • Premature abstraction — extracting a shared interface before the second or third concrete use leads to wrong abstractions that are expensive to undo.

Wait for duplication to reveal the real seam.

  • Ignoring the Functional Core / Imperative Shell split — mixing I/O with business logic makes unit testing painful and increases the blast radius of changes.

Push side effects to the edges.

Scope Note

  • Treat these recommendations as preferred defaults for common cases, not universal rules.
  • If a default conflicts with project constraints or worsens the outcome, suggest a better-fit alternative and explain why it is better for this case.
  • When deviating, call out tradeoffs and compensating controls (tests, observability, migration, rollback).

Invocation Notice

  • Inform the user when this skill is being invoked by name: python-design-modularity.

References

  • references/design-rules.md
  • references/readability-and-complexity.md
  • references/module-boundaries.md
  • references/functional-core-shell.md
  • references/refactor-guidelines.md

Related skills

FAQ

When should I use composition instead of inheritance?

Default to composition; inherit only when the is-a relationship is genuinely stable, since deep hierarchies couple unrelated concerns.

Can I refactor structure and behavior together?

No. Separate behavior changes from structural refactors and never mix them in the same commit, so rollback and review stay clean.

Pythonbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.