chapter two

2 Prompt Design: Structural Elements

 

This chapter covers

  • The core Structural Elements of prompts: Instructions, Constraints, Context, Input Parameters, Output Format, and Delimiters
  • Applying falsifiable constraints that bound the solution space independent of task definition
  • Using input parameters replaced before inference to inject dynamic context and enable reuse
  • Specifying the required output structure to make responses consistent and predictable
  • Using delimiters as boundary markers to separate contextual content from instructions
  • Combining these elements to build reliable, structured prompts for specific tasks

Most prompts start as a single block of text. The task, the background, the variable inputs, the expected output shape, all in one place with no clear boundaries. The model has to infer what is an instruction, what is context, what is content to act on, and what the output should look like. When the output is wrong, there is no clear place to look.

2.1 Overview of Structural Elements

2.2 Instructions

2.2.1 Practical Example 1: Explaining HTTP 429 Errors

2.2.2 Practical Example 2: Generating Code Review Feedback

2.3 Constraints

2.3.1 Practical Example: Writing Secure Logging Guidelines

2.4 Context

2.4.1 Practical Example 1: Generating an Architecture Decision Record (ADR) Summary

2.4.2 Practical Example 2: Generating an Incident Handoff Conversation

2.5 Input Parameters

2.5.1 Practical Example 1: Analyzing Error Logs

2.5.2 Practical Example 2: Generating Release Notes

2.6 Output Format

2.6.1 Practical Example 1: Generating a Deployment Checklist

2.6.2 Practical Example 2: Generating an API Endpoint Summary

2.7 Delimiters

2.7.1 Practical Example 1: Summarizing an Incident Report

2.7.2 Practical Example 2: Answering Questions from a Runbook

2.7.3 Defensive Prompting Tip

2.8 Combining Structural Elements

2.8.1 Practical Example 1: Generating Incident Status Updates

2.8.2 Practical Example 2: Generating a Deployment Go/No-Go Brief

2.8.3 Hands-On Practice

2.9 Summary