| name | python |
| description | Python best practices, type hints, async programming, packaging, virtual environments, and production patterns |
| layer | domain |
| category | backend |
| triggers | ["python","pip","poetry","asyncio","type hints","pydantic","python packaging"] |
| inputs | ["Python application requirements","Type safety requirements","Async architecture needs"] |
| outputs | ["Type-safe Python implementations","Async patterns and architectures","Packaging and deployment configurations"] |
| linksTo | ["fastapi","django","message-queues","microservices","postgresql","mongodb","redis"] |
| linkedFrom | ["error-handling","logging","testing"] |
| preferredNextSkills | ["fastapi","django","postgresql"] |
| fallbackSkills | ["nodejs","golang"] |
| riskLevel | low |
| memoryReadPolicy | selective |
| memoryWritePolicy | none |
| sideEffects | [] |
Python Domain Skill
Purpose
Provide expert guidance on modern Python (3.10+) development patterns including type hints, async/await, structured concurrency, packaging, and production-grade application architecture.
Key Patterns
1. Type Hints and Protocols
Always use type hints. Prefer Protocol over inheritance for duck typing.
from typing import Protocol, runtime_checkable
from collections.abc import Sequence, Mapping, AsyncIterator
@runtime_checkable
class Repository(Protocol):
async def get(self, id: str) -> dict | None: ...
async def save(self, entity: dict) -> str: ...
async def delete(self, id: str) -> bool: ...
from typing import TypeVar, Generic
T = TypeVar("T")
class PaginatedResult(Generic[T]):
def __init__(self, items: list[T], total: int, page: , per_page: ) -> :
.items = items
.total = total
.page = page
.per_page = per_page
.pages = (total + per_page - ) // per_page
() -> :
.page < .pages
() -> :
value:
():
value.upper()
():
(value)
:
typing TypeGuard
() -> TypeGuard[[]]:
((x, ) x val)