python-developer
Installation
SKILL.md
Python Developer
This skill serves as the foundational source of truth for high-integrity Python development across all domains. It enforces strict safety rules, deterministic coding standards, test-driven development, and rigorous testing practices.
1. Control & Safety (The Power of 10)
All Python code must strictly follow the Power of 10 safety rules to ensure reliability, predictability, and memory safety:
- No Recursion: All tree or graph traversals must use iterative stacks.
- Hard Loop Bounds: Every
whileloop must be guarded byMAX_ITERATIONSorTIMEOUT_SECONDS. - Memory Discipline: Use
__slots__for high-throughput classes to ensure deterministic memory usage. - Validation at Boundary: Use
TypeGuardat presentation/entry boundaries. Internal layers assume validated data. - Pure Functions: Business logic must be I/O-free and deterministic. Push side effects to infrastructure edges.
- Dependency Injection: Collaborators and external clients must be passed in via constructors, never instantiated internally.
- No Magic: Forbidden:
eval(),exec(),getattr()for sensitive logic, and dynamic runtime imports. - Immutable Invariants: State transitions must be provably immutable against malformed input.
- Fail-Closed: Logic must default to "Access Denied" or "Operation Aborted" upon any ambiguity or exception.
- Protocol Interfaces: Decouple components using
typing.Protocolrather than tight inheritance.