# Requirements and Constraints — AI Coding Assistants: Use Them Well and Review Them Hard

Source: https://www.geekswithgeeks.com/en/ai-coding-assistants/prompt-constraints

> State inputs, outputs, edge cases and things the assistant must not do.

## Say what "done" means

List the **inputs and outputs**, the **edge cases** you care about (empty input, large input, invalid data), and the **constraints**: language version, allowed libraries, performance limits, style rules, and files that must not change. If you leave these out, the assistant fills the gaps with its own guesses.

## A specification-style prompt

Writing the edge cases explicitly also gives you the test list for later.

```text
Write a Python function slugify(text) -> str.
- Lowercase; replace runs of non-alphanumerics with a single hyphen.
- Strip leading and trailing hyphens.
- "Hello World" -> "hello-world"; "  Python 3.12!  " -> "python-3-12"
- "" -> "" ; "--a--b--" -> "a-b"
- Standard library only. No external packages.
```

## Say what NOT to do

Negative constraints such as "do not add new dependencies" or "do not modify the public API" prevent the most annoying surprises. Put them in a short list the assistant can check.

**Quiz:** Why list edge cases in the prompt?

- [ ] It slows the editor
- [ ] It makes the answer longer
- [ ] Edge cases do not matter
- [x] So the assistant does not have to guess how to handle them

*Answer:* So the assistant does not have to guess how to handle them. Explicit cases remove ambiguity and double as a checklist for testing.
