No history yet

Structural Frameworks

Architecting Better Prompts

Writing a simple, one-sentence prompt is like asking a friend to grab you a coffee. It usually works. But asking an AI to perform a complex business task requires more than a casual request. It demands an architectural plan.

Well-structured prompts don't just ask, they instruct. They provide a clear blueprint that separates instructions from data, defines expectations, and removes ambiguity. This is the shift from writing sentences to designing systems.

Structuring the prompt with clear delimiters, such as triple backticks (```), XML tags (content), or distinct headings, significantly aids the model in distinguishing between instructions, contextual information, and input data.

Think of a prompt not as a single block of text, but as a container with labeled compartments. Delimiters are the walls of these compartments. They signal to the model where one type of information ends and another begins. The most common delimiters are triple backticks, XML-style tags, and Markdown headers.

### INSTRUCTIONS ###
Summarize the following customer review into three bullet points, focusing on product quality and delivery speed.

### CUSTOMER REVIEW ###
I ordered the X-1 model, and while it arrived two days early, which was great, one of the main components was cracked. The support team was helpful, but I had to wait another week for a replacement part. The product itself works perfectly now, but the initial experience was frustrating.

### OUTPUT FORMAT ###
- Point 1
- Point 2
- Point 3

In this example, ### acts as a delimiter. The model can clearly see the boundaries between the task, the raw data it needs to process, and the required output structure. This prevents what's known as instruction drift, where the model gets confused midway through a long prompt and starts treating your instructions as part of the text to be analyzed.

Frameworks for Consistency

To ensure you cover all your bases, especially in complex prompts, you can use a structural framework. These are like checklists that help you build comprehensive, reusable prompts that consistently produce high-quality results. Two popular frameworks are CO-STAR and TRACI.

FrameworkComponentDescription
CO-STARContextProvide background information and set the scene.
ObjectiveState the specific goal or task to be accomplished.
StyleDefine the writing style (e.g., formal, casual, academic).
ToneSpecify the emotional tone (e.g., optimistic, neutral, empathetic).
AudienceDescribe the intended reader of the output.
ResponseDefine the desired format (e.g., JSON, bullet points, a paragraph).
TRACITaskThe main action to be performed.
RoleAssign a persona to the AI (e.g., "Act as a senior marketing analyst").
AudienceWho is the output for?
CreateThe final artifact to be generated.
IntentThe underlying purpose or desired outcome of the task.

You don't need to use every component of a framework in every prompt. They are guides, not rigid rules. The goal is to be deliberate and explicit about your requirements.

Defining Output Contracts

When you're using an LLM as part of a larger software application, getting a predictable output is critical. A beautifully written paragraph is useless if your program is expecting structured data. This is where you define a strict output contract.

An output contract is a non-negotiable part of your prompt that tells the model exactly how to format its response. This is essential for API integrations, where data needs to be parsed programmatically.

<prompt>
  <role>You are a helpful assistant that extracts information from text and provides it in a structured JSON format.</role>
  
  <context>The user will provide an unstructured block of text containing contact information.</context>
  
  <task>Extract the person's full name, email address, and phone number from the text provided below.</task>
  
  <input_text>
    Reach out to Jane Doe at jane.doe@email.com. Her cell is 555-123-4567 for urgent matters.
  </input_text>
  
  <output_contract>
    Provide your response as a JSON object with the following keys: "fullName", "email", and "phoneNumber". Do not include any other text or explanation outside of the JSON block.
  </output_contract>
</prompt>

This prompt uses XML tags for hierarchy and a clear <output_contract> section. It leaves no room for interpretation. The application receiving this response can reliably expect a clean JSON object, making the entire workflow more robust and less prone to errors.

Time to check your understanding of these structural concepts.

Quiz Questions 1/5

According to the text, what is the fundamental shift in thinking when moving from simple to complex AI prompts?

Quiz Questions 2/5

What is the primary purpose of using delimiters like ### or <example_tag> in a prompt?

By moving from simple requests to architected prompts, you gain precision, consistency, and the ability to integrate AI into automated systems reliably.