Skip to main content

Claude Prompt to Build a Customer Support Chatbot with RAG

Build a support chatbot with RAG, ticket creation, sentiment-based handoff, and analytics. Full architecture for any product and stack.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Build a customer support chatbot for SaaS developer tool using Claude Haiku (fast) with Sonnet fallback (complex). Features: 1) RAG pipeline with help docs, FAQ, past resolved tickets as knowledge base (chunking strategy, embedding model, retrieval), 2) Conversation flow: greeting → understand issue → search knowledge → respond or escalate, 3) Ticket creation integration with Linear when issue cannot be resolved, 4) Sentiment detection — escalate to human when frustration detected, 5) Multi-turn context management (remember customer details, previous issues), 6) Canned response templates for billing questions, API errors, account access, feature requests with personalization, 7) Human handoff protocol with context summary for the agent, 8) Analytics tracking: resolution rate, avg turns to resolve, escalation rate, CSAT, 9) Safety guardrails: no PII leakage, no unauthorized actions, stay on topic, 10) A/B testing framework for different response strategies. Implement with TypeScript and Next.js with Vercel AI SDK. Include deployment architecture diagram.

What this prompt does

This prompt designs a customer support chatbot for [product_type] on [model_provider], grounded in a retrieval pipeline over [knowledge_source]. It specifies the full lifecycle: a RAG pipeline with chunking and retrieval, a greeting-to-resolution conversation flow, ticket creation in [ticket_system] when the bot cannot resolve an issue, and sentiment-based escalation to a human.

The structure works because it treats honest handoff as a first-class feature, not a fallback. By forcing the design to define when to escalate, how to summarise context for the human agent, and which [common_issues] get canned templates, it produces a bot that knows its limits. The safety guardrails step — no PII leakage, no unauthorized actions, stay on topic — is what keeps the bot from confidently inventing answers, which is worse than no bot at all.

Multi-turn context management is the other half of feeling competent. The bot remembers customer details and previous issues within a conversation, so users are not forced to repeat themselves, and the analytics layer (resolution rate, average turns, escalation rate, CSAT) gives you the numbers to tell whether it is genuinely helping. The A/B testing framework lets you compare response strategies on real traffic instead of guessing which phrasing resolves issues faster.

When to use it

  • You are adding a support bot to [product_type] and want RAG grounding instead of an ungrounded model that hallucinates.
  • You need clean human handoff with a context summary so agents are not starting cold.
  • You want sentiment detection so frustrated users get escalated rather than stuck in a loop.
  • You need ticket creation wired into [ticket_system] for issues the bot cannot close.
  • You want analytics (resolution rate, escalation rate, CSAT) defined up front, not bolted on later.

Example output

Expect an end-to-end design: a RAG pipeline description with chunking and retrieval strategy, a conversation flow diagram from greeting to resolution or escalation, the [ticket_system] integration contract, sentiment-based handoff logic, and a deployment architecture diagram. It usually includes the guardrail rules and the analytics schema for resolution and CSAT tracking.

Pro tips

  • Be specific in [knowledge_source]. "Help docs, FAQ, and past resolved tickets" retrieves far better than a vague "our documentation."
  • Use a fast model for [model_provider] on simple turns with a stronger fallback for complex ones, as the default suggests, to balance cost and quality.
  • List [common_issues] concretely so the canned-response templates actually cover your real ticket volume.
  • Tune the sentiment-escalation threshold carefully; escalating too eagerly defeats the bot, too late frustrates users.
  • Treat the PII and stay-on-topic guardrails as non-negotiable — a support bot leaking data or going off-script is a liability.
  • Match [ticket_system] to what your team already uses so handoff lands where agents work, not in a new silo.
  • Personalize the canned templates with customer context so they read as answers, not robotic boilerplate.
  • Use the A/B framework to validate response strategy changes on real traffic before rolling them out to everyone.

Frequently Asked Questions

Does the chatbot make up answers when the docs do not cover an issue?
The design is built specifically to avoid that. When retrieval over `[knowledge_source]` does not surface a confident answer, the flow escalates to a human or creates a ticket rather than inventing a response. Grounding answers in retrieved sources is the whole point of the RAG pipeline.
How does the bot decide when to hand off to a human?
Two triggers: the issue cannot be resolved from the knowledge base, or sentiment detection flags frustration. On handoff it passes a context summary so the human agent does not start from scratch, which keeps the experience smooth for the customer.
Can I plug in a different ticketing tool than the default?
Yes. The `[ticket_system]` variable is open, so you can target whatever your team uses. The prompt designs the integration contract generically, though the actual API calls and field mappings will need adapting to your specific ticketing platform.
What analytics does this chatbot track?
Resolution rate, average turns to resolve, escalation rate, and CSAT are all specified in the design. Defining these up front matters because without them you cannot tell whether the bot is genuinely helping users or quietly frustrating them before handoff.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AI Chatbot & Agent Building Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support