The 60-Minute Chatbot · Lesson 2 of 5

Lesson 2 — The Brain

> 8 minutes · write the system prompt that makes the chatbot *yours*

This is the most important lesson in the course. The actual code is 80 lines and you could write it in 20 minutes if you were copying from a textbook. The thing that turns "I called an AI API" into "I built a chatbot for an HVAC company" is the system prompt.

A system prompt is the instructions you give the AI *before* the customer ever talks to it. It defines:

  • Who the AI is pretending to be — not just a name, but a role and a tone
  • What it's allowed to know about — versus what's outside its job
  • How it should behave when it doesn't know something
  • The hard rules — never invent prices, always escalate emergencies, etc.

If you skip this and just hand the API a customer question, you'll get back a long, hedging, "as an AI language model…" answer that won't sell anything to anyone. The system prompt is the entire difference between a demo people remember and a demo people delete.

---

Open `server/index.js`

You'll see two big string blocks at the top of the file. Let's look at the second one first — `SYSTEM_PROMPT`. Read it now. We'll walk through every choice.

```js const SYSTEM_PROMPT = ` You are the friendly virtual receptionist for Comfort Zone Heating & Cooling, a small family-owned HVAC company in Scranton, Pennsylvania. Your job is to answer questions from homeowners, give straightforward pricing where you can, and help people decide whether to call us, request a quote, or book a service visit. ... `.trim() ```

Why we said "virtual receptionist"

Not "AI assistant." Not "chatbot." Receptionist. That word does work the chatbot doesn't have to do — it sets a tone (friendly, helpful, screening), implies a job (route calls, answer FAQs), and gives Claude a reference for how to talk. Models trained on a lot of human writing know what receptionists sound like. They don't really know what "AI assistants" sound like besides other AI assistants.

Try this on your own bots: instead of "you are a helpful AI," tell it the human role you want it to play. *"You're the dispatcher at a 24-hour towing service."* *"You're the front-of-house manager at a fine dining restaurant."* The change in tone is dramatic.

Why "concise. 2–4 sentences usually."

Because Claude — like every chat model — defaults to long. If you don't tell it otherwise, you'll get five-paragraph essays in response to "what time do you close?" That's bad UX and it's expensive (more output tokens = more cost). Telling it the format you want gets you 80% of the way there with no extra logic.

Why "never invent prices, hours, or service details"

Because models hallucinate. If you ask a base model "how much does Comfort Zone charge for a tune-up?" it will *make up a number*. It doesn't know it's making something up — it's just predicting what a plausible answer looks like.

The fix is two-part:

  • Give it a hard rule: *never* invent these specific things
  • Give it the actual facts in a structured block (we're doing this next)

These two together get you 95%+ accuracy on factual questions. The remaining 5% is when someone asks a question the facts don't cover, and the rule kicks in: "I don't know — let me have someone follow up."

Why "for emergencies, tell them to call the 24/7 line right away"

Because *no chatbot should be the only line of defense for an emergency.* You're building a screening layer, not a replacement for human judgment. Bake the safety rule into the prompt so it's not optional.

---

Now look at `BUSINESS_FACTS`

```js const BUSINESS_FACTS = ` Comfort Zone Heating & Cooling

  • Service area: Scranton, PA and the surrounding Lackawanna County
  • Hours: Mon–Fri 7:30am–6:00pm · Sat 8:00am–2:00pm · 24/7 emergency line
  • Phone: 570-555-0142
  • Services: HVAC repair, new system install, annual tune-ups, indoor air quality
  • Pricing: Service call $89 · Tune-up $129 · New furnace install starts at $4,200
  • Brands serviced: Carrier, Trane, Lennox, Rheem, Goodman, and most others
  • Financing: Yes, through Wells Fargo Home Projects (subject to credit approval)
  • Same-day service: Usually available if you call before 11am
  • We do NOT: handle commercial chillers over 25 tons, or duct cleaning

`.trim() ```

Notice three things about how this is written:

  • Bullets, not paragraphs. Models pick out structured info from bullets way more reliably than from prose.
  • Be specific. "$89" not "around $89." Specific numbers get repeated; fuzzy ranges get mangled.
  • Negative space matters. *"We do NOT: handle commercial chillers."* Telling the model what you *don't* do is just as important as what you *do*. Otherwise it'll make up an answer when someone asks about it.

This 12-line block is essentially a "knowledge base" — but it's so small it lives right inside the prompt. In a later course we'll show you what to do when this block grows past a thousand lines (RAG — retrieval augmented generation). For now, this is enough.

---

What you've just learned
  • A system prompt sets the role, tone, rules, and safety policies of the bot
  • A facts block is a structured list of what the bot is allowed to know
  • Together, they're 80% of what's usually called "prompt engineering"

You haven't run the bot yet. We're about to. Move to Lesson 3 — we'll wire up the Express server, the API call, and see this whole thing come to life.

Previous: Lesson 1 — Setup · Next: Lesson 3 — The Wiring