{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreicozcjnvn3rklhy4ookgzdkicn6fm5hibea4e3j2jf3vrhsxpbmii",
    "uri": "at://did:plc:5sgu76a53rz3n6unbykmovqy/app.bsky.feed.post/3mm33hf5e4r72"
  },
  "description": "Prompt engineering is the discipline of communicating effectively with large language models. Because LLMs are trained to predict plausible continuations of text, how you frame a request has an enormous impact on what you get back, the same underlying model can behave like an expert assistant or produce generic noise depending on prompt quality.\n\n\nFoundational Techniques\n\n\nZero-Shot Prompting\n\nAsk the model directly with no examples. Works for tasks the model has seen frequently in training: sum",
  "path": "/engineering-glossary/prompt-engineering/",
  "publishedAt": "2026-05-17T19:20:55.000Z",
  "site": "https://sahilkapoor.com",
  "tags": [
    "System Prompt",
    "Cursor",
    "Windsurf",
    "Langchain",
    "Mcp Model Context Protocol",
    "Tokenization"
  ],
  "textContent": "Prompt engineering is the discipline of communicating effectively with large language models. Because LLMs are trained to predict plausible continuations of text, how you frame a request has an enormous impact on what you get back, the same underlying model can behave like an expert assistant or produce generic noise depending on prompt quality.\n\n## Foundational Techniques\n\n### Zero-Shot Prompting\n\nAsk the model directly with no examples. Works for tasks the model has seen frequently in training: summarization, translation, common classification tasks. Breaks down for specialized, ambiguous, or novel tasks.\n\n### Few-Shot Prompting\n\nProvide 2–10 examples of input→output pairs before the real query. Dramatically improves consistency for formatting, tone, and domain-specific tasks. The examples function as in-context training.\n\n### Chain-of-Thought (CoT)\n\nAsk the model to \"think step by step\" before giving an answer. Adds intermediate reasoning steps that improve accuracy on math, logic, and multi-step problems. \"Let's think step by step\" is one of the highest-ROI prompt additions for reasoning tasks.\n\n### Role Prompting\n\nAssign an expert persona: \"You are a senior security engineer reviewing code for vulnerabilities.\" This activates relevant knowledge and sets the expected tone and depth.\n\n### Structured Output\n\nRequest JSON, markdown tables, or specific formats. Pair with model-native JSON mode (supported by most API providers) for reliable parsing in downstream code.\n\n## System Prompts\n\nIn chat-based APIs, the System Prompt is separate from the user turn, it persists across the conversation and sets persistent instructions. Well-written system prompts include: persona, capabilities, constraints, output format, and relevant context.\n\n## Prompt Engineering in AI Tooling\n\nAI editors like Cursor and Windsurf let you define project-level rules that become part of the system prompt. Langchain uses prompt templates to parameterize prompts. Mcp Model Context Protocol exposes \"prompts\" as a primitive that servers can serve to clients.\n\n## Common Pitfalls\n\n  * **Vague instructions** , \"write a summary\" vs \"write a 3-sentence summary for a non-technical audience\"\n  * **No output format** , model invents format; downstream parsing fails\n  * **Prompt injection** , untrusted user input that overrides your instructions\n  * **Context bloat** , stuffing too much irrelevant context wastes the context window and degrades focus\n\n\n\n## Related Terms\n\n  * System Prompt, the persistent instruction layer in a conversation\n  * Langchain, framework with built-in prompt template abstractions\n  * Mcp Model Context Protocol, exposes prompt primitives for AI tools\n  * Tokenization, understanding tokens helps reason about context window limits\n\n",
  "title": "Prompt Engineering",
  "updatedAt": "2026-05-18T20:04:00.926Z"
}