Prompt Design Strategy: 10 Practical Examples by Scenario (Contracts, Templates, Guardrails)
Introduction TL;DR: Pick the scenario first (summarize, extract, classify, generate, agent), then attach an output contract, constraints, and validation rules. Each example below uses System/Developer/User layering, a strict output format, and a sample “expected output shape”. Why it matters: Contracts and validation reduce variance more than “clever wording”. 1) Document Summarization with Preservation Rules Prompt template 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [SYSTEM] You are a technical editor. Never guess; say "unknown" when unsupported. [DEVELOPER] Goal: Summarize the document. Constraints: - Max 7 sentences - Preserve numbers/dates/proper nouns verbatim - No speculation Output (Markdown): ## Summary - ... ## Key Facts - ... ## Open Questions - ... [USER] <document text> Example output shape 1 2 3 4 5 6 7 8 9 ## Summary - The document describes a change announced on 2025-12-01. - It affects 3 API v2 endpoints and 1 auth change. ## Key Facts - Token TTL changed from 3600s to 1800s. ## Open Questions - Deployment region is not specified in the document. Why it matters: “Shorter” alone increases hallucinations; preservation + unknown-policy keeps it safe. ...