Python architecture: PEP-8, type hints, clean layering, dependency injection, and testing strategy
53
58%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No known issues
Fix and improve this skill with Tessl
tessl review fix ./skills/architecture-python/SKILL.mdIn addition to general architecture principles, apply these Python-specific patterns:
ruff for linting and formatting.mypy --strict in CI.dataclasses or pydantic for structured data over plain dicts.src/
myapp/
domain/ # pure business logic, no I/O
models.py
services.py
application/ # use cases, orchestrates domain
use_cases.py
infrastructure/ # DB, HTTP, filesystem
repositories.py
http_client.py
presentation/ # FastAPI routes, CLI, etc.
routes.py
tests/
unit/
integration/class UserRepository(Protocol):
def find_by_id(self, user_id: UUID) -> User | None: ...
def save(self, user: User) -> None: ...@classmethod factory methods for complex initialization.@dataclass(frozen=True) for immutable domain objects.domain/exceptions.py.except: — always specify the exception type.asyncio + async/await for I/O-bound work (HTTP, DB with asyncpg/SQLAlchemy async).asyncio.run_in_executor for blocking calls.asyncio.gather for concurrent independent I/O operations.c0b2e4b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.