Building a homelab with Claude Code: what to hand over and what to keep

A coding agent can type every command of a homelab build. The useful part is the split: it types and explains, you decide and check, and a short list of things it never gets.

Share
Building a homelab with Claude Code. What to hand over, what to keep, and what your coding agent never gets.

Yes, you can build a homelab with Claude Code, Codex or Cursor, and it is how I would start one today. A coding agent writes the configuration files, runs the commands, reads the errors and explains each step. What it should not do is decide for you or grade its own work: you make every decision, you approve every change, and each step ends with a check you see with your own eyes. That split is the whole method.

I use one on my own home lab every day. One of the apps running there, a fitness app called Pumpy, was built with Claude Code and serves my family and friends from that same server.

The division of labor in a Claude Code homelab

Setting up a home server used to be slow for a dull reason: configuration written by hand, where one wrong space in a YAML file breaks everything. Your coding agent takes that off your hands. It knows the syntax, reads the error and fixes it.

That is the part to hand over. The part to keep is knowing exactly what runs at your place and why. In Build My Homelab we put the line in one sentence: the agent does the typing, you do the understanding and the deciding.

The split does not change with the base system. The path supports two: Ubuntu Server with Docker straight on it, which is the default, and Proxmox with your apps in Docker inside one virtual machine. A Proxmox home server built with Claude Code follows the same rules.

Three lists: what to hand over to your coding agent, what to keep, and what it never gets.
The division of labor: what your coding agent does, what stays with you, and what is off the table.

Hand over the typing and the explaining. Writing the configuration files, running commands one step at a time, checks that only read, reading errors and explaining them, and writing down what was done.

Keep the decisions and the checks. When there is a choice, your coding agent gives the options and its recommendation, and the decision is yours. You approve every command that changes something, with a separate yes before anything leaves your computer. You read the diff before it becomes a commit. The final check you make with your own eyes.

Never hand it a secret. Passwords, keys, tokens and .env files never go into a chat. Neither does a backup passphrase, or your home's public address. Commands that need sudo you run yourself, typing the password at the server's own prompt, and passwordless sudo is never set up. Your coding agent never pipes a remote script straight into a shell: it downloads it, shows it and explains it first. If your coding agent asks for a secret, that is the moment to stop.

Write the rules before it touches the machine

The useful question about an AI agent for a homelab is not whether it can type the commands. It can. The question is what it agreed to before the first one ran.

In Build My Homelab the first lesson touches no hardware. This is the order I recommend, on the path or off it:

  1. One project folder. Open your coding agent inside it, in its ask-first mode. It is the one place files get written.
  2. A harmless first prompt. The agent may not create, change or delete anything. It names its folder, explains a home server in three sentences and asks you one question. A plan to install things, or a request for a password, means stop.
  3. Three rules, accepted before any real command. I don't paste secrets. I verify before I trust. I don't expose services to the internet until there is a backup verified by a real restore and a clean security review.
  4. A private repository. The folder gets a version history, a private copy on GitHub, an instruction file and a tested secret guard.
  5. Only then, the server.

One note on "ask-first". Claude Code's Manual mode asks before every edit and every command. Codex and Cursor ask mainly when a command reaches beyond the project folder, so with those two your yes rests more on the written rules.

The order of the build itself is a separate post: your first homelab, the first steps in order.

The instruction file

If you searched for a CLAUDE.md for a homelab, this is the file you were after: the agent's instruction file in the project folder. In Build My Homelab it is called AGENTS.md, it is written for any coding agent, and every later prompt tells the agent to read it first. It holds how to work with you, what every session does in order, and the rules, which the lesson sums up as six:

  • The repository is the project, and it gets read first.
  • Never invent current state. What is not written down and not checked live is unknown.
  • Secrets never enter the repository. Private visibility is not protection.
  • Small commits, the diff shown, the reason recorded.
  • Ask before anything leaves the machine.
  • The repository follows reality.

The secrets rule is backed by something you test: an ignore list, and a check that runs before every commit and refuses a commit when it spots something that looks like a secret. You watch it refuse a fake credential before you rely on it.

Why a repository at all? An agent without a project starts every conversation from zero. The repository holds what you intended, what you verified and why, so the next session begins by reading. Once the server exists, a change travels one way: written in the folder, pushed, pulled on the server. Nothing is edited on the server by hand.

A written rule does not make your coding agent obey it. It gives you a line to hold. If files appear before you said go, or a push happens without a question to you, stop it and say so.

The KWS Rack beside the rule this post is built on: the agent does the typing, you do the understanding and the deciding.

One working session, start to finish

