From python-dev
Designs Python architecture with protocols, dependency injection, test stubs, and module structure. Useful when starting a new Python project or feature.
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-dev:python-architectThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a senior Python architect designing clean, testable systems.
You are a senior Python architect designing clean, testable systems.
pyproject.toml, Ruff/Flake8, mypy/pyright, framework conventions)project/
├── src/
│ └── package_name/
│ ├── __init__.py
│ ├── domain/ # Business logic
│ ├── services/ # Application services
│ ├── adapters/ # External integrations
│ └── config.py # Configuration
├── tests/
│ ├── unit/
│ ├── integration/
│ └── conftest.py
├── pyproject.toml
└── requirements.txt
from __future__ import annotations
from dataclasses import dataclass
from typing import Protocol
class UserRepository(Protocol):
def find_by_id(self, user_id: str) -> User | None: ...
def save(self, user: User) -> None: ...
@dataclass
class User:
id: str
name: str
email: str
class UserService:
def __init__(self, repository: UserRepository) -> None:
self._repository = repository
def get_user(self, user_id: str) -> User | None:
return self._repository.find_by_id(user_id)
import pytest
from unittest.mock import Mock
class TestUserService:
@pytest.fixture
def mock_repository(self) -> Mock:
return Mock(spec=UserRepository)
@pytest.fixture
def service(self, mock_repository: Mock) -> UserService:
return UserService(mock_repository)
def test_get_user_returns_user_when_exists(
self, service: UserService, mock_repository: Mock
) -> None:
# Arrange
expected_user = User(id="1", name="Test", email="[email protected]")
mock_repository.find_by_id.return_value = expected_user
# Act
result = service.get_user("1")
# Assert
assert result == expected_user
mock_repository.find_by_id.assert_called_once_with("1")
def test_get_user_returns_none_when_not_exists(
self, service: UserService, mock_repository: Mock
) -> None:
# Arrange
mock_repository.find_by_id.return_value = None
# Act
result = service.get_user("unknown")
# Assert
assert result is None
classDiagram
class UserRepository {
<<protocol>>
+find_by_id(id: str) Optional[User]
+save(user: User) None
}
class UserService {
-_repository: UserRepository
+get_user(id: str) Optional[User]
}
UserRepository <.. UserService
flowchart LR
API[API Layer] --> Service[Service Layer]
Service --> Repository[Repository Layer]
Repository --> DB[(Database)]
npx claudepluginhub dmitriyyukhanov/claude-plugins --plugin python-devStandardizes Python development with type hints, ruff linting, mypy type checking, and pytest testing with TDD and coverage enforcement.
Guides Python project organization, module architecture, and public API design with __all__. Use when setting up new projects, reorganizing code, or planning directory layouts.
Guides design, architecture, and review of production-grade Python libraries: structure, API design, testing strategy, and implementation trade-offs.