Few-Shot Prompting Examples That Ship (2026)
Five copy-paste few-shot prompting examples that ship: classification, JSON extraction, tone matching, refusal, and format locking, plus the shot-count and label-bias traps.
Author
Sam Q. writes terse, tested prompt recipes for PromptAttic. Senior engineer energy, commit-message prose.
Five copy-paste few-shot prompting examples that ship: classification, JSON extraction, tone matching, refusal, and format locking, plus the shot-count and label-bias traps.
Five paste-ready role prompting recipes for 2026: domain expert, audience, format contract, adversary, and voice, each with its failure mode.
Five paste-ready prompt chaining recipes for 2026: extract-then-reason, draft-critique-rewrite, route, map-reduce, and generate-then-gate, each with its failure mode.
Four prompt-layer defenses against prompt injection that measurably help, three that are theater, and the one architecture rule that actually keeps you safe. With paste-ready prompts and each failure mode.
Five copy-paste few-shot prompting recipes for July 2026: lock output format, tone, labels, and edge cases. Each with the prompt and the exact case where it breaks.
Extended thinking changed in July 2026: on Claude Sonnet 5 and Opus 4.8 you use adaptive thinking and effort, not budget_tokens. Three recipes and the gotchas.
Three production Claude tool use recipes tested on Sonnet 4.6, Opus 4.7, and Haiku 4.5 with current pricing. Plus the two failure modes nobody warns you about. June 2026.
Three production-grade Claude structured output recipes for June 2026. Invoice extraction on Sonnet 4.6, support triage on Haiku 4.5, NL to SQL on Opus 4.7. Real cost per call. Three failure modes the docs do not warn you about.
Wrap a good prompt in one route handler: validate input, call the model, validate output, return typed JSON. No agent framework, no vector DB, no queue. A prompt plus a POST endpoint is a shippable feature. Add the rest only when a real user complains. Ship the prompt, not the platform.
Before you ship a generated answer, run one cheap second call that checks it against the source. Ask: is every claim in the answer supported by the provided context? Get back yes/no plus the first unsupported claim. Reject on no. Five lines of glue, catches the bulk of confident fabrications.
Route every call to Haiku 4.5 first. Ask it one thing: can you answer this with high confidence? If yes, ship its answer. If no, replay the same request to Opus 4.7. You pay premium tokens only on the hard 10–20%. Net cost drops ~70% with no quality loss on easy traffic.