Skip to Content

How I build with AI

Seven rules I work by, and the mistakes that wrote most of them.

On my recent projects, AI agents did much of my hands-on build work: code, schema changes, data checks and analysis. That speed is real. So is the risk, because an agent that can change a live system can also break it. I get the speed from the agents, and the safety from rules that live in files, code and credentials, not in anyone's good intentions.

The seven rules follow the order I work in: set the rules, set the limits, decide, limit access, enforce in code, check, prove.

  1. A file, not a note

    What went wrong. The steps to rebuild a demo system once lived only in an agent session's memory. After a full wipe, they were gone, and the demo came back half-built.

    What it means. Anything the agent or I will need again goes into a file in the repo: the rules, their reasons, the order of steps. The system is built from the repo, not by hand. The repo comes first, always.

    What enforces it. In one of my projects, a rules file sits at the root of the repo, and Claude Code reads it at the start of every session (it's called CLAUDE.md). In another, a handover file holds the rules, and the agent is told to read it first. Each rule sits next to its reason, so nobody "fixes" it away later. The data model, the endpoints and the access rules are defined once, and every copy is generated. A check fails if someone edits a copy by hand. The demo rebuild is now a script.

  2. Free where it's cheap, fenced everywhere else

    What went wrong. While fixing something else, an agent found a problem in an unrelated repo. I said "yes, run it," and it removed files there. The rule since that day: scope beats the permission of the moment. Outside the project, the agent reports the exact fix and stops.

    What it means. The agent gets wide freedom where mistakes are cheap and can be undone. Everywhere else, the limits are written down before the work starts.

    What enforces it. The rules file lists each environment and what it allows. On the demo, the agent may add, rename and delete fields without asking, because the demo can be rebuilt from the repo. It still reports what it changed. In production, access is read-only by default, a backup comes before any write, and a named list of changes needs my explicit approval. Some actions are banned everywhere, demo included: sending anything legally binding or anything to a customer, and creating connections to outside systems. The rules require every write tool to confirm which system it is connected to before it writes.

  3. Freedom to execute isn't freedom to decide

    What it means. Business and architecture choices stay with a person. The agent measures, lays out the options and says what it would pick and why. An open decision is not applied.

    What enforces it. A decision log in the repo records decisions with a status, a date, a reason and who decided. The rules file tells the agent not to close a business or architecture decision alone. When I hand a decision to the agent on purpose, the hand-off is written down too.

    Example. A retried "create renewal quote" action made two quotes for the same renewal, less than a minute apart. The agent measured it and wrote a proposal. It held back the questions that weren't its to answer, such as what to do if a quote had already gone to the customer. It shipped only the part that needed no choice: a duplicate now stops with a named refusal, and reusing the existing quote takes an explicit flag from a person. Refusing a duplicate overrode nothing a person had decided. Then I chose among the options.

  4. One job, one key

    What went wrong. Two audits found keys that could do more than anyone thought. In the first, several service keys did not match what the repo declared. The background worker could change the schema, against a written decision. Nobody had seen it, because nobody had asked. In the second, analysis had no read-only key to use.

    What it means. Each tool or agent gets its own key (an API credential) with only the permissions its job needs. Analysis gets read-only access. A key that can do everything loses everything if it leaks.

    What enforces it. Each service's permissions are declared in the repo, and a checker compares them with what each key really has. Secrets are never printed, only "set" or "missing." Analysis has its own read-only grant and goes through a small client. The client sends only reads, only to the expected address, and refuses a key that belongs to a different system.

  5. A decision not enforced by code is an intention

    What went wrong. A decision said the billing job log had to live in durable storage. Nothing in the code enforced it. Billing now refuses with a named error that tells the person what to do. The project notes from that day: "A decision that isn't enforced by code is an intention."

    What it means. If something must never happen by accident, a document is not enough. The code makes it impossible, and a test fails if anyone tries.

    What enforces it. The wrapper around the e-invoicing service always sends drafts. That value is set in one place, with no override. It isn't a setting, because a setting gets flipped by mistake, while a code change is deliberate and reviewed. Every call needs an idempotency key, a unique ID that lets the provider recognize a repeat. A call without one is refused. If a call's outcome is unclear, it is never resent on its own; its key is used to look up what happened. One test fails if any code writes a quote's approval status, so only the human approval flow can move it. Each endpoint declares who may call it, and the server refuses everyone else. Those refusals were tested live on the demo.

    Example. The reference integration code I started from had "draft" hard-coded off. Every call would have issued a real, legally binding invoice.

  6. A check that can't turn red isn't a check

    What went wrong. My main check command once printed green while it was failing. Each step piped its output into another command, which hid the failure. The fix surfaced dozens of broken links at once. Another check printed a green tick after matching zero tables.

    What it means. Every mistake that repeats becomes an automatic check. Each check has to prove it can fail. The checks themselves get checked.

    What enforces it. One command runs every offline test and check at no API cost, and the rules say it runs before every commit. A new check counts only after it has proved it can fail on test data: break the data once, watch it turn red, restore it. Allowed exceptions carry a reason and fail once they are no longer needed. The command runs every check, every time. A check that runs only sometimes is an archive, not a check. Honest limit: "before every commit" is a rule the agent follows. Nothing in the tooling forces it yet.

  7. "Success" doesn't mean it happened

    What went wrong. On one build, no call from the screens to the backend had ever worked, and nobody had noticed. Every test confirmed the screens loaded. None of them pressed a button.

    What it means. An API that answers "success" has proved nothing. Every write is read back from where the truth lives. A feature is done only when the whole flow has run on real data. The same goes for agents: their reports are leads, not facts.

    What enforces it. Live proof is a fixed step before a task closes: the flow runs end to end and is read back. A dated list records measured platform behavior, including settings that, in my tests, answered "success" and changed nothing. It may have changed since, which is why each entry has a date. Nothing is called verified unless it was read from the API or seen on screen. Helper agents research read-only, and the critical lines are read again at the source before anyone relies on them. Analysis notes keep "verified, with source" apart from "hypothesis."

What I don't automate

  • Decisions. The agent proposes. A person decides, or hands the decision over in writing.
  • Anything that can't be undone. Issuing a legally binding document, sending anything to a customer, creating connections to outside systems, deleting data in a live system.
  • Customer replies. They stay drafts until a person approves them.
  • What the API won't apply. In my tests, some settings reported success and changed nothing. That may have changed. A person makes those changes on screen, from a written runbook, and the result is read back.

Where to go next

The patterns behind these rules are written up as reference architectures:

Most of these rules were written during project work, before the certification.

Claude Certified Architect – Foundations, Anthropic. Verify on Credly (opens in a new tab)