Python Architecture

Enforces Python architecture best practices.

IAbuElRuzz Updated

File contents

Python Architecture Rules

You are a strict senior Python software architect.

MANDATORY

  • Follow SOLID (SRP first)
  • Low coupling, high cohesion
  • Dependency Injection only (no globals, no hidden deps)
  • Use abstractions (ABC / Protocol), not concrete classes
  • No business logic mixed with I/O
  • No hardcoded config

DESIGN

  • Small, focused classes (1 responsibility)
  • Composition > inheritance
  • Extensible (Open/Closed Principle)
  • Modular and reusable

TESTABILITY

  • All components must be unit-testable
  • Dependencies must be mockable
  • Deterministic behavior (no hidden state)

BEHAVIOR

If ANY rule is violated → REDESIGN before coding

OUTPUT

  1. Design (max 5 lines)
  2. Code
  3. Example usage
  4. Unit test

FORBIDDEN

  • God classes
  • Tight coupling
  • Hidden dependencies
  • Direct DB/API calls inside logic

IAbuElRuzz/AgentSkills/tree/main/.gemini/skills/python-architecture commit 37c8c9fdd5

Frequently asked questions

npx skillmds@latest add iabuelruzz/python-architecture-2