Overview

4 Prompt engineering and problem formulation

This chapter presents two complementary skills for productive AI use: prompt engineering and problem formulation. It reframes AI interaction away from keyword-like searching toward clear, conversational instruction, showing how modern models can follow context and nuance. As models improve, basic tasks require less elaborate prompting, but structuring requests and defining outcomes remains essential—especially for complex or creative work. The chapter proceeds from fundamentals to advanced methods and emphasizes hands-on experimentation for IT professionals seeking reliable, work-ready outputs.

It introduces a spectrum of prompting strategies—zero-shot, single-shot, few-shot, and many-shot—each suited to different levels of guidance, pattern-setting, and customization, including multimodal cases. The mechanics of effective prompts center on four principles: clarity, conciseness, relevance, and specificity. Building on these, the chapter explores advanced techniques such as recursive prompts, context injection, explicit constraints, prompt chaining, sentiment directives, and templating, plus meta-prompts that shape tone, style, or structure. Best practices stress learning from strong examples while avoiding pitfalls like over- or under-specification, misalignment with model capabilities, and misplaced assumptions about context.

Problem formulation complements prompting by first defining the objective, constraints, audience, and success criteria—shifting from asking for answers to directing how solutions should be produced. The chapter shows how subject-matter expertise translates into better instructions (for example, specifying algorithms, performance needs, and format), and explains why future prompt engineering will focus less on teaching basics and more on expressing preferences and standards. Combined, problem formulation and sound prompting enable consistent, high-quality results across everyday IT tasks—from databases and networking to development, security, and web work—turning AI into a dependable partner for practical, work-ready outcomes.

Paint by numbers
CH04 F01 LeMaire

Prompts used to write this chapter

Here are the prompts that we used as we wrote this chapter.

  • I need a better intro to chapter 3 (attached), in the style of the attached book, dbatools in a month of lunches, but again, never cliches or idioms
  • Is there a better way to present this information? Maybe I’m wrong, but this feels like it’d go good in a table?
  • Can you take out cliched phrases like "ever evolving"
  • Can you talk about how prompts are like a mix of art and tech
  • That feels like word salad. Can you simplify the paragraph/intro?
  • Can you replace the words within the brackets in the following sentence? Give me 5 iterations.
  • Finish this sentence: Knowing both the language of prompt engineering and the models you’ll be working with
  • Is there such a phrase as data analytics engine?
  • Search the web and tell me if all of this is true
  • I’m looking for a good way to express a thought. Here are two examples that I wrote. Can you help?

FAQ

What’s the difference between prompt engineering and problem formulation?Prompt engineering is crafting clear instructions that the AI can follow. Problem formulation comes first: it defines the goal, constraints, audience, success criteria, and format so you know exactly what to ask for. Together, problem formulation shapes the “what,” and prompt engineering delivers the “how.”
When should I use zero-shot, single-shot, few-shot, or many-shot prompting?- Zero-shot: Quick, straightforward tasks (facts, simple emails).
- Single-shot: Steer style or format with one example (e.g., “in the style of…”).
- Few-shot: Teach nuances or variations with several examples (temporary “training”).
- Many-shot: Complex, high-stakes tasks needing consistency, edge-case handling, or strict standards—organize examples carefully.
What are the core principles of a good prompt?Clarity, conciseness, relevance, and specificity. Be direct, remove fluff, tie details to the goal, and narrow scope (e.g., “leading databases for transactional workloads with enterprise support and high performance” instead of “best database”).
How should I manage context and “memory” in conversations with AI?- New chats start without prior context—don’t assume the AI “remembers.”
- Include needed background, constraints, and audience in the prompt.
- In multi-turn chats, reference prior outputs explicitly (recursive prompts).
- Avoid abrupt topic shifts without signaling; for APIs, send all relevant context each call.
Which advanced prompting techniques can improve results?- Recursive prompts: build on prior answers.
- Context injection: add roles/background (e.g., “As a cybersecurity expert…”).
- Explicit constraints: set limits (e.g., “only three items”).
- Prompt chaining: ask related sub-questions for a complete answer.
- Sentiment directives: set tone (empathetic, formal).
- Templating: require a specific structure (Intro, Methods, Findings, etc.).
What are meta-prompts and how do I use them?Meta-prompts are inline cues like “[Brief],” “[For Kids],” “[Pros and Cons],” or “[Step-by-Step]” that steer style and format. Add them before the request to shape length, tone, structure, or audience. Try the same question with different meta-prompts to compare outputs.
How is prompt engineering changing as AI models advance?Models need less instruction for basic tasks (zero/single-shot get easier). Few- and many-shot remain crucial for customization—teaching your preferences, standards, and formats. Expect a shift toward stronger problem formulation and output refinement rather than over-explaining basics.
What common mistakes should I avoid when prompting?- Over-specification: too many details that constrain or distract.
- Under-specification: vague asks like “Write a story.”
- Misalignment: requesting proprietary or unavailable info, or outside model capabilities.
- Assuming memory: referencing past chats without restating context.
- Ignoring context flow: abrupt topic switches without guidance. Keep it simple and goal-focused.
How can IT professionals apply these ideas quickly?Start with clear goals, audience, and constraints; then pick the right technique. Examples: ask for a SQL SELECT walkthrough, a home Wi‑Fi troubleshooting guide, or simulate a Linux terminal/JavaScript console or text-based Excel. Use templates and explicit constraints to get “work-ready” outputs.
When should I use images in prompts, and how?Use multimodal single-shot for visual tasks: show one example image and ask for analysis or “create X in the same style.” This is ideal when words are insufficient to convey look, layout, or design patterns.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI for Everyday IT ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI for Everyday IT ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI for Everyday IT ebook for free