howtocodeai.com
Tutorials / Beginner

The 9 Prompt Patterns That Do 90% of the Work

Stop prompting by vibes. These nine reusable patterns — constraints, evidence, full-file, spec extraction, and more — are the difference between fighting the AI and directing it.

DifficultyBeginner
Time20 min read
You'll needAny AI coding tool
You'll buildA prompting playbook you'll reuse on every project. Bookmark this one.

After enough projects, you notice the same handful of prompt structures producing all the good results. Here they are as reusable patterns — each with the template and the reason it works. None of this is magic words; all of it is giving the model the constraints and context it can't guess.

1. The constraint stack

Build [thing]. Constraints: single HTML file, no external libraries except [X] from a CDN, works on mobile, no placeholder comments like 'add logic here' — fully working code only. Output only the code.

Unconstrained requests get the model's average answer; constraints get yours. The most valuable constraints are architectural (single file, no frameworks) because they keep the output deployable by you.

2. Evidence beats description

Here is the actual JSON this API returns: [paste 40 lines]. Here is my current file: [paste]. Now add a chart showing [field] over time.

Pasting real data, real errors, and real current code outperforms describing them, every time. The model guesses wrong about structure; it doesn't guess wrong about what it can see.

3. Full file in, full file out

Here is my complete current file: [paste]. Change only [the header layout]. Return the complete updated file — do not omit unchanged sections or use '...rest unchanged'.

Snippet-splicing is the top source of beginner-introduced bugs. The explicit 'do not omit' clause stops the model from abbreviating long files.

4. Plan first, code second

Don't write code yet. Propose the structure: what files, what each does, what could go wrong, what you'd build first. Wait for my approval.

For anything bigger than one file, a two-minute plan review catches the wrong architecture before it's 600 lines deep. This is also exactly how agentic tools like Claude Code work best.

5. The diagnosis gate

Before fixing: explain what this error means, which code is responsible, and your theory of the cause. Then propose the fix and wait.

Stops the flailing-fix loop. If the diagnosis sounds wrong, you just saved a bad rewrite.

6. The spec extraction (project portability)

Summarize everything this app currently does as a detailed build specification: features, data structures, design decisions, known issues. Write it so a fresh AI session could rebuild it from the spec alone.

Your escape hatch from poisoned conversations, your migration path between tools, and your project documentation — one pattern, three uses. Run it at the end of any session you might continue later.

7. The persona with teeth

Act as a senior developer reviewing this code before it goes live: list real problems ranked by severity — security first, then bugs, then performance. No compliments, no nitpicks about style.

Generic 'act as an expert' does little; a persona plus a ranked deliverable and explicit exclusions does a lot. Run this once before anything goes public.

8. The example anchor

Generate 10 more entries matching this exact format and tone. Here are 3 examples of exactly what I want: [paste]. Match field names, length, and style precisely.

For content and data generation, three good examples outperform three paragraphs of description. This is the engine of every programmatic site.

9. The negative space prompt

Before I ship this: what am I not asking about that I should be? What do people building [a public form / a site with user data / a paid product] usually forget?

The model knows the standard checklist for almost any project type — backups, rate limits, input validation, legal pages — but only volunteers it when asked. This one prompt has saved more vibe-coded projects than any other on this list.

Using them together

A real project flows: plan first (4) → constraint stack (1) → evidence + full-file loop (2, 3) for iteration → diagnosis gate (5) when stuck → review persona and negative space (7, 9) before launch → spec extraction (6) when you stop for the day. That sequence is, honestly, the whole craft.

Keep going

Need somewhere to put it live? See where to host AI-built sites. Compare tool costs on the pricing tracker (or stick to the free options), then pick your next build.