Talk to me

How do I use RAG when I code?

A short learning video. A renovation company owner who builds her own booking app with AI, and a software engineer who shows her where the AI should look before it writes code.

Video. A software engineer shows a business owner who builds her own app with AI where the AI should look things up before it writes code. 2 min 41 s, two voices, quiet music. Read the article.

What this video shows

Nora does not read every line her AI coding tool writes. One night it adds a login check that looks right, and her booking app stops working. Sam explains why: the AI learned her web framework on its training day, and the framework renamed that file later. The AI wrote it the old way and sounded sure about it.

The fix is to let the AI look things up before it writes. That is what RAG means (the one-minute video “What is RAG?” shows the idea with a shelf of files). When you code, there are four places to look. Your agent already searches your code. Sam adds the docs for the exact version she uses, one short rules file the agent reads first, and her tickets and notes, connected read-only. Then Nora asks the question that makes every answer easy to check: which file did you use? The article has the setup blocks, the pitfalls and six steps for one afternoon: read the article.

What you will learn

  • Your coding agent already uses RAG when it searches your files before it writes.
  • Why an AI writes old code for a library that changed after its training.
  • The four places an agent can look: your code, today’s docs, your team’s rules, your tickets and wiki.
  • Three things that make it worse: too much text, keys within its reach, and write access too early.

If you want this set up for your team, or a RAG feature in an app you are building, see how I can help or tell me about your project.

Transcript

0:03 Nora: How do I use RAG when I code?

0:07 Sam: You already do. Your coding agent searches your code before it writes. That is RAG.

Sam: Now give it three more places to look: today’s docs, your team’s rules, and your tickets. Then ask which file it used.

0:23 Nora: I build my booking app with AI, and I don’t read every line.

Nora: Last night it wrote a login check. It looked right. And the app broke.

0:32 Sam: The AI learned your web framework on its training day. Then the framework changed. The new version renamed the file it wrote.

Sam: So it wrote the old way, and it sounded sure.

0:45 Sam: RAG means: look it up first, then answer. When you code, there are four places to look.

Sam: Your code. Today’s docs. Your team’s rules. Your tickets and your wiki.

0:59 Sam: The first place, your agent already uses. It searches the files, reads a few, and searches again.

Nora: So that is RAG too?

Sam: Yes. The answer comes from your code.

Sam: Some tools keep an index and search by meaning. Others search for the exact words, like you would. Both find your code first.

1:20 Sam: Second, today’s docs. Add a docs server, and the agent reads the docs for your exact version.

Nora: This time the login check worked.

1:30 Sam: Third, one short rules file. Your commands, your rules, and where things are. The agent reads it first.

Nora: Dates in Sydney time. And never touch the database scripts.

1:42 Sam: Fourth, your tickets and your wiki. Connect them, so it reads why a change is needed.

Sam: Read-only first. Text it reads can carry hidden orders.

1:53 Nora: Which file did you use?

Sam: Always ask that. You get a file and a line. You can open it and check it in seconds.

Sam: If it cannot name a file, check the answer twice.

2:06 Sam: Three things make it worse.

Sam: Too much text. Give it less. Keys in its reach. Keep them out. Write access. Start with read-only.

2:17 Nora: Now it reads before it writes, and my bookings work.

Sam: Start today with one short rules file. Then add today’s docs.

2:26 Sam: Your agent already looks things up in your code. Give it today’s docs, your rules and your tickets. Then check the file it used.

Have an app idea, a stuck app, or a daily job you want an AI agent to do?

Write three lines. I reply within one working day with a plain answer.