Prompting & writing specs

AI output is exactly as good as the constraints you give it.

The idea

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.

Your Prompt / Spec:
"Write a function to extract dates from text."
Spec Coverage:
Generated Result:
def get_dates(text):
    # Very generic... 
    import dateparser
    return dateparser.parse(text)
Vague prompt. The generated code is unusable in a real system.

How it works (The Anatomy of a Spec)

# 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]