The Anatomy of a Perfect Prompt
Date: Feb 25, 2026
Sample Chapter is provided courtesy of Addison-Wesley Professional.
AI prompt engineering is all about crafting more effective AI prompts, but how exactly do you do that? Not surprisingly, the most effective prompts contain similar key elements. Include these elements, and you’ll likely be more satisfied with the AI results.
Crafting an Effective AI Prompt
Crafting an effective AI prompt requires a clear understanding of what you want to receive and some forethought on how to best instruct the AI model to give you what you want. That’s what prompt engineering is all about—engineering an effective prompt.
To be effective, your prompt needs to tell the AI model what you want it to do, how you want it to do it, and how you want it to present the results. You need to present these instructions in as much detail as necessary, while also being as concise as possible. (That’s contradictory, I know; when in doubt, err on the side of too much detail.)
Doing this requires a little homework. Just entering a bunch of words off the top of your head isn’t prompt engineering, it’s freeforming—and it isn’t consistently effective. You need to think about what you want the AI to do and then figure out the best way to instruct it to do that.
You might even want to write your prompt in advance, so that you can edit it as you work through it. Read through your prompt, one step or item at a time, and make sure it makes sense to you. If you get confused, so will the AI tool. Make the effort to ensure that your prompt is as clear as possible and includes all the necessary instructions and information.
Bottom line: Think of your prompt as a set of instructions that the AI will follow precisely. Make sure you’re explaining things as clearly as possible and don’t leave anything to chance.
Necessary Components of an AI Prompt
Whether you’re asking for text, image, or video output, your AI prompt needs to include the same basic components. These components include
Task: What you want the AI to do, such as “write a…” or “summarize this…” or “generate a…,” in as much detail as possible.
Format: What kind of output you need, including length, type (blog post, letter, and so on), file format, and any other pertinent details.
Topic: The thing in which you’re interested. The subject of the verb presented in the task—write a paper about topic, answer a question about topic, or create a photo of a topic.
Tone or style: Serious, lighthearted, professional, and so on.
Context: Background information and relevant details about the topic, audience, or situation.
Requirements or constraints: Things that the AI should include or exclude from the task.
We’ll look at each of these elements in more detail next.
Task
Probably the most important part of a prompt is the task or objective—what you want the AI to do. This is the primary directive to the AI tool, in as much detail and specificity as possible.
Start out by using action verbs, such as
Write (a blog post, an email, a short story, and so on)
Explain (a topic or concept)
Tell me about (a topic)
Generate (ideas, a list, an outline)
Create (a photorealistic image, a watercolor painting, a short film)
Summarize (a document, a piece of text, meeting notes)
Analyze (a document, a piece of text, a web page, a report)
Translate (a word, a phrase, a document)
Compare (two documents, two pieces of text, two approaches or theories)
Format
The format describes, in as much detail as possible, the type of output you want. It can be rather broad, such as an article, story, or social media post. But it should also include other necessary details, such as
Length (number of words or pages or, for an audio or video, amount of time)
File format
Number of paragraphs or number of sections
Number of slides (for a presentation)
Aspect ratio or dimensions (for an image or video)
Professional formats (such as MLA or APA format for scholarly papers)
The format might also specify how you want the output structured, such as in a bulleted or numbered list, Q&A format, and so forth. If the result should include specific sections, such as an introduction or summary, notate that as well.
Topic
Every task should reference a specific topic or target. The topic is typically a noun with one or more descriptive adjectives.
The topic follows the task and the format. As an example, the task might be write, the format might be a blog post, and the topic would be what you want the post to be about, such as adopting a pet. Put it all together, and you get the prompt:
write a blog post about adopting a pet
The more specific the topic, the better. For example, instead of saying
write about banks
say
write about the history and different types of American banking institutions
Instead of saying:
create a picture of a girl
Describe the subject in more detail as
create a picture of a teenaged girl with long blonde hair and blue eyes wearing an orange t-shirt
Along the same lines, instead of saying
create a menu for dinner
say
Create a menu for dinner for four that includes appetizer, main course, and dessert and is gluten-free. Attendees prefer something light Mediterranean influenced.
Instead of saying
generate an outline for a detective story
Provide more details, such as
generate an outline for a detective story about a missing wife, mobsters, and an insurance scam, set in Chicago in the 1940s
The more details you can include about your topic, the better.
Tone and Style
With this element, you tell the AI what type of tone or style in which you want the results presented. This one isn’t necessarily mandatory, but it can help steer the AI toward the desired results.
When describing the desired tone, you can use words such as professional, friendly, witty, persuasive, formal, casual, academic, conversational, or concise. When it comes to style, use descriptors such as dark, dramatic, comedic, pompous, and the like. You can even reference defined dramatic styles, such as create a hardboiled mystery story or write a poem in the style of Robert Frost. Use whatever descriptors you need to convey how you want your results presented.
Context
Think of context as important background information that can help the AI model fine-tune its results. This background info might include details about the situation or characters, key facts about a given topic, important data points, where an image or video takes place, and the like.
Requirements/Constraints
This element details things that must be included in the output or should not be included in the output. For example, if you’re writing a paper for school, you can specify that the paper includes citations, a specific number of sources, and a summary or conclusion. You can specify elements or ideas that must be included, such as pointing to relevant data or arguments that should be referenced. For images, you also specify items that should be included in an image, such as background details and overall color scheme.
You can also specify things that should be avoided in the results, such as to avoid technical jargon, avoid inappropriate language or images, avoid mentioning specific arguments or approaches, or avoid mentioning particular individuals or groups. For images, you can also define colors or details to avoid.
In addition, you can note the intended audience for the output, as well as the desired reading level, such as write an article at an 8th grade reading level or present the information in a way that 4th graders can understand it.
Optional Elements
There are also several optional elements you can include in a prompt as appropriate for the task at hand and the type of output you desire. These elements include
Goal: If the objective is to persuade an audience to action or achieve some sort of response, let the AI know. For example, you might insert the goal of convince the reader to vote for the proposal or lead the reader to request a sample or something similar.
Role: Ask the AI to assume a specific identity or perspective or describe the likely consumer of the output. For example, you might include something like assume the role of a drill sergeant or assume you’re teaching a high school class or write as if you’re a seasoned political analyst. Or, to detail the role of the consumer, you might include something like direct the output to seniors considering Medicare plans or assume the readers are students at a liberal arts college.
Examples and references: One or more similar items that can serve as a reference for what type of output you want. You can use a specific URL to direct the AI to content on the web; cut and paste the example or reference into your prompt; or, with some AI tools, upload the reference as a separate file.
Which of these optional elements you include, if any, depends on the type of output you desire.
What Not to Include in a Prompt
Knowing what not to include in an AI prompt is just as important as knowing what to include. To ensure better results, here are some things to avoid in your prompts:
Too many tasks at once: AI models, just like us human beings, can get confused or overwhelmed if tasked to do too many things at the same time. If what you want is overly complex, break it down into multiple prompts.
Too many details or too much background information: Similarly, you can overwhelm some AI models by including too many irrelevant background details. Include what’s important or necessary, but don’t make the model try to extract the wheat from the unnecessary chaff.
Contradictory instructions: Don’t ask the AI to go in two different directions at the same time. Your desired output cannot be both serious and lighthearted at the same time, nor can it be concise and detailed. Pick your lane and stick to it.
Jargon and industry speak: Use plain English when crafting your prompt. Avoid lingo and TLAs (three-letter acronyms) that only industry insiders will understand. Don’t assume the AI knows all the jargon used inside your company or industry.
Inappropriate or sensitive content: Avoid asking for or referencing anything illegal, violent, or discriminatory. (You may, in fact, be prohibited from entering inappropriate prompts with some AI engines.)
Copyrighted material: Along the same lines, avoid infringing on any copyrighted characters or material. While some AI engines might let you generate an image of Superman at your birthday party, others will refuse to do so on copyright grounds.
When it comes to crafting your prompts, just use common sense. Don’t do anything confusing or inappropriate, and you should be fine.
Putting It All Together
Now that you know what you should and shouldn’t include in an AI prompt, let’s put it all together to look at how to construct a complete prompt. Referencing all the previously discussed elements, follow this format:
[task] [format] [topic] [tone] [context] [requirements/constraints] [optional elements]
For example, if you want to write a college-level paper about the Revolutionary War, you can identify the elements shown in Table 3.1.
TABLE 3.1 Elements of a Prompt for a Scholarly Paper
Element |
Example |
|---|---|
Task |
Write a paper |
Format |
1,000 words in MLA format |
Topic |
Revolutionary War |
Tone |
Scholarly |
Context |
Audience of college history professors |
Requirements/constraints |
Include information about the role of the Founding Fathers |
Optional elements |
Convince the audience to provide additional funding for my research |
Now all you have to do is put all that together in a prompt. Here’s what that might look like:
Write a 1,000-word paper in MLA format about the Revolutionary War. Use a scholarly tone appropriate for an audience of college history professors and include information about the role of the Founding Fathers. The goal is to convince the audience to provide additional funding for my research.
Figure 3.1 shows the beginning of the paper, as written by ChatGPT.
Follow this format to create prompts for all types of tasks. As another example, let’s say you want to create a short story for a six-year-old boy about superheroes in his neighborhood. Table 3.2 details the necessary elements.
TABLE 3.2 Elements of a Prompt for a Children’s Story
Element |
Example |
|---|---|
Task |
Tell me a bedtime story |
Format |
Less than five minutes long |
Topic |
Superheroes in our neighborhood |
Tone |
Lighthearted |
Context |
For a six-year-old boy |
Requirements/constraints |
Not scary |
Optional elements |
Help put the boy to sleep |
And here’s the resulting prompt:
Tell me a bedtime story less than five minutes long about superheroes in our neighborhood for a six-year-old boy. The tone should be lighthearted, not scary, and help put the boy to sleep.
Figure 3.2 shows the beginning of just such a story, as written by DeepSeek.
You can also use this approach to create prompts for images, videos, and music. For example, if you want to generate a photo of an older couple at the dinner table for a marketing brochure, you’d use the elements shown in Table 3.3.
TABLE 3.3 Elements of a Prompt to Create a Photographic Image
Element |
Example |
|---|---|
Task |
Generate |
Format |
Photorealistic image in portrait format |
Topic |
Older couple sitting next to each other at a dinner table |
Tone |
Warm |
Context |
For a marketing brochure |
Requirements/constraints |
The couple should be holding hands and smiling. |
Optional elements |
Selling life insurance |
Here’s the resulting prompt:
Generate a photorealistic image in landscape format of an older couple sitting next to each other at a dinner table. The vibe should be warm and appropriate for a marketing brochure. The couple should be holding hands and smiling. The goal is to help sell life insurance.
Figure 3.3 shows just one of the images generated by Midjourney from this prompt.
As you can see, when you follow this format and include the proper elements, you get pretty good results. It’s a good place to start with your prompt engineering.
And, to help you get started, here’s a blank form you can copy and use for your own prompt construction. It’s labeled as Table 3.4, but it’s really a prompt element template for your use.
TABLE 3.4 Prompt Element Template
Element |
Your prompt |
|---|---|
Task |
|
Format |
|
Topic |
|
Tone |
|
Context |
|
Requirements/constraints |
|
Optional elements |
|
Summary
In this chapter, you learned the anatomy of an effective AI prompt. You learned how to craft a prompt and the essential elements to include. You also learned what not to include and how to put it all together in a practical fashion.
Next up, more information on how to use prompts to define your desired output.


