clean-python-boundaries
Installation
SKILL.md
Clean Python Boundaries
Boundary code converts uncertain external behavior into explicit internal contracts. Keep unsafe shapes at the edge and pass typed values inward.
B1: Validate At The Edge
External data is untrusted until validated. Parse and normalize once, then use domain types internally.
# Bad - unchecked dict shape spreads through the system
user = json.loads(response_text)
return User(id=user["id"], email=user["email"])
# Good - boundary handles parsing, validation, and source context
def parse_user_response(response_text: str) -> User:
payload = parse_json_object(response_text, "user response")
return parse_user(payload)