Building your first chatbot logic
System prompts are your product. This is where you actually design AI behavior.
The system prompt is your product
Most people think building an AI chatbot means writing thousands of lines of code. It doesn't. The most important work happens in the system prompt — a few paragraphs of plain English that define exactly how your AI behaves. Good system prompt engineering is the difference between a generic chatbot and a specific, valuable tool.
Your system prompt is where you design the product. The code just sends it to the model and displays the response.
The anatomy of a good system prompt
A strong system prompt has four parts: Role, Context, Rules, and Format. Each part does a specific job. Together they turn a general-purpose LLM into a specialized, reliable tool.
Four parts of a system prompt
- Role — Who is the AI? (e.g., 'You are a customer support specialist for a fitness app')
- Context — What does the AI need to know? (e.g., 'The app helps users track workouts and nutrition')
- Rules — What should and shouldn't it do? (e.g., 'Never recommend medical treatments. Always suggest consulting a doctor for injuries')
- Format — How should it respond? (e.g., 'Keep responses under 3 sentences unless asked for detail')
A real example: coffee shop support bot
ROLE:
You are a friendly customer support assistant for Brew & Co, a specialty coffee shop.
CONTEXT:
Brew & Co is open Monday–Saturday 7am–6pm.
We serve espresso drinks, pour-overs, and seasonal specials.
Our most popular drink is the Honey Lavender Latte.
We do not offer Wi-Fi. We have outdoor seating.
RULES:
- Only answer questions related to Brew & Co
- If asked about competitors, politely redirect to our menu
- For complaints, apologize sincerely and offer to pass feedback to the manager
- Never make up information — say "I'm not sure, let me find out" if you don't know
FORMAT:
Keep responses conversational and warm. 2-3 sentences maximum unless explaining a menu item.Why specificity wins
The more specific your system prompt, the more valuable your chatbot becomes. A generic 'helpful assistant' system prompt produces generic results. A precisely tuned 'customer support bot for a fitness app that specializes in beginner-friendly workout plans' system prompt produces a tool that people will actually pay for.
Choose a real business or use case you understand. It could be your own job, a side project, or a business you admire. Write a system prompt for a chatbot that would help that business. Use the four-part structure: Role, Context, Rules, Format. Then test it in MG AI by copy-pasting the prompt at the start of your conversation.