← All guides

CASE STUDY Claude Code Business

Build a RAG coach for your community

How I shipped a chatbot that answers only from my community's own courses, with magic-link login and daily spend caps. Live in production.

The problem

Every community owner hits this: members ask questions the courses already answer. A generic chatbot does not fix it, because it answers from the open internet and confidently makes things up about your material. And the moment you give members an AI that costs money per message, one heavy user can quietly eat your margin.

What I built

Genie Coach, a chatbot for my Skool community, built with Claude Code and live in production. Members sign in with a magic link that is checked against a member allowlist, so strangers cannot get in. Every answer is grounded in my own content: I exported all 10 of my courses (92 pages, about 1,100 chunks) into a vector index, and the bot retrieves the relevant chunks before it writes a word. Answers cite the exact course sections they came from.

The architecture is three plain pieces:

  1. Supabase: auth, the member allowlist, and a usage table that records every message and its cost.
  2. A vector index of the course content, re-ingested whenever I edit a course.
  3. An edge function that checks the member, checks their daily cap, retrieves, then answers with citations.

Lesson 1: ground everything

My first bug report to myself was “RAG is not working”. It was working. One conversation route (coaching questions like “what should I learn first?”) skipped retrieval by design and answered generically. Members cannot tell a grounded answer from a confident guess, so now every route retrieves first. A typical grounded message costs me about $0.025.

Lesson 2: cap spend per user from day one

Caps live in the database and are checked before generation, not after. Each member gets a daily message limit and a daily dollar cap by tier: $0.30, $0.60, or $1.00 per day. Before the caps were tier-aware, one maxed-out member on my 9 euro tier could have cost me around $30 a month. Now the worst case is roughly what they pay.

If you build one thing from this guide, paste this into Claude Code:

Build a members-only RAG chatbot for my community.
Rules:
- Every answer must first retrieve from a vector index of my
  own course content, then cite the sections it used.
- Sign-in by magic link, checked against a member allowlist
  in the database.
- Enforce per-member daily caps in the database BEFORE calling
  the model: a message limit and a dollar limit per membership
  tier. Reserve the estimated cost first, reconcile the real
  cost after.

Do this now

  1. Export your course content to markdown or JSON. That corpus is the whole moat.
  2. Decide your per-member daily dollar cap before writing any code. Mine is $0.30 to $1.00 by tier.
  3. Paste the prompt above into Claude Code and build the first version against a test member.

Want to build this yourself?

Join Claude Code Academy, my free community. Courses, build alongs, and builders turning AI into real systems. And I post a new build on Instagram nearly every day.