Python application architecture for complex business behavior: functional decisions and effects, ports and adapters, aggregates, transaction ownership, and bounded contexts. Use when choosing application or domain boundaries, modeling evolving invariants, or deciding whether DDD is warranted. Do not apply rich DDD layers automatically to simple CRUD or framework DTOs.
Ships in python. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use the smallest architecture that protects meaningful business invariants. A focused application function and persistence adapter often suffice for CRUD; use aggregates and richer domain modeling when business rules are complex and evolving.
Separate pure business logic from side effects:
See references/functional-core.md for detailed patterns and examples.
Source-code dependencies point inward:
HTTP adapter ─┐
v
Application use case → Domain
^
Database adapter implementing an application/domain port
Adapters depend on the application/domain. Domain objects never import FastAPI/Pydantic request models or ORM records.
Responsibilities:
from dataclasses import dataclass
from decimal import Decimal
from uuid import UUID
@dataclass
class Order:
"""Entity - has identity and encapsulated behavior"""
id: UUID
customer_id: UUID
total: Decimal
status: str = "pending"
def apply_discount(self, rate: Decimal) -> None:
"""Business rule - encapsulated in entity"""
if self.status != "pending" or not Decimal("0") <= rate <= Decimal("1"):
raise ValueError("Invalid discount")
self.total *= Decimal("1") - rate
from dataclasses import dataclass
@dataclass(frozen=True)
class Money:
"""A shallowly immutable value object."""
amount: Decimal
currency: str
def add(self, other: "Money") -> "Money":
if self.currency != other.currency:
raise ValueError("Cannot add different currencies")
return Money(self.amount + other.amount, self.currency)
See references/ddd.md for aggregates, bounded contexts, and domain services.
Abstract storage behind interface:
from typing import Protocol
class OrderRepository(Protocol):
def get(self, order_id: UUID) -> Order | None: ...
def save(self, order: Order) -> None: ...
class PostgresOrderRepository(OrderRepository):
"""Concrete implementation"""
def get(self, order_id: UUID) -> Order | None:
record = self.session.get(OrderRecord, order_id)
return record_to_order(record) if record else None
def save(self, order: Order) -> None:
self.session.add(order_to_record(order))
The use case owns with session.begin():, allowing multiple repository operations and an outbox write to commit atomically.
See references/data-modeling.md for validation patterns, Pydantic features, and transformation examples.
frozen=True is shallow❌ Anemic Domain Model - Only when complex business behavior is spread across unrelated services ❌ Transaction Script - Only when it obscures complex evolving invariants; it is valid for simple CRUD ❌ Leaky Abstraction - Repository exposing database details ❌ God Object - Entity with too many responsibilities ❌ Mixed Concerns - Business logic calling IO directly
For detailed examples, patterns, and decision trees, see the reference materials:
What SKILL.md sets; muted values are Claude Code's defaults
No slash command · from python
npx claudepluginhub martinffx/python-skills --plugin python8 skills in this plugin
/python-build-toolsPython project tooling with uv, mise, Ruff, basedpyright, and pytest. Use for pyproject.toml, dependency groups, lockfiles, uv sync/run/build/publish, reproducible CI, Ruff, basedpyright, or Python tool-version setup. For uv multi-package layouts and Docker, use python-monorepo./python-fastapiFastAPI APIs with Pydantic, OpenAPI, dependencies, security, middleware, lifespan, and response models. Use for routes, validation, authentication or authorization, database-session dependencies, CORS, sync versus async handlers, pagination, errors, or startup and shutdown resources. For ORM mechanics, use python-sqlalchemy./python-modern-pythonModern Python 3.12-3.14 language features and typing. Use for type parameters, type aliases, protocols, dataclasses, structural pattern matching, asyncio concurrency, cancellation, or selecting syntax for the suite's supported Python versions. For Temporal workflow asyncio rules, use python-temporal.