Menu
Coddy logo textTech

Setting Rules and Constraints

Part of the Fundamentals section of Coddy's AI Prompts journey — lesson 19 of 23.

Beyond personality, the system prompt is perfect for setting rules and constraints—things the AI must always do or never do, regardless of what the user asks.

Consider this system prompt:

Never provide medical diagnoses. If asked about symptoms, always recommend consulting a healthcare professional.

Now the AI has a hard rule. No matter how the user phrases their question, the AI won't play doctor. This constraint applies to every message in the conversation.

You can stack multiple rules together:

You are a customer service assistant for a software company.
- Always respond in 3 sentences or fewer.
- Never discuss competitor products.
- If you don't know something, say "I'll need to check on that" instead of guessing.

Each rule shapes behavior in a specific way. The AI now has boundaries it respects throughout the conversation—length limits, topic restrictions, and honesty guidelines all baked in.

This is different from putting constraints in your user prompt. In the user prompt, you'd need to repeat "keep it under 3 sentences" every time.

In the system prompt, you set it once and it sticks. The system prompt acts like a persistent rulebook that governs every exchange.

Think of rules as guardrails. They keep the AI on track without you having to micromanage each response.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals