# How to Build an AI SOP Library for Your Agency (Claude Code)

> To build an AI SOP library with Claude Code, describe the problem in plain language in plan mode, answer the questions it asks, connect an AI API key through a local environment file, load your SOP documents, then test it with real questions. The finished tool lets your team ask a question in plain English and shows the answer together with the SOP and section it came from.

Source: https://fluxomate.com/blog/build-an-sop-tool-for-my-agency.html  
Published by Fluxomate (https://fluxomate.com/), 2026-06-30. Section: Claude Code builds.
Video: https://www.youtube.com/watch?v=K23a8CdC2pA

## Key takeaways

- Start with the problem: a team that wastes time hunting for the right SOP among dozens or hundreds of documents.
- Your first prompt can be non technical. Ask Claude Code to plan the build and to ask you ten questions about what you mean.
- Store each SOP as a book, grouped by department, and let your team search by asking a question in plain English.
- Every answer should show its source: the SOP and the section it came from, with a click through to the raw document.
- Test answers against the documents yourself. Check that the tool admits when an answer does not exist instead of making one up.
- Treat version one as a proof of concept, then improve it with feedback, one change request at a time.

## Why build an SOP library tool for your agency?

A small agency can get by with a handful of SOPs in a shared folder. Once you have dozens or hundreds, and around twenty people using them every day, finding the right one becomes a job in itself. People spend ten minutes searching, or read a whole document to find one section.

The idea behind this build is to remove that search. Every SOP lives as a book in a digital library. Instead of digging through folders, a team member asks a question in plain English. The tool picks the right SOP, gives a clean answer and shows where the answer came from, so nobody has to guess.

One rule worth keeping in mind before you build anything: identify the problem first, then build the solution. If you only have five SOPs, you do not need this. If your team loses time looking for documents, you do.


## What the finished SOP tool does

The version we built as a proof of concept covers the following.

- Stores SOPs as books in a library, organised by department such as onboarding, appointment setting, advertising and creative.
- Answers a plain English question by selecting the relevant books and writing a short answer from them.
- Shows the sources for each answer, the SOP and the section, and lets you click through to open the full document.
- Lets you open a single book and ask follow up questions about that one SOP in a chat panel.
- Lets you add a new SOP by importing a file or writing it directly in the tool, and lets you edit existing SOPs.
- Says so when the SOPs do not contain an answer, rather than inventing one.

## How to set up Claude Code for this build

You need a paid Claude plan and the Claude app on your computer. Open the Code section. You can also use Claude Code in a terminal or an editor such as VS Code, but the app is the simplest and most beginner friendly.

Create a new empty folder on your computer and choose it as the working folder for the project. Everything, including the code, the example files and the data, lives in that folder. Because the build runs locally, you do not need to connect to external platforms or publish anything to get a working proof of concept.

The modes are ask permissions, accept edits, plan mode, auto mode and bypass permissions. Plan mode plans before acting, and auto mode works through the task by itself. Be careful with bypass permissions, because it gives access without asking.


## Step by step: building the first version

This is the order we followed. The video above walks through the full build.

1. Write the first prompt as a problem description. Say who the agency is, how big the team is, that you have a large library of SOPs made of documents, and that the team needs to ask questions and find the right SOP quickly.
2. Ask for a plan and for ten questions. Tell Claude Code to put together a plan and ask you ten questions to understand what you want. Answer them in your own words.
3. Keep the first version simple. We asked for something that runs locally on one machine, with a clean and distinctive look but a straightforward way to find things.
4. Generate test SOPs in a second chat while the build runs. We asked for about forty SOPs for a marketing agency, each between two and five pages, split by department. The result was 42 documents.
5. Add an API key so the tool can use AI. Create a key in your AI provider account, paste it into the local environment file, save it and ask Claude Code to restart the server.
6. Point the tool at your SOP folder. Give Claude Code the folder of documents and ask it to integrate them. It indexes the files and adds them to the library.
7. Run your first searches and write down what is wrong. That feedback becomes your next prompts.

## How to handle the API key safely

The tool needs an AI connection to turn a question and a set of documents into an answer. That connection is an API key. Claude Code should create an environment file for you, often named .env.local, which works like a password store for the project.

Open the file yourself, paste the key and save. Doing this by hand means the key is not typed into the chat. If you ever publish the project, a file like this is kept out of the published code, and the key is stored separately.

Keep API keys private. Anyone who gets hold of one can run up a bill on your account, and keys for other services such as payments can give access to far more. Never show them on a screen recording or post them anywhere public.


## How to test that the answers are accurate

Design does not matter if the answers are wrong, so test the search before you polish anything. Ask Claude Code to suggest questions it knows the SOPs can answer, then paste them into the tool one by one.

We checked the maximum time before a first call to a new lead and the maximum number of texts per lead per day. Both matched the documents, and each answer showed its source SOP. An offboarding checklist and a call preparation request also returned the right SOP.

One test did not go well. A question about onboarding a new client returned a reply saying the excerpts did not contain a step by step process, even though a process probably existed. That is a reminder to test properly. A tool that says it cannot find something is safer than one that invents an answer, but it may also be searching badly, so check the document yourself.

Show the source every time. The reader should see which SOP and which section an answer came from, and be able to open it. That is what makes the answers trustworthy.


## What to improve after the first test

Feedback is where the quality comes from. The first version is the worst version you will have. These are the changes we asked for after testing.

- Make the search bar grow when you paste more than one line of text, so the whole question stays visible.
- Render the answers and the SOPs as formatted text, so headings and bold text display properly instead of showing raw markdown symbols.
- Make the source references clickable, so the full SOP opens on its own page.
- Add a chat panel inside each book, so people can ask follow up questions about that single SOP.
- Add a way to create SOPs by importing a file or writing one in the tool, and to edit existing ones.

## Where to take it next

This build runs on one computer and is a starting point. Realistic next steps include user roles, so a customer success manager does not see sales material, and a connection to your client records.

It also helps to work in several chats at once. While one chat builds the library design, another can fix the search and a third can add the SOP editor. Parallel chats can collide, so if Claude Code warns that another process is editing the same file, pause one and check afterwards that nothing was lost.


## Questions people ask

### Can I build an AI SOP system without coding?

Yes. The build described here used plain language prompts and no hand written code. You describe the problem, answer Claude Code's questions, review the plan for logic, and give feedback after testing.

### How does an AI SOP tool avoid making things up?

It answers from your own documents and shows the SOP and section behind each answer. In testing, the tool said when a question was not covered by the SOPs instead of inventing a reply. You should still check answers against the source.

### Do I need an API key to build an AI SOP library?

Yes, the tool needs an AI connection to turn a question and your documents into an answer. You create a key with your AI provider, paste it into the project's local environment file, and keep it private.

### Can my team add and edit SOPs inside the tool?

Yes. We added the option to import a file, which formats it into a document, or to write a new SOP directly in the tool. Existing SOPs can also be opened and edited.

Tools used: Claude Code, Claude API

Free templates for this guide: https://fluxomate.com/resources.html?r=build-an-sop-tool-for-my-agency
