---
title: "Prompt engineering"
slug: "prompt-engineering"
category: "prompt-engineering"
tags: ["moc", "prompt-engineering", "llm", "prompts", "few-shot", "evals", "best-practices"]
status: "stable"
last_updated: 2026-05-15
summary: "Prompt engineering hub: seven strategies for LLM prompts, plus deep-dives on templates, evals, defense, reasoning models, chains, and caching."
---

> The discipline of designing LLM inputs so outputs are accurate, structured, and repeatable. Start with [[best-practices]], then read the deep-dives by topic.

## Start here

- [[best-practices]]: The seven strategies that converge across Palantir Foundry AIP, OpenAI, Microsoft Foundry, and Google Vertex AI. Read this first.
- [[glossary]]: Comprehensive prompt-engineering glossary in question form (PAA-eligible). Every term grouped by category and linked to the deep-dive.

## Patterns

How to structure a prompt for production use.

- [[context-engineering]]: Assemble, order, and budget the full context window, not just the prompt; the superset discipline for real LLM applications.
- [[system-prompt-design-patterns]]: Reusable structures for the system prompt: role and task framing, layered sections, constraints, output contracts, and versioning.
- [[prompt-templates]]: Reusable template shapes with placeholders for instruction, primary content, examples, and constraints.
- [[output-constraints]]: Specify length, format, schema, and exclusions so the output is parseable.
- [[prompt-chaining]]: Multi-step prompt sequences when one prompt would overload the model.
- [[reasoning-model-prompting]]: When and how to prompt reasoning-tuned models (Claude thinking, o-series) differently from chat models.

## Production hardening

What to do before a prompt ships to users.

- [[prompt-evals]]: Build an eval set, regression-test prompts on every change, ship only when the threshold passes.
- [[prompt-engineering/prompt-injection-defense]]: Detect and mitigate prompt injection from user input, retrieved documents, and tool output.
- [[prompt-caching-strategies]]: Structure prompts so cacheable prefixes are stable across requests, maximizing cache hit rate.

## Deep-dives moved into this category

These were originally in `ai-agents/` and now live here. Cross-category complements stay in `ai-agents/`.

- [[prompt-engineering/chain-of-thought]]: Chain-of-thought scaffolds for reasoning-sensitive tasks.
- [[prompt-design]]: The end-to-end prompt-design loop.

## Related in ai-agents

- [[ai-agents/structured-output]]: JSON mode and tool-use prompts for parseable output.
- [[ai-agents/rag]]: Retrieval-augmented generation patterns.
- [[ai-agents/mcp-servers]]: Model Context Protocol for tool wiring.

## Glossary anchors

Atomic definitions for the prompt-engineering vocabulary.

- [[glossary/structured-prompt]]: A prompt with explicit sections (instruction, context, examples, format).
- [[glossary/role-priming]]: Assigning a role to anchor tone and depth.
- [[glossary/system-message]]: The stable, role-and-policy prompt sent on every turn.
- [[glossary/few-shot-prompting]]: Including worked examples in the prompt.
- [[glossary/temperature]]: The decoding-randomness parameter.
- [[glossary/context-window]]: The token budget the model can attend to.
- [[glossary/prompt-injection]]: Adversarial input that overrides instructions.
- [[glossary/tool-use]]: Calling external functions from within a prompt.

## Related MOCs

- [[ai-agents/index|AI Agents]]
- [[writing/index|Writing]]
- [[howto/index|How To]]
- [[glossary/index|Glossary]]
