Goal
Design Python APIs with clear endpoint structure, validation, service boundaries, and runtime safety.
When to Use
- A Python API is being planned or refactored.
- Endpoint and handler organization are unclear.
- Request validation and service boundaries need definition.
Instructions
- Define API consumers, endpoint groups, and contracts.
- Separate routing, validation, auth, service logic, and data access.
- Choose framework patterns appropriate to the runtime.
- Note error handling, tests, and deployment implications.
Constraints
- Do not bury business logic in route decorators or handlers.
- Keep request and response validation explicit.
- Avoid framework-specific assumptions unless requested.
Output Format
- endpoint structure
- handler/service layering
- validation/auth notes
- implementation guidance
Examples
- "Design a FastAPI service for document processing."
- "How should this Flask API be organized?"