python-development
Python Development
Best practices and patterns for Python development.
When to Use
- Writing Python scripts or applications
- Code review and refactoring
- Setting up new Python projects
Guidelines
Code Style
- Follow PEP 8 style guide
- Use type hints for function signatures
- Write docstrings for public functions and classes
Project Structure
project/
├── src/
│ └── package/
├── tests/
├── pyproject.toml
└── README.md
Common Patterns
Context Managers
from contextlib import contextmanager
@contextmanager
def managed_resource():
resource = acquire()
try:
yield resource
finally:
release(resource)
Data Classes
from dataclasses import dataclass
@dataclass
class Config:
host: str
port: int
debug: bool = False
Resources
More from kinhluan/skills
scheduling-algorithms
Job scheduling algorithms for parallel and distributed systems
5ddd-core
Professional Strategic Domain-Driven Design (DDD) Hub. Use this skill for Event Storming, identifying Subdomains, defining Bounded Contexts, and mapping Domain Models to the heart of your architecture.
4c4-model
Professional C4 model architecture hub for "Design-to-Code Sync". Use this skill to navigate the C4 hierarchy, map diagrams to stakeholders, avoid architectural anti-patterns, and choose the right level for designing or documenting existing codebases.
4ddd-tactical
Tactical Domain-Driven Design (DDD) with Scoring Rubric. Use this skill when designing internal domain models or performing architectural reviews to ensure domain logic is isolated and rich.
4ddd-patterns
Advanced Domain-Driven Design (DDD) Integration Patterns. Use this skill for implementing CQRS, Event Sourcing, the Outbox Pattern, and Anti-Corruption Layers (ACL) in distributed systems.
4c4-level4-code
Specialized in Code diagrams (Level 4) of the C4 model. Use this skill when the user needs to describe the internal implementation of a component using UML class diagrams or database ER diagrams.
4