How to Code With AI · Part 3 · Prompt Patterns · Lesson 3.1
Constraints first. Instructions second. Always.
An LLM follows constraints far more reliably than it follows instructions. Lead with what it must NOT do.
The lesson
LLMs are trained on instruction-following data, but they're far better at constraint satisfaction than at goal pursuit. If you tell an LLM "build me a login form," it will improvise a hundred decisions you didn't ask for. If you tell it "build a login form. No external libraries. No CSS framework. Email + password. Submit disabled until both fields valid. Inline error per field." — you get the form you wanted on the first try.
The pattern is: constraints first, instructions second. Negate the defaults you don't want before describing what you DO want. The output quality difference is roughly 10x on first draft.
This is the most reliable single change you can make to your prompting today. Memorize the pattern.
Example
✓ Constraint-first refactor
"Refactor this function. Constraints: - Same public signature - No new imports - All existing tests must still pass - Do not add comments Goal: reduce cyclomatic complexity below 5."
✗ No constraints
"clean this up" No constraints = the LLM rewrites the world, adds 4 imports, changes the signature, deletes your tests. Standard.
Try it · Vibe Trial
Refactor with a constraint stack
~90 seconds. Drops you into the workbench. Coach the engine — no code required.
Try this trialWatch it · Codigami
Codigami: @vex.io's constraint-first session