Part 3 of 3 in a series on building Local Photos AI. Part 1: why I built it. Part 2: what it takes to run AI on 300,000 photos at home.
Over a few months I built Local Photos AI, a private AI photo library for over 300,000 family photos, with a web app, a TV app, an Android app, more than 210 API endpoints and more than 3,000 automated tests. Claude models wrote nearly all of the code.
The hard part of building with AI, for me, wasn’t the code. It was the same thing that’s hard with any team: making sure everyone knows what we’re building and why, what good looks like, and what to do when something goes wrong.
So I led my AI coding partner the way I lead people. The most important artifact in the project isn’t any of the code. It’s a single instructions file, more than 400 lines long, that Claude reads before every task. It’s the onboarding document, the working agreement and the definition of done, all in one.
Start with the why
The file doesn’t open with coding rules. It opens with the purpose: this is a private, local photo library, and everything follows from that. It must work with no internet. If a change would make the app reach out to the internet while it runs, Claude has to stop and ask me first, and explain what would break offline.
That’s the difference between a rule and a reason. “Don’t load fonts from Google” is a rule. “Nothing leaves this machine, because these are my family’s photos” is a reason, and a reason covers cases no rule anticipated. I’ve always told teams why before telling them what. It turns out an AI makes better decisions with the why too.
High autonomy, high context
Good delegation isn’t “do whatever you want”, and it isn’t micromanagement either. It’s giving people the full picture, then trusting them with the how. The instructions file does exactly that:
- The real scale. It doesn’t say “make it fast”. It says the app must handle 500,000 to a million photos, so no list is ever unbounded and no grid ever loads every photo at once.
- How much to check in. A trivial change: just do it. A moderate one: say the approach in one sentence, then go. Anything complex or touching many files: propose it first and wait. That’s the same calibration I use with engineers. A senior engineer doesn’t need sign-off to fix a typo, and nobody should redesign the database without a conversation.
- A “Discuss” mode. When I start a request with “Discuss”, Claude analyzes it and proposes an approach, with the trade-offs, and writes no code until I agree.
Make it safe to push back
One of the first rules in the working agreement is about speaking up:
If multiple interpretations of a request exist, present them — don’t pick silently. If a simpler approach exists, push back and propose it. If something is genuinely unclear, stop and ask. Don’t guess.
That’s psychological safety, written down. The worst engineering cultures are the ones where people guess rather than ask, because asking feels risky. An AI that silently picks an interpretation is making the same mistake for a different reason. I wanted a partner that would tell me when my request was ambiguous or my idea was more complicated than it needed to be.
Learning goes both ways
Local Photos AI was my first full application built with AI, and I didn’t arrive knowing how to do it. So I treated Claude as much as a teacher as a coder. When I suspected I was going about something the wrong way, I asked, and it explained the trade-offs instead of just doing what I’d said. When it made assumptions, I corrected it, and those corrections went into the working agreement so it didn’t make them again.
We both got better. By the end, my requests were clearer and its work needed less correcting.
That’s the relationship I’ve always wanted with teams. The leader doesn’t need to have every answer. Asking is a strength, not a weakness, and the best teams are the ones where everyone, including the leader, finishes a project better than they started it.
Fix the system, not the person
When a test fails only sometimes, the tempting move is to re-run it until it passes. My rule, for people and for Claude, is that a flaky test is a bug:
Never dismiss, skip, or ignore a flaky test — investigate and fix it the moment you see one. … “Passes when re-run” is not a resolution.
It goes further: find the root cause, fix the pattern so every test with the same weakness gets fixed too, then re-run the whole suite to prove it’s stable. That’s a blameless postmortem in miniature. The question is never “who wrote the flaky test?” It’s “what about the system let this happen, and how do we stop it happening again?”
Every failure is a lesson worth sharing
The part of the file I’m proudest of is the part that grew from mistakes. In the previous post I described two bugs: scanning in the wrong process made every page slow, and a quirk in how hidden photos were compared made the app rediscover the same photos every time it started. Both are now written into the instructions as rules, each with a test that fails if anyone, human or AI, brings the mistake back.
That’s what I want from every team. A mistake should be made once. Then it becomes part of what everyone knows, so the next person, or the next AI session, starts from the lesson rather than repeating it.
A definition of done
Before every commit, Claude runs a nine-step check: no generated files sneaking into the repository, copyright notices on every file, test gaps found and filled, no hard-coded machine details, a security scan, the README kept up to date, the full test suite run, the Android app rebuilt if it changed, and finally the exact commit command for me to run.
None of those steps is clever. Together they’re the difference between “it works on my machine” and “it’s done”. Teams that agree on what done means argue less and ship better, and the same is true of a team of one person and an AI.
Values, not just rules
One section has nothing to do with code quality:
Never use the developer’s real name or family members’ names in code, comments, docstrings, placeholder text, or test data … Treat all user-shared personal information as confidential.
Every test photo is of “Alice Johnson” or “Bob Smith”. In a project built entirely around my family’s photos, I wanted my family’s names to appear nowhere in it. That’s a value, and writing it down meant it held in every session without my having to repeat it.
Wins are shared; failures are mine
Claude wrote nearly all of the code in this project. But every decision about what to build was mine, every feature was tested by me before it counted as done, and every bug that got through was mine to own. That’s the deal I’ve always offered teams: the credit goes to the people who did the work, and the accountability stays with the leader.
The tools are new, but leadership hasn’t changed. Give the why. Share the context. Make it safe to say “I’m not sure”. Turn failures into shared knowledge. Agree on what done means. The leaders who already do this with their teams have a head start with AI, because AI rewards exactly the habits that good teams always have.
If you’re leading a team that’s starting to build with AI, I’d like to hear what’s working for you, and what isn’t.
