AI output is exactly as good as the constraints you give it.
When delegating work to an AI (or a human), a vague prompt ("Make a login page") produces generic, unusable output. You must act as a Senior Engineer writing a precise Technical Spec.
A good spec defines explicit Constraints (technologies, limits), provides Context (existing architecture), defines Acceptance Criteria, and critically, provides Examples of the desired output format.
def get_dates(text):
# Very generic...
import dateparser
return dateparser.parse(text)
# VAGUE (Do not do this)
"Refactor the billing module."
# PRECISE SPECIFICATION
Goal: Extract the Stripe webhook processing into a separate class.
Context: We are moving to an event-driven architecture.
Constraints:
- Do NOT modify the database schema.
- Use Python 3.10 dataclasses.
- Must not make external network requests.
Acceptance Criteria:
- Existing tests must pass.
- Method signature must exactly match: 'def handle(payload: dict) -> bool:'
Example:
[Provide a snippet of what the resulting class should look like]