chapter six

6 User prompts for LLMs

 

This chapter covers

  • User prompt as the immediate user intent
  • How to design effective user prompts
  • Prompting techniques, frameworks, and tools

Chapter 1 introduced context engineering and the six context sources that LLM-based systems supply to the model. This chapter focuses on the sixth source, user prompts, which express immediate user intent and guide the model toward a specific outcome. The following sections present core design principles, established prompting techniques, reusable frameworks, and development tools for engineering reliable prompts.

6.1 User prompt

The user prompt is the most direct source of context. It represents the specific question or task a user provides to the LLM at any moment. While crafting a basic query may seem straightforward, designing an effective prompt (a discipline often called prompt engineering) is a foundational skill in context engineering.

A well-designed prompt functions less like a casual query and more like a specification document, with defined goals, parameters, and expectations that leave the model less room to guess. Consider the contrast between the following prompts:

What is context engineering?

This prompt is syntactically valid but underspecified: it provides no guidance on audience, depth, scope, or emphasis, leaving the model to guess the user’s intent. Now compare it with the following refined prompt:

6.2 Best practices for prompt design

6.2.1 Core design principles

6.2.2 Production considerations

6.3 Prompting techniques

6.3.1 Role prompting

6.3.2 Few-shot prompting

6.3.3 Chain-of-thought prompting

6.3.4 ReAct prompting

6.3.5 Prompt chaining

6.3.6 Other prompting techniques

6.3.7 Prompting and reasoning models

6.4 Prompt frameworks

6.4.1 10-step prompt structure

6.4.2 Lightweight frameworks

6.5 Prompting tools

6.6 Hands-on

6.6.1 Few-shot ticket normalizer

6.6.2 Prompt chaining for support replies

6.6.3 Prompting with DSPy: CoT vs ReAct