InformIT

The Anatomy of a Perfect Prompt

By

Date: Feb 25, 2026

Sample Chapter is provided courtesy of Addison-Wesley Professional.

Return to the article

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

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

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

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

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:

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.

FIGURE 3.1

FIGURE 3.1

The opening paragraphs of a scholarly paper about the Revolutionary War, as created 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.

FIGURE 3.2

FIGURE 3.2

The first part of a bedtime story about superheroes, as conceived 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.

FIGURE 3.3

FIGURE 3.3

A photorealistic image of an older couple at the dinner table, as generated by Midjourney.

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.

800 East 96th Street, Indianapolis, Indiana 46240