python-patterns
From affaan-m
Patrones idiomáticos de Python, estándares PEP 8, type hints y buenas prácticas para construir aplicaciones Python robustas, eficientes y mantenibles.
Documents Python idioms, PEP 8 style, type hints, error handling and context manager patterns for reference.
Use it when
- Writing new Python code needing PEP 8/type hint conventions
- Reviewing Python code for idiomatic patterns
- Refactoring existing Python modules
- Designing Python package/module structure
Skip it if
- You already follow PEP 8 and type hints fluently
- It's a static reference doc, not a tool or automated check
- Only Python-specific, no value for other languages
Facts
- Repository
- affaan-m/ECC
- Status
- Actively maintained
- Last commit
- Source file
- .kiro/skills/python-patterns/SKILL.md
Source preview
The instructions Claude Code reads when this skill runs.
# Patrones de Desarrollo Python
Patrones idiomáticos de Python y buenas prácticas para construir aplicaciones robustas, eficientes y mantenibles.
## Cuándo Activar
- Escribir código Python nuevo
- Revisar código Python
- Refactorizar código Python existente
- Diseñar paquetes/módulos Python
## Principios Fundamentales
### 1. La Legibilidad Cuenta
Python prioriza la legibilidad. El código debe ser obvio y fácil de entender.
```python
# Bien: Claro y legible
def get_active_users(users: list[User]) -> list[User]:
"""Retorna solo los usuarios activos de la lista proporcionada."""
return [user for user in users if user.is_active]
# Mal: Inteligente pero confuso
def get_active_users(u):
return [x for x in u if x.a]
```
### 2. Explícito es Mejor que Implícito
Evitar la magia; ser claro sobre lo que hace el código.
```python
# Bien: Configuración explícita
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
# Mal: Efectos secundarios ocultos
import some_module
some_module.setup() # ¿Qué hace esto?
```
### 3. EAFP - Es Más Fácil Pedir Perdón que Permiso
Python prefiere el manejo de excepciones sobre verificar condiciones.
```python
# Bien: Estilo EAFP
def get_value(dictionary: dict, key: str) -> Any:
try:
return dictionary[key]
except KeyError:
return defaultView full source on GitHub →Other skills
django-tdd
★ 229,918Django testing strategies with pytest-django, TDD methodology, factory_boy, mocking, coverage, and testing Django REST Framework APIs.
affaan-mupdated 15d agoMITclickhouse-io
★ 229,918ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
affaan-mupdated 15d agoMITlaravel-patterns
★ 229,918Patrones de arquitectura Laravel, routing/controladores, Eloquent ORM, capas de servicio, colas, eventos, caché y API resources para aplicaciones en producción.
affaan-mupdated 15d agoMITverification-loop
★ 229,918Sistema de verificación completo para sesiones de Claude Code.
affaan-mupdated 15d agoMITstrategic-compact
★ 229,918Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.
affaan-mupdated 15d agoMITfrontend-patterns
★ 229,918Patrones de desarrollo frontend para React, Next.js, gestión de estado, optimización de rendimiento y buenas prácticas de UI.
affaan-mupdated 15d agoMIT