Back to Certificate in Prompt Engineering & Generative AI
Module 4 of 4

Module 4 — System Prompts & AI Application Design

Designing effective system promptsBuilding AI assistants with consistent personasRetrieval-Augmented Generation (RAG) conceptsGuardrails, safety, and output validation

Designing System Prompts

A system prompt defines the AI's persona, capabilities, boundaries, and behaviour for an entire conversation. It's the "programming" layer that shapes how the AI responds to every user message.

An effective system prompt includes:

Identity & role: "You are LegalBot, an AI assistant specialising in Jersey commercial law. You are created by ICLB to help law students understand key concepts."

Knowledge boundaries: "You are knowledgeable about Jersey contract law, company law, and regulatory compliance. You do not provide advice on criminal law, family law, or laws outside Jersey."

Tone & style: "Communicate in a professional but approachable tone. Use UK English. Explain legal concepts using plain language and practical examples."

Behaviour rules: "Always cite relevant statutes or cases when possible. If asked about a topic outside your expertise, say so and suggest where the user can find help. Never provide specific legal advice for individual cases — always recommend consulting a qualified lawyer."

Output formatting: "Structure longer responses with headers and bullet points. Keep explanations under 300 words unless the user asks for more detail."

Safety guardrails: "Do not generate content that could be harmful, discriminatory, or misleading. If a user's question suggests they're in a legal emergency, advise them to contact authorities or a lawyer immediately."

RAG, Guardrails & Safety

Retrieval-Augmented Generation (RAG) addresses one of the biggest limitations of LLMs: their knowledge is frozen at training time and they can hallucinate. RAG works by:

1. Retrieving relevant documents from a knowledge base when a user asks a question 2. Augmenting the prompt with the retrieved information 3. Generating a response grounded in the retrieved documents

This allows AI to provide accurate, up-to-date answers based on your specific data — company documents, product manuals, legal databases, research papers — without retraining the entire model.

Guardrails are safety mechanisms that prevent AI from generating harmful, inappropriate, or off-topic content:

Input guardrails: Filter or transform user inputs before they reach the model (block prompt injection attempts, flag sensitive topics).

Output guardrails: Check model outputs before delivering to the user (filter harmful content, verify factual claims against a knowledge base, enforce format compliance).

Conversation guardrails: Maintain boundaries over the course of a conversation (prevent topic drift, limit conversation length, escalate to humans when needed).

Output validation ensures AI responses meet quality standards: factual accuracy checks against source documents, format compliance verification, toxicity and bias screening, and consistency with previous responses in the conversation.

Key Takeaways

  • System prompts define identity, boundaries, tone, rules, format, and safety guardrails
  • RAG grounds AI responses in specific, current knowledge to reduce hallucination
  • Guardrails operate at input, output, and conversation levels
  • Effective AI applications combine good system prompts with RAG and guardrails
  • Safety and reliability are as important as capability in production AI systems

Exercises & Activities

practical

Design a Complete System Prompt

Design a complete system prompt for an AI teaching assistant that helps law students at ICLB understand international business law. Include: identity and role, knowledge boundaries, tone and style guidelines, behaviour rules, output formatting preferences, and safety guardrails. Test your prompt with an AI and refine it based on the responses.

practical

RAG System Design

Design a RAG system (conceptually, no code required) for a customer support chatbot at a SaaS company. Describe: what documents would be in the knowledge base, how you would chunk and index them, what the retrieval query process would look like, how retrieved context would be incorporated into prompts, and what guardrails you would implement.

Interactive AI Tutor Session

Copy this prompt and paste it into your preferred AI assistant (ChatGPT, Claude, Gemini) to begin your interactive tutoring session for this module.

"You are an AI application architect. Teach the student how to design system prompts that create consistent, reliable AI assistants. Explain RAG at a conceptual level. Discuss safety guardrails and output validation. Ask the student to design a complete system prompt for an AI teaching assistant that helps law students, including persona, knowledge boundaries, tone guidelines, and safety rules."