A system prompt is the most important piece of code in any LLM-powered application. It is the interface contract between your intent and the model's behavior. It defines personality, sets boundaries, specifies output formats, and handles the edge cases that separate a demo from a production system. Yet most system prompts are written as afterthoughts -- a paragraph of instructions tacked onto the beginning of a conversation and never revisited.
This article dissects a production-grade system prompt section by section. We will examine eight distinct components, explain why each exists, show real code examples, and identify the failure modes that emerge when any section is missing or poorly written. By the end, you will have a mental model for structuring system prompts that holds up under the pressure of real-world inputs.
The prompt we are dissecting is for a hypothetical code review assistant -- a tool that analyzes pull requests and provides structured feedback. This is a realistic production use case with enough complexity to exercise every section of a well-designed system prompt.