Prompt engineering
Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs.
Introduction to Generative AI, Second Edition
Prompt engineering is the deliberate design of inputs to guide a generative model's behavior or output.
- How it is used
- Guides generative model behavior toward specific tasks and contexts through carefully designed inputs.
- How deep it goes
- Explains prompt design as an iterative process of drafting, testing, evaluating, and revising, with techniques for structuring complex tasks.
- Examples
- Uses a cybersecurity executive summary, a noir-style moon-landing account, and a chatbot that gives overly long answers.
- What you can do after
- Practice designing and revising prompts, then compare their responses across representative sample contexts.
Read how Introduction to Generative AI, Second Edition explains prompt engineering →
Coding with AI
Prompt engineering is the systematic design and refinement of instructions and context provided to an AI system to elicit desired outputs.
- How it is used
- Guides AI-assisted software design, coding, testing, and documentation through explicit instructions and context.
- How deep it goes
- Provides prompt components, technique comparisons, and iterative refinement steps with worked development scenarios.
- Examples
- Contrasts email-validation prompts and decomposes a Python HTTP request into initialization, response display, and error-handling tasks.
- What you can do after
- Apply it via ChatGPT and other coding assistants to formulate requests, refine responses, and review generated artifacts.
LLMs in Production
Prompt engineering is the practice of designing and refining input instructions to influence an AI model's behavior and output.
- How it is used
- Guides general-purpose models toward consistent application behavior without retraining for every task.
- How deep it goes
- Explains prompt design and production trade-offs, then demonstrates optimization with a worked DSPy example.
- Examples
- Uses a coding copilot with mismatched instruction examples and a DSPy grade-school math task.
- What you can do after
- Apply prompt design and DSPy optimization to guide model outputs and evaluate task performance.
AI for Everyday IT
Prompt engineering is the deliberate design and refinement of instructions supplied to an AI system to improve the quality or relevance of its responses.
- How it is used
- Uses prompt engineering to turn defined goals into productive AI conversations and work-ready content.
- How deep it goes
- Explains prompt construction principles, shot strategies, advanced techniques, and iterative practice with worked comparisons.
- Examples
- Compares database-selection questions and uses an instructor persona to translate Oracle concepts for a SQL Server administrator.
- What you can do after
- Apply it through clear requests, relevant constraints, and iterative follow-up to produce more targeted AI responses.
Generative AI in Action
Prompt engineering is the deliberate design and refinement of inputs provided to generative models to elicit desired outputs.
- How it is used
- Steers generative models toward task-specific outputs and provides a starting point for enterprise model adaptation.
- How deep it goes
- Explains prompt components, iterative refinement, operational practices, and risks through practical guidance and examples.
- Examples
- Uses sales-report prompt refinement, Celsius-to-Fahrenheit examples, and text and image generation to illustrate steering.
- What you can do after
- Apply prompt engineering by specifying tasks and constraints, evaluating outputs, and iterating on instructions and examples.
Read how Generative AI in Action explains prompt engineering →
LLM Customization and Fine-Tuning
Steering a model's behavior through its input instructions or examples without updating its weights.
- How it is used
- Establishes a low-cost baseline before choosing retrieval or weight-updating techniques.
- How deep it goes
- Works through prompt design, held-out validation, variability checks, and volume-based cost comparisons.
- Examples
- Uses an eight-shot support-ticket classifier and a comparison of format prompting with an IT-support LoRA adapter.
- What you can do after
- Practice designing and evaluating a few-shot prompt, then compare its quality and recurring cost with alternatives.
Read how LLM Customization and Fine-Tuning explains prompt engineering →
Knowledge Graphs and LLMs in Action
Prompt engineering is the deliberate design and iterative refinement of instructions and examples given to a language model to obtain desired outputs.
- How it is used
- Deploys natural-language instructions and examples to extract domain-specific entities and relations for knowledge graphs.
- How deep it goes
- Explains iterative design, class naming, examples, configuration, and failure modes, but defers model internals and detailed fine-tuning.
- Examples
- Demonstrates diary-entry extraction, abbreviated names and titles, normalized relations, OpenAI API calls, and chain-of-thought prompting.
- What you can do after
- Build it from scratch by iterating prompts, selecting examples and parameters, and evaluating structured LLM outputs for a domain task.
Read how Knowledge Graphs and LLMs in Action explains prompt engineering →
Natural Language Processing in Action, Second Edition
Prompt engineering is the deliberate design and revision of prompts to influence a language model's behavior and outputs.
- How it is used
- Shapes chatbot behavior through iterative instructions while accommodating differences among language models.
- How deep it goes
- Works through prompt revision and tests for a tutor’s onboarding, while cautioning that explicit directives do not ensure compliance.
- Examples
- Uses a math tutor’s parent-permission dialogue and a number-sequence quiz to expose successes and failures.
- What you can do after
- Apply it via LangChain by revising a conversation template and inspecting generated turns.
Read how Natural Language Processing in Action, Second Edition explains prompt engineering →
The Art of AI Product Development
Prompt engineering is the deliberate design and refinement of instructions provided to a generative model to elicit desired outputs.
- How it is used
- Steers language-model behavior for application-specific tasks and enables rapid prototyping without changing model weights.
- How deep it goes
- Provides technique-selection guidance and an iterative process for testing, collaboration, reusable components, and version control.
- Examples
- Uses marketing blog tone instructions to illustrate how prompt changes affect client-facing content.
- What you can do after
- Apply prompt engineering through iterative testing, reusable templates, and version control to improve application-specific outputs.
Read how The Art of AI Product Development explains prompt engineering →
Building LLM Applications with DSPy
The practice of manually iterating on and rephrasing prompts to improve language-model responses.
- How it is used
- Frames manual prompt iteration as a reliability and maintenance challenge for language-model applications and a contrast with prompt programming.
- How deep it goes
- Explains prompt-component edits, heuristics, evaluation pitfalls, and trade-offs, then contrasts them with automated optimization.
- Examples
- Uses a customer-intent classification prompt with class labels, a JSON response format, and a labeled demonstration.
- What you can do after
- Evaluate and understand prompt changes, their testing risks, and when automated optimization may reduce manual work.
Read how Building LLM Applications with DSPy explains prompt engineering →
Vibe Engineering
Prompting is the practice of formulating and supplying instructions or context to an AI model to guide its output.
- How it is used
- Guides code migration, SQL generation, performance work, and review by supplying instructions and relevant context to an AI model.
- How deep it goes
- Explains prompt refinement and programmatic prompt assembly, then examines assumptions and verification through worked engineering cases.
- Examples
- Uses JBoss test migration, schema-aware SQL generation, and an account-lookup concurrency benchmark as concrete cases.
- What you can do after
- Apply prompting to specify tasks and context, inspect generated changes, and test assumptions rather than trusting output automatically.
Build an Advanced RAG Application (From Scratch)
Prompting is the practice of crafting input instructions, context, constraints, or output specifications to guide a language model's behavior.
- How it is used
- Guides decoder models to turn user intent and retrieved hotel information into organized responses and recommendations.
- How deep it goes
- Defines prompt construction, compares zero-shot, few-shot, and chain-of-thought patterns, and demonstrates API-based prompts without formal internals.
- Examples
- Uses Paris hotel requests, New York and Tokyo few-shot examples, word problems, and Louvre-area hotel-result analysis.
- What you can do after
- Apply it via the OpenAI API to structure requests, supply examples or evidence, and improve response usefulness.
Read how Build an Advanced RAG Application (From Scratch) explains prompt engineering →
Software Testing with Generative AI
Prompt engineering is the deliberate design of inputs, instructions, constraints, and examples to influence a large language model toward a desired output.
- How it is used
- Applies deliberate prompt patterns to testing, development feedback, test-case creation, and synthetic-data generation.
- How deep it goes
- Explains prompt construction through constraints, delimiters, examples, decomposition, and evaluation, while stopping short of eliminating model errors.
- Examples
- Demonstrates Contact Us risk prompts, authorization API test cases, simulated rubber-duck feedback, and delimited room-data schemas.
- What you can do after
- Apply prompt tactics to formulate specific testing tasks and obtain more structured, context-relevant LLM assistance for human review.
Read how Software Testing with Generative AI explains prompt engineering →
Grokking AI Applications
Prompt engineering is the systematic design and refinement of prompts to influence a generative model's outputs.
- How it is used
- Shapes LLM responses to match an application's tone, style, objectives, and user needs.
- How deep it goes
- Explains prompt clarity, length trade-offs, and refinement techniques without descending into model internals.
- Examples
- Uses a business-plan request, a “not found” fallback, repeated instructions, and self-validation prompts.
- What you can do after
- Apply it by balancing context and concision, decomposing tasks, adding fallbacks, and requesting self-validation.
Read how Grokking AI Applications explains prompt engineering →
Starting Data Analytics with Generative AI and Python
Prompt engineering is the deliberate design and refinement of instructions supplied to a generative AI system.
- How it is used
- Uses prompt tailoring and iterative dialogue to steer generative AI throughout data analysis.
- How deep it goes
- Explains practical prompt adjustments and follow-up questions, while distinguishing a more advanced scientific approach without developing it.
- Examples
- Uses sarcasm in sentiment analysis, genetic drift rephrasing, and Portuguese tokenization to illustrate prompt adjustments.
- What you can do after
- Apply it through iterative dialogue to specify context and audience, request revisions, and question particular aspects of an answer.
Read how Starting Data Analytics with Generative AI and Python explains prompt engineering →
Machine Learning Platform Engineering
Prompt engineering is the deliberate design and refinement of inputs provided to generative models to influence their outputs.
- How it is used
- Guides documentation-assistant responses and query routing by shaping instructions, examples, and retrieved context.
- How deep it goes
- Explains versioned prompt management and token-saving revisions, but does not specify a complete prompt-testing implementation.
- Examples
- Compares verbose and concise documentation prompts and uses a minimal complexity-classification prompt for model routing.
- What you can do after
- Apply it via Langfuse to version and compare prompts, then refine token use without sacrificing quality.
Read how Machine Learning Platform Engineering explains prompt engineering →
Prompt Engineering in Practice
The deliberate construction of a prompt's instructions, context, constraints, and output requirements.
- How it is used
- Makes language-model prompts reliable, reviewable interfaces for software products, workflows, and shared prompt libraries.
- How deep it goes
- Defines the practice and lays out composition, testing, iteration, and management; stops short of changing model weights.
- Examples
- Uses a pull-request summary, an API migration notice, and revisions of architecture-diagram and ADR-summary prompts.
- What you can do after
- Build it from scratch as a testable prompt contract, then refine failures and maintain its change history.
Read how Prompt Engineering in Practice explains prompt engineering →
AI Agents and Applications
Prompt design is the practice of formulating instructions and context to influence a language model's behavior and output.
- How it is used
- Guides language-model behavior across chatbots, research workflows, and multi-agent routing.
- How deep it goes
- Explains templates and few-shot prompting, then outlines task-specific prompt stages and iteration for reliability.
- Examples
- Uses interactive summarization, web research reports, and customer-service agent routing as applications.
- What you can do after
- Apply it via ChatGPT and LangChain to create and refine task-specific prompts.
Read how AI Agents and Applications explains prompt engineering →
Building Specialized AI Systems
Prompt engineering is the deliberate design of instructions and input context to guide a model’s behavior without changing its parameters.
- How it is used
- Guides general-purpose models toward task-specific behavior when a lightweight alternative to parameter adaptation is appropriate.
- How deep it goes
- Explains instruction, context, few-shot, chain-of-thought, and role-playing strategies, then details the knowledge ceiling and iterative evaluation workflow.
- Examples
- Uses legal contract analysis, financial assessment, medical documentation, and an algebra-to-calculus analogy to illustrate prompting limits.
- What you can do after
- Evaluate/understand when careful prompts suffice and when accuracy, knowledge gaps, or production demands call for more specialized approaches.
Read how Building Specialized AI Systems explains prompt engineering →
AI Agents in Action
Prompt engineering is the deliberate design and refinement of inputs to a language model to obtain desired and consistent outputs.
- How it is used
- Improves direct LLM interactions and helps shape agent profiles for tasks.
- How deep it goes
- Works through clear instructions and systematic evaluation, then introduces reasoning techniques including self-consistency and tree of thought.
- Examples
- Uses movie recommendations and time-travel problems to illustrate prompt refinement and reasoning.
- What you can do after
- Apply it via Microsoft prompt flow to compare prompt variants using rubric scores.
Effective Data Analysis
Prompt engineering is the practice of designing and refining instructions supplied to generative models to obtain desired outputs.
- How it is used
- Supports analytics, software integration, internal efficiency, and stakeholder-facing use of generative AI.
- How deep it goes
- Explains iterative prompt design, model review, output constraints, and evaluation, but does not detail model internals or fine-tuning.
- Examples
- Uses customer-login statistics, support-text summaries, rat-sighting analysis, predictive models, Python code, and agency recommendations.
- What you can do after
- Apply prompt refinement to request analyses, code, metrics, models, and constrained stakeholder recommendations from chatbots.
Read how Effective Data Analysis explains prompt engineering →
Deep Learning with JAX
The practice of shaping input prompts to get better outputs from a pretrained language model without changing its weights.
- How it is used
- Uses structured input text to steer pretrained language models toward desired task outputs.
- How deep it goes
- Defines prompt structuring and names chain of thought, but defers detailed techniques and implementation.
- Examples
- Uses a GPT-J prompt that requests SQL from natural language enclosed in triple backticks.
- What you can do after
- Evaluate generated outputs for formatting, multiplicity, repetition, and syntax errors before using them.
Read how Deep Learning with JAX explains prompt engineering →
How Large Language Models Work
Prompt engineering is the practice of designing and modifying input text to influence a language model's behavior or output.
- How it is used
- Constrains an instruction-following LLM to a task, goal, detail level, or tone through carefully designed input text.
- How deep it goes
- Defines prompts, demonstrates modifications, and explains brittleness, while stopping short of a procedural optimization method.
- Examples
- Uses car-selling bots, CSV formatting, survey-theme summarization, and question rewriting for search.
- What you can do after
- Apply explicit prompts to repetitive, fuzzy tasks while testing results rather than treating fluent output as guaranteed accuracy.
Read how How Large Language Models Work explains prompt engineering →
Financial AI in Practice
Prompt engineering is the deliberate design and refinement of instructions supplied to generative models to elicit desired outputs.
- How it is used
- Converts retrieved financial news into structured qualitative signals for an investment analysis pipeline.
- How deep it goes
- Details roles, boundaries, a two-step analysis, JSON schema, and response validation, then connects monitoring feedback to refinement.
- Examples
- Uses uranium news assessments, investment-post summaries, and fraud investigation guidelines to illustrate prompts.
- What you can do after
- Applies structured prompting via gpt-5-mini to request and validate machine-readable financial news assessments.
Read how Financial AI in Practice explains prompt engineering →
AI-Powered Search
Prompt engineering is the deliberate design and manipulation of model inputs to influence the behavior or output of a language model.
- How it is used
- Guides language models toward task-specific search outputs by injecting context into each inference request.
- How deep it goes
- Explains context steering and DSPy-based optimization, then stops short of model-weight training internals.
- Examples
- Uses unicorn queries, role-and-expertise context, DSPy signatures, evaluation metrics, and tracked prompt responses.
- What you can do after
- Evaluate and optimize prompts using task signatures, response metrics, tracked outputs, and automated prompt-variation testing.
Effective Conversational AI
Prompt engineering is the design of instructions, context, examples, and input data supplied to a language model to influence its output.
- How it is used
- Guides language-model outputs for conversational answers and generates candidate utterance variants for chatbot coverage.
- How deep it goes
- Defines prompt components and works through iterative synonym requests, without detailing model internals.
- Examples
- Contrasts generic and customer-contextualized prompts for synonyms of “password” and “forgot.”
- What you can do after
- Practice/perform iterative prompt revision and test changes against logged user requests and updated test sets.
Read how Effective Conversational AI explains prompt engineering →
The AI Pocket Book
The practice of designing prompts to steer a language model toward better or more reliable outputs.
- How it is used
- Improves off-the-shelf generative AI outputs, including hallucination mitigation, task customization, and output disambiguation.
- How deep it goes
- Demonstrates few-shot and chain-of-thought prompting, then compares prompting with fine-tuning without detailing model internals.
- Examples
- Uses arithmetic word problems, world-record tables, RAG context, and Midjourney image references as concrete examples.
- What you can do after
- Apply prompting through demonstrations, reasoning examples, retrieved context, and reference images before attempting fine-tuning.
Deep Learning with R, Third Edition
Prompt engineering is the systematic design and refinement of inputs to a generative model to improve its performance on a task.
- How it is used
- Improves language-model performance by shaping prompts for particular outputs, roles, constraints, or reasoning tasks.
- How deep it goes
- Explains prompt construction through continuations, role instructions, constraints, and phrasing sensitivity, but does not provide a formal optimization procedure.
- Examples
- Uses brownie recipes, role instructions, harmful-topic constraints, reasoning riddles, and an invented-president question to demonstrate prompt effects.
- What you can do after
- Apply prompt engineering by constructing contextual openings, role instructions, constraints, and wording variations for language-model tasks.
Read how Deep Learning with R, Third Edition explains prompt engineering →
AI-Powered Developer: Build software with ChatGPT and Copilot
Prompt engineering is the deliberate design and iterative refinement of instructions given to an AI model to influence its outputs.
- How it is used
- Guides LLMs toward targeted code, designs, and explanations by improving task instructions over successive interactions.
- How deep it goes
- Defines refinement and persona patterns, then demonstrates them through linked-list, system-design, and code-generation prompts.
- Examples
- Uses singly linked lists, an IT asset management system, and depreciation strategies to demonstrate prompt refinement.
- What you can do after
- Apply it via ChatGPT or GitHub Copilot to specify requirements, refine generated code, and check outputs against intended rules.
Read how AI-Powered Developer: Build software with ChatGPT and Copilot explains prompt engineering →
Learn AI Data Engineering
Prompt engineering is the deliberate design and refinement of inputs provided to an AI model to influence the quality, format, or behavior of its outputs.
- How it is used
- Guides AI-assisted data workflows by expressing matching rules, priorities, and output requirements in natural language.
- How deep it goes
- Works through prompt instructions, context limits, structured output, iteration, and validation rather than model internals.
- Examples
- Uses Pagila schema context and customer-record matching with names, emails, device IDs, IP addresses, coding languages, confidence, and reasoning.
- What you can do after
- Apply it via an AI coding workflow to create focused, schema-grounded prompts and reviewable structured results.
Read how Learn AI Data Engineering explains prompt engineering →
Building Reliable AI Systems
The deliberate design of instructions and context to guide a language model's behavior and outputs.
- How it is used
- Guides language-model behavior and reduces hallucination risk, from initial prompt design through production quality control.
- How deep it goes
- Describes iterative refinement, prompting techniques, testing, and production feedback, while deferring external knowledge integration to retrieval-augmented generation.
- Examples
- Uses an e-commerce support chatbot, a legal-document assistant, and a Python prompt-version listing.
- What you can do after
- Apply prompt engineering by refining instructions, testing real queries against a quality bar, and using feedback to guide revisions.
Read how Building Reliable AI Systems explains prompt engineering →
The Complete Obsolete Guide to Generative AI
Prompt engineering is the deliberate design and refinement of instructions and context supplied to a generative model to influence the quality of its output.
- How it is used
- Guides language-model responses toward task-specific formats, context, constraints, and desired results.
- How deep it goes
- Explains practical prompt strategies and iterative refinement, without descending into language-model internals.
- Examples
- Uses investment-counselor roles, CSV output, Python loop questions, error messages, car descriptions, and 4K video conversion.
- What you can do after
- Apply it via ChatGPT to ask focused questions, refine weak responses, and troubleshoot generated code.
Read how The Complete Obsolete Guide to Generative AI explains prompt engineering →
Build AI-Enhanced Web Apps
Prompt engineering is the design and refinement of instructions and contextual information supplied to an AI model to guide its outputs.
- How it is used
- Optimizes AI-generated outputs and user interactions by tailoring instructions and context to web-application requirements.
- How deep it goes
- Explains strategies, prompt types, structured-output techniques, token limits, and versioning, but does not descend into model internals.
- Examples
- Uses structured JSON generation, few-shot task adaptation, semantic search, content recommendations, and interview feedback.
- What you can do after
- Apply it to improve accuracy, contextual relevance, structured output reliability, and user experience in AI-powered web applications.
Read how Build AI-Enhanced Web Apps explains prompt engineering →
Data Analysis with LLMs
Prompt engineering is the systematic design and search of prompts or prompt templates to guide a language model toward better task results.
- How it is used
- Guides language models toward better task results through deliberate prompt and prompt-template design.
- How deep it goes
- Explains task specification, contextual prompting, template experimentation, and few-shot examples without detailing model internals.
- Examples
- Uses sentiment classification, labeled reviews, constrained positive-or-negative answers, and alternative prompt templates.
- What you can do after
- Build it from scratch by designing and testing prompt templates for familiar or novel language-model tasks.
Read how Data Analysis with LLMs explains prompt engineering →
AI Agents in Action, Second Edition
Prompt engineering is the deliberate design and refinement of instructions and contextual input to elicit desired behavior from a language model.
- How it is used
- Shapes agent personas, reasoning, workflows, tool use, and response constraints for predictable task completion.
- How deep it goes
- Moves from instruction principles to complete workflows, examples, constraints, typed outputs, and tracing, while deferring deep model internals.
- Examples
- Uses a search-agent workflow, source-selection examples, typed research plans, strict length limits, tool calls, repeated runs, and trace inspection.
- What you can do after
- Apply it via the OpenAI Agents SDK to refine prompts, enforce structured results, add tools, and inspect execution traces.
Read how AI Agents in Action, Second Edition explains prompt engineering →
Learn AI-Assisted Python Programming, Second Edition
The practice of designing and refining instructions for an AI system to improve the relevance and correctness of its outputs.
- How it is used
- Improves AI-assisted programming by shaping requests, correcting generated code, and eliciting useful explanations.
- How deep it goes
- Explains precision, testing, and prompt revision procedurally, while deferring detailed prompt patterns beyond function requests and explanation requests.
- Examples
- Uses function headers, docstrings, rewritten function prompts, /explain, and line-by-line explanation requests.
- What you can do after
- Diagnose/debug with it by testing Copilot output, identifying errors, and revising prompts to seek better code or explanations.
Read how Learn AI-Assisted Python Programming, Second Edition explains prompt engineering →
Machines that Think
Prompt design is the deliberate construction of prompts to influence a language model's responses or performance.
- How it is used
- Examines prompt design as a source of language-model variability, refinement difficulty and safety challenges.
- How deep it goes
- Explains prompt sensitivity and refinement through empirical findings and statistical cues, without providing a prompt-design procedure.
- Examples
- Uses formatting variations, classification-prompt revisions and a cybersecurity training scenario to illustrate changes in model behavior.
- What you can do after
- Evaluate prompt changes with attention to objective feedback, model differences and scoring limitations.
Transformers in Action
Prompting is the practice of providing input instructions or context to a generative model to elicit a desired output.
- How it is used
- Guides model behavior by formulating tasks and supplying context for generation.
- How deep it goes
- Defines prompting variants and works through few-shot classification and the steps of thread-of-thought prompting.
- Examples
- Uses sentiment classification and large or chaotic context analysis to illustrate prompting approaches.
- What you can do after
- Practice constructing prompts with examples or stepwise context analysis to guide task responses.
Read how Transformers in Action explains prompt engineering →
Understanding AI
Prompt engineering is the deliberate design and refinement of inputs to guide a model toward desired outputs.
- How it is used
- Guides communication with language models to produce useful, accurate, relevant, and consistently usable results.
- How deep it goes
- Explains prompt structure, response controls, prompting methods, conversation patterns, and limitations, while stopping short of technical model internals.
- Examples
- Uses an ambiguous electric-car question, prompt-action templates, and the contrast between prompting and an explicit battery-warning program.
- What you can do after
- Apply it via language models by specifying context, objectives, response actions, examples, and verification needs.
Deep Learning with Python, Third Edition
The practice of crafting prompts to elicit better performance from a large language model on a task.
- How it is used
- Improves large language model performance by formulating prompts for particular tasks.
- How deep it goes
- Defines phrasing sensitivity, gives a riddle and instruction example, and stops short of a systematic prompt-design procedure.
- Examples
- Uses the Alice riddle, altered variable values, step-by-step instructions, and Python list sorting with a requested style.
- What you can do after
- Apply it via deliberate prompt variation and explicit instructions to improve task performance and test reliability.
Read how Deep Learning with Python, Third Edition explains prompt engineering →
Build an AI Agent (From Scratch)
Prompt engineering is the practice of designing prompts and instructions to elicit accurate or appropriately formatted outputs from a language model.
- How it is used
- Guides a general-purpose language model to act consistently as an agent across user requests.
- How deep it goes
- Defines user and system prompts and gives actionable guidelines for autonomy, clarification, and tool use.
- Examples
- Uses a weather-search request and sample instructions for acting on clear intent to illustrate agent behavior.
- What you can do after
- Operate/configure an agent by specifying when to act, clarify intent, and use tools proactively.
Read how Build an AI Agent (From Scratch) explains prompt engineering →
Local Image Generation
Prompt engineering is the iterative design and refinement of input prompts to influence the outputs of a generative model.
- How it is used
- Improves Stable Diffusion image generation by iteratively refining prompts, negative prompts, and related settings.
- How deep it goes
- Explains iterative practice, prompt clarity, reproducibility, and basic configuration, stopping short of a fully predictable formula.
- Examples
- Uses coffee prompts, explicit seeds, comparison images, negative prompts, checkpoint recommendations, and creator-provided prompt examples.
- What you can do after
- Apply it via AUTOMATIC1111 to generate, compare, reproduce, and refine Stable Diffusion images.
Read how Local Image Generation explains prompt engineering →
LLM Evaluation and Alignment, The Foundational Ideas
Prompt engineering is the deliberate design and refinement of instructions provided to a language model to influence its behavior.
- How it is used
- Aligns LLM-as-a-judge evaluations with explicit task definitions, criteria, examples, and domain preferences.
- How deep it goes
- Explains prompt components and refinement levers, but does not provide a complete implementation procedure.
- Examples
- Uses evaluator rubrics, correct-answer examples, G-Eval criteria, and document-only instructions with uncertainty responses.
- What you can do after
- Apply it via explicit rubrics and examples to improve evaluation consistency or reduce hallucinations.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains prompt engineering →
Build Financial Software with Generative AI (From Scratch)
Prompt engineering is the practice of designing clear, specific inputs that guide a language model toward useful responses.
- How it is used
- Guides requests to generative AI when developing and refining software requirements.
- How deep it goes
- Defines core prompt qualities and demonstrates iterative code refinement, but does not detail individual prompting techniques.
- Examples
- Uses ChatGPT-generated Python for reading, formatting, and returning a financial balance.
- What you can do after
- Apply it via ChatGPT to express software requirements and iteratively improve generated code.
Read how Build Financial Software with Generative AI (From Scratch) explains prompt engineering →
Investing for Programmers
Prompt engineering is the practice of designing and refining instructions and contextual inputs to obtain more useful outputs from an AI system.
- How it is used
- Improves LLM queries for financial research, especially due diligence and company scorecards.
- How deep it goes
- Defines specificity, context, examples, and investor profiles but stops short of a formal optimization workflow.
- Examples
- Uses investor profiles, company-management questions, and detailed investment inquiries instead of generic stock recommendations.
- What you can do after
- Apply it via detailed prompts that include goals, risk tolerance, tax residency, context, and reference examples.
Read how Investing for Programmers explains prompt engineering →
Rearchitecting LLMs
Prompt engineering is the deliberate design and adjustment of instructions provided to a model to influence its outputs.
- How it is used
- Shapes model responses for specialized tasks such as document analysis, report generation, coding, translation, and recommendations.
- How deep it goes
- Defines instruction adjustment and prompt chains, but stops short of changing underlying expertise or model architecture.
- Examples
- Uses financial-document extraction, client report generation, and investment recommendations as application examples.
- What you can do after
- Apply it through detailed instructions or prompt chains to shape responses while recognizing limits on specialization and differentiation.
AI Governance
Prompt engineering is the practice of designing and refining instructions supplied to a model to shape its responses or behavior.
- How it is used
- Shape model behavior for fairness and more consistent answers without retraining or infrastructure changes.
- How deep it goes
- Moves from specific instructions to structured outputs and optimization, while treating prompts as filters rather than guarantees.
- Examples
- Uses a liability instruction excluding age, gender, or postcode and structured eligibility outputs with defined fields and allowed values.
- What you can do after
- Apply it by writing testable instructions and output formats, then evaluate revisions with MLflow Prompt Optimization or Amazon Bedrock's prompt optimization feature.
WordPress Power Toolkit: Harness AI to build next-level websites
Prompt engineering is the practice of designing and refining instructions supplied to an AI system to influence its behavior and outputs.
- How it is used
- Improves AI requests for website planning, WordPress resource discovery, writing revision, and other multi-step tasks.
- How deep it goes
- Demonstrates combined techniques through complete prompts and iterative refinement, but notes that systems may not follow pause-and-wait instructions.
- Examples
- Uses Instant Pot website planning, WordPress resource selection, Claude prompt generation, and prose revision in a simple, clear style.
- What you can do after
- Apply it via Claude’s Generate a Prompt feature, then edit and test expanded instructions for a specific task.
Context Engineering
Prompt engineering is the practice of designing and refining inputs to a language model to influence the quality and character of its output.
- How it is used
- Guides LLM outputs by shaping user intent within a larger assembled context.
- How deep it goes
- Develops iterative design principles, prompting patterns, production safeguards, and adaptations for reasoning models.
- Examples
- Contrasts an underspecified question with a constrained definition request and uses product naming to illustrate task direction.
- What you can do after
- Apply prompt design through clear instructions, output formats, examples, task decomposition, testing, and refinement.
Fight Fraud with Machine Learning
Prompt engineering is the deliberate design and modification of inputs provided to a generative model to elicit desired outputs or behavior.
- How it is used
- Uses carefully written inputs to classify phishing emails, elicit explanations, and teach language models previously missed patterns.
- How deep it goes
- Explains output constraints, rationale requests, one-shot examples, and API use, but does not develop model internals or systematic evaluation.
- Examples
- Uses suspicious and genuine emails, a nonexistent emailinspector.net domain, yes-or-no prompts, explanations, and one-shot demonstrations.
- What you can do after
- Apply it via prompts or an API to classify emails, request rationales, and improve recognition of narrowly represented phishing patterns.
Read how Fight Fraud with Machine Learning explains prompt engineering →
Optimization Algorithms: AI techniques for design, planning, and control problems
An optimization approach that describes an optimization task in natural language and prompts a large language model to generate improved solutions or instructions.
- How it is used
- Uses natural-language descriptions of optimization tasks to enlist large language models as optimizers.
- How deep it goes
- Defines OPRO as simple and effective but does not provide implementation steps, parameters, or algorithmic internals.
- Examples
- Names maximum coverage, MaxCut, minimum vertex cover, SAT, TSP, and vehicle routing as application problems.
- What you can do after
- Evaluate natural-language optimization as an emerging machine-learning approach across benchmark optimization problems.
Also covered in
- Enterprise RAGIn early access (MEAP)
- Time Series Forecasting Using Foundation Models
- First-Party Data Activation
- Causal AI
- Designing AI SystemsIn early access (MEAP)
- Automating API Delivery
- Reinforcement Learning from Human Feedback
- AI Model EvaluationIn early access (MEAP)
- Spring AI in Action
- Data-Driven Cybersecurity
- Build High Value Software SystemsIn early access (MEAP)
- Data Storytelling with Altair and AI
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- tokenA token is a discrete unit of text, such as a word, subword, punctuation mark, or symbol, produced by tokenization and processed by a language model.
- contractA contract is an agreed specification of the conditions, expectations, rights, or obligations that govern behavior or interactions between parties or software components.
Related concepts
- promptuses · A prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- chain-of-thought promptingincludes · Chain-of-thought prompting is a technique that elicits or supplies intermediate reasoning steps to guide a model toward a final answer.
- fine-tuningcontrasts with · Fine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
- context engineeringcontrasts with · Context engineering is the deliberate selection, organization, and management of information supplied to an AI system to support effective task performance.
- casual promptingalternative to · An informal prompting approach based on ad hoc wording changes and subjective judgment rather than systematic specification and evaluation.
- demonstration optimizationcontrasts with · The selection or refinement of input-output demonstrations included in prompts to improve a language-model task.
Questions about prompt engineering
What is prompt engineering?
Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs.
Which Manning books explain prompt engineering?
Introduction to Generative AI, Second Edition, Coding with AI, LLMs in Production, AI for Everyday IT, Generative AI in Action, LLM Customization and Fine-Tuning, Knowledge Graphs and LLMs in Action, Natural Language Processing in Action, Second Edition and 43 more.
What should I know before learning prompt engineering?
Manning books that teach prompt engineering usually introduce language model, prompt, token and contract first.
What is the difference between prompt engineering and fine-tuning?
Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs. Fine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
What kinds of prompt engineering are there?
Kinds of prompt engineering include chain-of-thought prompting.
What is prompt engineering also called?
Prompt engineering is also called prompt design, prompting techniques, prompt optimization or prompt refinement.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


















































