Quick and dirty RAG skill with Claude

February 25, 2026

Today, I decided to see how hard it would be to make a rudimentary, token-efficient way to combine insights about my code base with insights about my knowledge base. As much as I enjoy copy-pasting things back and forth between my IDE and my browser, and hooking my Claude account up to Google Drive (or wherever your stuff is stored)... yeah.

I figured it couldn't be that hard to make a simple search engine and wire it up to the agent. And, indeed, this turned out to be true!

Why?

You really don't want to blow your whole opus budget on searching through files that the agent thinks might have relevant names or be referenced in other files, which might have relevant names, or be referenced in...

This is especially true with documentation--and particularly with lengthy product documents, tech specs, story bibles, and other things that have not arrived hyper-optimized for agentic discovery (which also includes most documents intended for agentic discovery).

Walkthrough

Build your search engine

First, build your search engine. Here is Claude's take on a super quick ChromaDB embedding database:

RAG index builder and query script

RAG index builder and query script

All three embedding model options have satisfactory performance on an (admittedly powerful) CPU. Performance scales with size, as you'd expect.

This particular script looks for markdown files and python files that live in the specified paths. It chunks the markdown files by heading and embeds the contents, sometimes in multiple parts. It also processes any python files it finds, using AST parsing to locate classes, methods, and docstrings. But you can configure it to do whatever you want.

You can use this same script to perform queries in a variety of ways, which are documented. Outputs include the full file path--you can instruct your agent to follow these if it thinks something is relevant, if you'd like.

Make it executable

You'll want to make either this script, or a wrapper around it, executable. This is so that your agent can call it without asking you for permission each time; otherwise you might have to permit it to perform arbitrary python operations, or something similar, or just click "yes" for ten minutes, which defeats the purpose.

Make a skill

SKILL.md

SKILL.md

This is Claude's take on anonymizing the skill I wrote. I have an additional paragraph under the Running a search section addressing some failure modes I observed, so you'll probably need something like that too.

That's it!

Enjoy your rudimentary search tool, Claude!