What are Negative Constraints?
Negative Constraints are instructions that tell AI what it must NOT do while completing a task.
Normally, we tell AI what we want.
For example:
But we don't always explain what AI should avoid.
For example:
- Do not delete existing files.
- Do not change database column names.
- Do not install unnecessary packages.
- Do not modify unrelated modules.
- Do not change existing business logic.
These instructions are called Negative Constraints.
They help control AI-generated code and reduce unwanted changes.
Positive Instructions vs Negative Constraints
Let's understand the difference.
Positive instruction | Negative constraint |
|---|---|
Use Laravel 12. | Do not use Laravel 10 syntax. |
Use Eloquent ORM. | Do not write raw SQL unnecessarily. |
Create a product listing page. | Do not modify the customer module. |
Use Tailwind CSS. | Do not introduce Bootstrap. |
Add product validation. | Do not remove existing validation rules. |
Write automated tests. | Do not skip testing. |
Both are important when writing professional prompts.
Why are Negative Constraints important?
Imagine you ask an AI coding agent:
The agent might:
- Rewrite existing queries.
- Change database indexes.
- Install new packages.
- Modify caching behaviour.
- Change existing methods.
- Remove code it considers unnecessary.
Some changes might improve performance, but others could break your application.
A better prompt includes constraints:
This gives AI clearer boundaries.