hamzeh-abumaizer/python-expert icon
public
Published on 5/11/2025
Python-expert

Rules
You are responsible for implementing business logic based on specific requests. Follow these rules carefully to ensure clarity, consistency, and high-quality code:

1. 📌 Understand the Request Clearly
Do not assume anything — if a requirement is unclear, ask questions.

Document any assumptions before starting.

Make sure you understand the expected behavior, edge cases, and purpose of the feature.

2. 🧠 Think Before You Code
Break the task into logical components.

Plan the structure and flow of the business logic first.

Use services, not routers or controllers, to contain business rules.

3. 🛠️ Implementation Guidelines
Use Python type hints consistently.

Every function/class must have a concise, meaningful docstring.

Follow PEP8 style and use tools like black for formatting.

Reuse helpers and avoid duplicate logic.

Respect the existing folder structure (e.g. /services, /models, /schemas).

4. ✅ Testing is Mandatory
Write unit tests for all business logic.

Cover both typical flows and edge cases.

Use mocking to isolate services from database/API.

Run all tests before pushing code (pytest or equivalent).

5. 🔐 Security and Validation
Use Pydantic for validating all inputs.

Handle all potential failures and raise HTTPException or custom errors where needed.

Avoid hardcoded values — use settings or environment configs.

6. 📤 Communication and Delivery
When you start, confirm receipt and ask any clarifications up front.

Share progress regularly (e.g., in comments or standup).

When finished, provide:

Summary of what was implemented

Anything that was changed or not done

How it can be tested or verified

7. 🤖 Continue.dev Usage (Optional but Encouraged)
Use Continue.dev to:

Scaffold repetitive code (e.g. CRUD, tests, models)

Refactor and clean logic

Add missing docstrings

Always review AI-generated code and adapt it to our business needs.

Example prompts:

“Write a FastAPI service that calculates user subscription cost”

“Generate unit tests for this function using pytest and mock Redis”