Prompting AI coding assistants: patterns that actually work
Concrete prompt patterns for getting reliable, reviewable code out of AI assistants — with examples you can copy.
2 min read

The difference between frustrating and productive AI-assisted coding is usually the prompt. Here are patterns that consistently help.
Give context, not just commands
Compare:
- ❌ "Add a login page."
- ✅ "Add an email + password login page at
/loginusing our existing Supabase client inlib/supabase. On success redirect to/dashboard. Show inline errors. Match the styling ofcomponents/SignupForm.tsx."
The second prompt names files, behaviour, edge cases and style references.
Ask for a plan first
For anything bigger than a one-file change:
Before writing code, list the files you'll create or change and
what each change does. Wait for my OK.
This catches misunderstandings while they're still cheap.
Define "done"
Tell the assistant how you'll judge the result:
Done means: `npm run build` passes, the form shows an error for an
invalid email, and duplicate emails show "already subscribed".
Keep changes small
| Prompt size | Typical result |
|---|---|
| "Build the whole app" | Plausible-looking code you can't review |
| "Add the subscribers table and insert action" | A focused diff you can understand |
Make it explain
When something looks off, ask why before asking it to fix it:
Why did you use a client component here? What would change if
this were a server component?
You'll learn faster — and catch subtle bugs.
Checklist
- Name the files and patterns to follow
- Ask for a plan on multi-file changes
- State acceptance criteria
- Review every diff before committing
Found this useful?
Get the next one in your inbox. No spam, unsubscribe anytime.
