Python coding guidelines emphasizing unreasonable effectiveness through simplicity, modularity, and quality. Targets 3x capability with 1/3 complexity for bootstrapped startups.
Guidelines for writing Python code that achieves 3x the capability with 1/3 of the complexity. Designed for bootstrapped startups that need unreasonably effective solutions.
Apply the heuristic: **3x the capability from 1/3 of the complexity**. Always favor solutions that are unreasonably effective over complex architectures.
This is optimized for bootstrapped startup environments where speed, maintainability, and resource efficiency are critical.
Write code that embodies Python's philosophy of elegance and readability:
Structure code for maximum reusability and minimal complexity:
Maintain high quality through comprehensive documentation and typing:
**Type Annotations:**
**Documentation:**
**Testing:**
**Exception Handling:**
**Logging:**
```python
from typing import Optional
import logging
logger = logging.getLogger(__name__)
class DataValidationError(ValueError):
"""Raised when data validation fails."""
pass
def process_user_data(user_id: int, data: dict[str, str]) -> Optional[str]:
"""
Process and validate user data for storage.
Args:
user_id: The unique identifier for the user
data: Dictionary containing user data fields
Returns:
Confirmation message if successful, None if validation fails
Raises:
DataValidationError: If required fields are missing or invalid
Example:
>>> process_user_data(123, {"name": "John", "email": "[email protected]"})
'User 123 processed successfully'
"""
try:
# Explicit validation
if not data.get("name") or not data.get("email"):
raise DataValidationError("Name and email are required fields")
# Process data (simplified for example)
logger.info(f"Processing user {user_id}")
return f"User {user_id} processed successfully"
except DataValidationError as e:
logger.error(f"Validation failed for user {user_id}: {e}")
raise
except Exception as e:
logger.exception(f"Unexpected error processing user {user_id}")
raise
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/bootstrapped-startup-python-guidelines/raw