Table of contents
How to Think in Prompts
Most writers open a blank document and start typing. Most AI-assisted writers paste a vague request and hope something usable comes back. Both habits share the same flaw: they skip the most valuable step.
The real work happens before you write a single sentence — in the prompt. A well-constructed prompt is not a search query. It is a structured brief that tells the AI who it is, what it must produce, for whom, in what shape, and where the boundaries are. Everything after that is execution.
This article walks through a four-phase system for building those briefs — one that you can apply to any technical article topic and repeat reliably.
Why Your Prompt Is the Article Plan
A poor prompt does not just produce a poor first draft — it produces a draft that is structurally wrong, which costs far more to fix than to prevent.
Three failure modes appear repeatedly when prompts are vague:
- Scope drift — without explicit constraints, the AI fills space with tangents that feel related but add no value for the reader.
- Depth mismatch — without a defined audience, the output lands too shallow for experts or too dense for beginners.
- Format chaos — without a specified structure, sections appear in an order that made sense to the model but not to someone reading top to bottom.
Five minutes spent on a precise prompt eliminates all three. The prompt is the plan. Writing it forces you to answer the questions an editor would ask before assigning the piece.
Concepts
Prompt — the full instruction sent to an AI model. Not a question, but a structured brief containing role, task, context, format, and limits.
Persona — the expert identity you assign to the AI before it starts. It shapes vocabulary, assumed knowledge, and decision-making throughout the output.
Task — the single core action the AI must perform. Always anchored to a concrete verb: outline, draft, rewrite, expand, summarise.
Context — the who, why, and what: target audience, the reader's goal after finishing the article, and any background the AI needs to stay relevant.
Exemplar — a short sample of writing pasted directly into the prompt to demonstrate the desired tone or structure. Far more effective than describing style in the abstract.
Constraints — explicit statements of what the AI must not do: topics to exclude, phrases to avoid, length caps, library restrictions.
Iteration — treating the prompt as the first message in a conversation rather than a one-time command. Each round of feedback narrows the output toward what you actually need.
Chain of thought — asking the AI to reason through a problem step-by-step before producing any prose. Reduces structural errors in complex, multi-section outputs.
The Four-Phase Framework
The framework mirrors the way a professional editor would brief a writer: establish who is writing and what they are writing, supply the raw material they need, define the shape of the deliverable, then review and sharpen the result.
flowchart TD
A([Article Idea]) --> B
subgraph Phase1["⚙️ Phase 1 — Setup"]
B[Assign Persona] --> C[Define Task]
end
subgraph Phase2["📂 Phase 2 — Inputs"]
D[Provide Context] --> E[Supply Exemplar]
end
subgraph Phase3["🎨 Phase 3 — Parameters"]
F[Set Format & Style] --> G[Add Constraints]
end
subgraph Phase4["🔄 Phase 4 — Refinement"]
H[Evaluate Output] --> I{Meets the bar?}
I -- No --> J[Targeted Iteration]
J --> H
I -- Yes --> K([Publication-Ready Draft])
end
C --> D
E --> F
G --> H
Phase 1: The Setup
The setup phase answers two questions before a single word of article prose is generated: Who is doing the writing? and What exactly must be produced?
Assign a Persona
Start every prompt with a role. A persona is not decoration — it tells the AI which domain vocabulary to use, how deep to go, and what assumptions it can safely make about the reader.
Unfocused: "You are a helpful assistant."
Precise: "You are a senior platform engineer who writes internal developer documentation. You default to concrete examples over theory, never use marketing language, and assume readers are comfortable with terminal commands."
The precise version changes every decision the AI makes — what to include, what to skip, how long to make code examples, and whether to explain a concept or link out.
Define the Task
Pair the persona with a single action verb that leaves no room for interpretation. Vague verbs produce vague output.
| Vague | Precise Alternative |
|---|---|
| write about | draft a step-by-step guide to |
| help me with | outline the main sections of |
| do something on | write a 1,000-word introduction to |
| talk about | explain with a before-and-after code example |
Task definition example:
Draft a structured outline for a technical article on
connection pooling in PostgreSQL, targeting developers who
run Node.js applications and have never tuned their database
configuration before.
Phase 2: The Inputs
Inputs are the raw material the AI builds from. The more specific the inputs, the less the AI has to guess — and guessing is where quality breaks down.
Provide Context
Context is the backstory that lets the AI calibrate depth and tone. Three dimensions matter most:
- Audience — not a job title but a knowledge profile. "Backend developers comfortable with async/await but unfamiliar with event loop internals" is far more actionable than "developers."
- Reader goal — what should someone be able to do immediately after finishing the article? "Readers can write and register a custom ESLint rule from scratch" defines done.
- Background — any constraints the article must respect. "This is part 3 of a series. Readers have already seen basic TypeScript generics."
Full context block:
CONTEXT
- Audience: full-stack developers with 2–4 years of experience,
proficient in JavaScript, just starting with TypeScript.
- Goal: by the end, readers can write a strongly typed custom
React hook without using `any`.
- Background: readers completed the previous article on
basic TS interfaces. Skip the basics.
Supply an Exemplar
Style descriptions are abstract. An actual paragraph is concrete. When tone matters, paste a short excerpt from an article you admire directly into the prompt.
Write the introduction in the same voice as this paragraph:
---
Every database query is a negotiation. You ask for data;
the engine decides how much work to do to get it.
Most of the time it is reasonable. Occasionally it scans
every row in a table to find three. That is when indexes
become less optional.
---
The AI will pick up rhythm, sentence length, and directness from the example without you having to write a style guide.
Phase 3: The Parameters
Parameters define the shape of the output. Without them, you receive something that is technically correct but requires heavy restructuring before it is usable.
Set Format and Style
Be explicit about every structural rule you care about. If a rule is not stated, the AI will make its own choice.
FORMAT
- H1 for the article title.
- H2 for each major section.
- H3 for sub-points within a section.
- Every H2 section must end with a TypeScript code example
of 10–30 lines.
- Use a numbered list for any multi-step process.
- End with a "Key Takeaways" bullet list of 4–6 items.
Add Constraints
Constraints are the guardrails. They are just as load-bearing as the positive instructions — often more so, because they prevent the most common failure modes.
CONSTRAINTS
- Use only Node.js built-ins. No third-party libraries.
- Keep the introduction under 90 words.
- Do not include a "History of X" section.
- Avoid passive voice throughout.
- Do not use the phrases "In conclusion" or "It is worth noting."
- Target article length: 1,000–1,300 words.
Phase 4: The Refinement Loop
The first output is always a draft. Refinement is where the quality is actually built — but only if the follow-up prompts are as precise as the original.
flowchart LR
A[First Output] --> B{Evaluate}
B -- Hallucination --> C[Add source constraint]
B -- Tone off --> D[Paste a better exemplar]
B -- Structure wrong --> E[Restate format rules explicitly]
B -- Section too shallow --> F[Request targeted expansion]
C & D & E & F --> G[Refined Prompt]
G --> H[Improved Output]
H --> B
Evaluate before iterating. Run four checks on every output before writing a follow-up:
- Can every specific claim be verified? Flag anything that sounds precise but could be invented.
- Does the tone match the audience profile you defined? Read the opening paragraph aloud.
- Does the structure match the format you specified? Count headings and compare to the FORMAT block.
- Is there a section the reader needs that is missing entirely?
Iterate surgically. Vague follow-up prompts produce vague improvements. Target one section at a time.
Weak: "Can you improve the examples?"
Precise:
The middleware section is too abstract. Rewrite it with
a concrete example: a Koa.js request logger that measures
response time and writes structured JSON to stdout. Include
the full middleware function, how to register it, and a
sample log output. Keep the prose above the code under 50 words.
For complex articles with multiple interdependent sections, use chain of thought before requesting prose:
Before drafting any content, list the six things a
mid-level developer must understand about JWT refresh
token rotation to implement it securely. Then use that
list to build the article outline.
This forces the AI to reason through the structure explicitly, which catches gaps before they become entire missing sections.
A Complete Prompt, Start to Finish
Here is a production-ready prompt built with the full four-phase framework. The topic is implementing a job queue with BullMQ in a Node.js application.
PERSONA
You are a senior Node.js engineer with hands-on experience
building distributed systems. You write technical tutorials
that are direct, example-driven, and free of filler sentences.
You never explain things you can show with code.
TASK
Draft a complete technical article explaining how to add a
background job queue to a Node.js application using BullMQ.
CONTEXT
- Audience: backend developers who know Express and async/await
but have never worked with job queues or Redis.
- Goal: readers can create a queue, add jobs, and process them
with a worker in their own project within 45 minutes.
- Background: no prior knowledge of Redis is assumed.
Explain connection setup from scratch.
EXEMPLAR
Use this tone as a reference for the introduction:
"Background jobs exist because users should not wait.
When a user signs up, send the welcome email later —
not while they are staring at a loading spinner.
A queue is just a list with a worker at the other end."
FORMAT
- H1 for the article title.
- H2 for: Introduction, How BullMQ Works, Project Setup,
Creating the Queue, Adding Jobs, Processing Jobs,
Handling Failures, and Key Takeaways.
- Every H2 section must include at least one code block.
- Key Takeaways: bullet list of exactly 5 items.
CONSTRAINTS
- BullMQ version 5 only. Do not reference older APIs.
- Do not cover job prioritisation or rate limiting.
- Keep total article length between 1,100 and 1,400 words.
- Do not use the phrase "easy to use."
- Avoid any sentence starting with "In this article."
This prompt gives the AI a voice, a concrete goal, an audience profile with a knowledge boundary, a tone reference, a precise structure, and five guardrails. The first output will be close; one or two targeted refinement passes will make it publishable.
flowchart TD
A([Start]) --> B[🎭 PERSONA\nAssign a precise expert role]
B --> C[⚡ TASK\nState the core action verb]
C --> D[🌍 CONTEXT\nAudience · Goal · Background]
D --> E[📄 EXEMPLAR\nPaste a tone reference]
E --> F[🎨 FORMAT\nHeadings · Code blocks · Length]
F --> G[🚧 CONSTRAINTS\nWhat the AI must not do]
G --> H([Prompt Ready — Submit])
The Prompt Checklist
Before sending any article-writing prompt, verify that all six elements are present:
- Persona — a precise expert role, not a generic assistant.
- Task — a concrete action verb followed by a specific deliverable.
- Context — audience knowledge profile, reader goal, and relevant background.
- Exemplar — at least one short sample that demonstrates the target tone.
- Format — heading levels, code block rules, list conventions, and target length.
- Constraints — at least two explicit restrictions on what the AI must not do.
| Phase | Step | What to Do | Example |
|---|---|---|---|
| Setup | Persona | Assign a specific expert role to the AI | "You are a senior DevOps engineer who writes tutorials for developers new to CI/CD" |
| Setup | Task | State the core action with a clear verb | "Draft a step-by-step guide to setting up GitHub Actions for a Node.js project" |
| Inputs | Context | Define audience, goal, and background | "Audience: backend developers. Goal: ship a working pipeline by end of article" |
| Inputs | References | Paste a style or tone example inline | "Write in the same voice as this intro: [paste sample paragraph]" |
| Parameters | Style | Specify format and heading structure | "Use H2 headings. Every section ends with a code block" |
| Parameters | Constraints | List what the AI must not do | "No Docker. Keep the intro under 80 words. Avoid passive voice" |
| Refinement | Evaluate | Check facts, tone, and structure | "Does every section have a runnable example?" |
| Refinement | Iterate | Rewrite one specific section surgically | "Expand the caching section — add a sequence diagram and a 15-line TypeScript example" |
Common Mistakes
| Mistake | Why It Hurts | Fix |
|---|---|---|
| Vague action verb | AI produces an unfocused, meandering result | Replace "write about" with "draft", "outline", or "explain step-by-step" |
| No audience specified | Tone and depth miss the target entirely | Add "for [audience with X knowledge level]" to every prompt |
| No constraints given | Output is too long or drifts into tangents | Add a word limit and a list of excluded topics |
| One-shot expectation | First draft is treated as final copy | Budget at least two deliberate refinement rounds |
| Generic persona | AI defaults to average, surface-level vocabulary | Open every session with a precise, domain-specific role |
The most damaging habit of all is treating the first draft as the final one. Every experienced writer — with or without AI — treats the first output as raw material. The prompt is the plan; the first draft is the rough cut; refinement is where the article actually comes together.
Summary
Building a prompt before writing is not extra overhead — it is the planning work that prevents wasted editing time later. The four-phase framework gives you a repeatable structure: establish who is writing and what they must produce, supply the context and tone reference they need, define the shape and limits of the output, then evaluate and refine surgically rather than broadly.
The habits that matter most: always assign a specific persona, always anchor the task to a precise verb, always define the audience by knowledge level rather than job title, always add at least two constraints, and always plan for at least one deliberate refinement round. A prompt built this way turns a vague article idea into a structured brief — and a structured brief into a publishable article with far less rewriting.