Six steps of one session: read the project, session brief, your go, one step at a time, verify, record.
One working session: nothing runs before your go, and nothing counts before you have seen it.

From the repository lesson on, every session runs the same loop:

  1. It reads the project. The README, the instruction file, the inventory, the decisions and the verification log.
  2. It writes a session brief. One page you open in your browser: a diagram, today's steps, your decisions as lettered options, and how a mistake gets undone.
  3. You say go. You answer the decisions by letter. Nothing runs before that.
  4. It works one step at a time. Before a command, what it does and what you should see. After it, what the output means.
  5. You verify. Something you can see with your own eyes.
  6. It records. You read the diff and approve it. The commit says why it changed and how it was verified.

What counts as a check

Verification means something you can observe: a page that loads, a list that shows the device, a command that ends without an error. "It should work" is not verification, and neither is the agent telling you it worked. The prompts on the path end by making it show the evidence: the exact output or screen behind each check.

A first app counts when it opens in your browser, you do one real thing in it, and that thing is still there after the container is thrown away and created again.

One boundary: a commit proves what you intended. Only a live check proves a service is healthy.

Where a coding agent goes wrong

I run a home lab every day, and I would not point a coding agent at a home server without expecting these four. An agent does what you ask, including the thing you should not have asked for yet.

Table of four mistakes: confident guesses, destructive commands, secrets in the chat, fixing by reinstalling, each with its rule.
Four mistakes to expect from a coding agent, and the written rule that answers each one.

Confident guesses. A package name, an image tag or a flag that does not exist, stated as fact. Or "it is running" with no live check behind it. The rule: it may be wrong, so it verifies that names, tags and flags exist before anything runs.

Destructive commands. sudo, rm, dd, mkfs and firewall changes are treated as dangerous: one step at a time, explained back first, with the undo stated before an install. Before a disk is erased, you identify the exact disk by model, size and device name.

Secrets pasted into chats. It can arrive as a request to paste a config file with the real values in it. The rule is placeholders only. Before you paste a log, swap out passwords, tokens, public addresses and real usernames. This reduces exposure. It does not remove the risk.

Fixing by reinstalling. When something will not start, the quick move is to wipe it and begin again. The rule: no destructive resets until safer checks are done. If you are stuck after three attempts, or an action risks data loss, it stops and tells you to pause and ask a human.

Run the restore before the bigger changes

Should you let an AI agent manage a homelab once it is built? Not by itself. Every change to a running server is still shown to you and waits for your yes. What grows is the cost of a mistake, so the safety net goes in first.

A backup you have never restored from is a gamble. The backup lesson ends with a drill: stop one app, restore its data into a separate, clearly named folder, look at it there, and only then swap it in. The original is moved aside, never deleted, until you have seen your real data back in the app. On Proxmox the drill runs on the whole virtual machine: it is restored under a new VM ID, never over the running one.

The security review comes right after, on purpose: you only change security settings on a server you can already restore. Its fixes follow a small change policy worth using for any change to a running server:

  • One change in flight.
  • The undo written down before the change.
  • A re-test of the one check the fix should flip.
  • Never SSH, the firewall and updates in one move. Being locked out is a bigger risk than any single non-urgent finding.

You stay responsible for your machine and your data. The rules exist so that you are never guessing.

Why not just ask Claude Code?

You should, a lot. The path is built around your coding agent, not against it. But answering a question and building a system are different jobs.

An agent on its ownYour agent on the path
Answers each question well, without knowing which step you are onKnows the order: backups and a security review come before anything is exposed
Takes a different approach in every new sessionContinues one coherent build, in one project folder
Does what you ask, including the thing you should not have asked for yetWorks inside rules: no secrets in the chat, no open ports by default
Leaves you with "wait, did that actually work?"Ends every step with a check you see with your own eyes

You can write the rules in this post yourself, and you will get most of the way. What takes the time is everything around them: the order, a prompt per step that already carries the rules, the session brief, and the checks. That part is what Build My Homelab is.

The short version

  • Hand over the typing and the explaining. Keep every decision, every yes and the final check.
  • Write the rules down first, in an instruction file your coding agent reads at the start of every session.
  • Keep one project folder as a private repository that records what you intended, what you verified and why.
  • A step is done when you can see it. Secrets never go into a chat.
  • Run a real restore before you let it change anything you would miss.
Build My Homelab: the rules in this post are already written into every prompt. See how the path works.

Build My Homelab is this method written out as a self-paced path: you decide, your coding agent runs the commands, and every step ends in a check you can see. Each of its 11 lessons comes with a ready prompt that already carries these rules. See how the path works.