All writing

Give me the contract, not the implementation

What years of building software taught me about boundaries, outcomes, and where AI belongs in the work.

Recently I saw a post from someone who described himself as a developer. He had tried AI, didn't like the result, and decided he wasn't going to use it. To explain why, he compared two implementations for reading HTTP headers. His version was 20 lines. The AI-generated version was 40. He said his code was smaller and simpler.

He may have been right. If his implementation did the job with less complexity, I'd prefer it too. Being generated by AI doesn't make code worth keeping.

What I disagree with is the decision to stop using AI because of that result. One bad implementation is a good reason to reject that implementation. I don't think it's enough to decide that the tool has no place in how you work.

I replied saying I'd like to talk and understand his perspective. I also offered free mentoring on using AI, if that would be useful to him. I was curious about what he'd tried and whether we could find a way of using it that made sense for his work.

That post is what made me sit down and write this. I want to translate what I've learned building software into a way of working where we focus on what matters and let AI do more of the implementation. We decide what success means, what the system promises, and what we're willing to spend getting there. Then we give the agent a way to work toward that result and measure its progress.

I've been thinking of this as outcome-driven development. You own the contract and the measures of success. AI gets more freedom to change the implementation as long as it can demonstrate that the result meets those expectations.

I hope this post is especially useful if you're starting out in software now that AI is part of the picture, or if you've held off on using it after an experience like the one I described above.

If you're already using AI, I'd like to hear your perspective too. You might be approaching the same problems in very different ways, and I think that's okay. We're all learning.

My pre-AI era

These thoughts come from work I did before AI became part of my day-to-day workflow. I've been coding for a while, and code itself never intimidated me. I'm proud of my open-source contributions, although most of my work has actually been closed source. Which is fine. Most useful software doesn't come with a public contribution graph.

Dapr was my first real Go project and my first truly open-source project in my professional career. That came after more than five years of closed-source work following graduation, leaving university projects aside. The language was new to me, and I still managed to contribute substantial features, including support for pluggable components. Looking back at the repository history, I had 47 authored or co-authored commits in my first seven months. Comparing everyone's own first seven months puts me seventh in dapr/dapr by that measure. That's a count of activity, of course. The work I'm proud of is what those commits enabled. Pluggable components let developers extend Dapr with their own implementations.

One design decision I'm particularly proud of was keeping the same Go component interfaces for the built-in and pluggable paths. Building on the community's pluggable-components proposal, I implemented runtime support and a Go SDK that could wrap an existing component and expose it over gRPC. The Redis component itself didn't need a second implementation. It needed a small wrapper to run out of process.

That was a breakthrough for me because it gave me a concrete way to check whether the gRPC boundary preserved the behavior we expected. I could take the same Redis component and reuse the conformance tests through the pluggable path. My original PR records that experiment and the passing tests. Keeping the implementation the same helped isolate what I was trying to validate: the protocol and its adapters.

Years later, that core design is still there. The Go SDK still builds on the existing component interfaces, and Dapr's state-store test suite exercises the built-in and pluggable configurations with the same test cases. The pluggable Redis test app still wraps the existing Redis implementation. To me, that's an example of good design surviving time. The code can evolve while the boundary still makes sense.

Deco is another example. Much of my work there happened in 2023. If you look at the resolver's blame history, 498 of its current 738 lines still trace back to my commits from that year. The file has evolved, including changes made with AI, but a lot of that earlier work remains.

There's also CM, the configuration manager I built at VTEX and co-designed with Bernardo Heynemann. Its design was heavily based on Facebook's Configerator, described in the paper Holistic Configuration Management at Facebook. He left before I had the first version live. The last time I talked to people at VTEX, they told me they were still using it, hadn't experienced downtime with it, and more people were adopting it. Hearing that years after I'd left made me proud.

I don't know its current state. If you work at VTEX today, I'd love to hear from you. Maybe CM is a pain now and I just haven't heard about it. Maybe it has changed a lot, or AI has helped more people contribute. I don't know. What stayed with me was hearing that something we'd designed together was still useful after we'd both moved on.

I find that more interesting than whether someone could write the same code faster today. What drove those decisions was my understanding of how to translate real problems into software capabilities. The language was how I expressed that understanding.

AI has made something clearer to me. My passion is more engineering than coding. The cool part of implementing a topological sort is figuring out how it belongs in a coherent system that people can build on. The algorithm is useful because of what it makes possible.

We spend a lot of our time building things so other people can build on top. Sometimes that happens in invisible layers, like operating systems and databases. Sometimes it's a UI. I think of a UI as a kind of public API for customers. It gives them a vocabulary of actions and makes promises about what those actions do.

That ability to turn complexity into something another person can use is the part I care about.

Simple doesn't mean simplistic

I also remember Geraldo Thomaz, VTEX's co-founder, coming back to simplicity again and again. The way I remember his point is:

The key to good software is simplicity. We always need to make things simpler.

That stayed with me. But simple and simplistic are different things. A simple design makes the problem easier to understand while still handling what matters. A simplistic design leaves out part of the problem and lets someone else deal with it later. Removing error handling makes a function shorter. It doesn't necessarily make the system simpler to operate.

The Design for Simplicity chapter explores this well. A model can be too simple to be useful or too complicated to work with. Finding the useful level of abstraction takes understanding of the problem.

That's also how I think about the HTTP headers example at the start. I'd want to know whether both implementations meet the same needs before using their line counts to judge them. Simplicity has to hold up when someone uses the software.

Outcome-driven development

Here's the shift I want to make in my own work. Before asking an agent to implement something, define the outcome, the contract it must preserve, and the cost we're willing to accept. Give it a way to check those things. Then let it try implementations, measure them, and improve the result.

For example, suppose we want to reduce the cost of generating customer invoice exports. The contract says a customer gets all the invoices they're authorized to see, in the agreed format. The success metric is cost per correctly completed export, with completion time kept within the existing target.

An agent can try a different query, batch work differently, or replace an internal algorithm. We can compare each version against the same workload and check correctness. An export that omits half the invoices doesn't become an improvement because it's cheaper. The contract rules it out.

This is what I mean by letting AI drive the numbers. We choose which numbers represent something worth improving. The agent works toward them inside constraints we've made explicit. It also gets a budget for the work itself. Spending more on experiments than the improvement could save is part of the cost decision.

I want to be able to delegate a genuinely reversible implementation change without following every edit. That depends on having checks I trust, observing the result, and being able to roll back. The agent shouldn't get to weaken the checks or redefine success to make its implementation pass.

Changing a contract, introducing a new one, or deciding that our metric no longer represents the goal needs a different kind of thinking. Those decisions affect what other people can rely on. That's where I expect human judgment and team discussion to stay central.

An engineer defines the contract, success metric, and cost limit; an AI iterates on implementation and tests, using measured outcomes and cost as feedback.

Define the target and the limits. Let the implementation change as the evidence improves.

A few days ago I found Software Design Principles. I kept reading and recognizing things I had learned, sometimes the hard way. It encouraged me to put together a public repository of agent skills based on those principles, alongside the skills I already use. Feel free to use them, give me feedback, or open a PR.

It also brought me back to a question I've been thinking about for a while. What is software engineering about when a model can do so much of the implementation? Where do we draw the line between what we delegate and what we need to understand ourselves?

That line will move. We should reconsider it as models improve. Right now, though, the part that still needs my attention is exactly what made me excited about engineering in the first place. Understanding a complex problem well enough to express it in simpler terms.

What we can delegate

There's a story from Uncle Bob that stuck with me. In his How Many CTOs? interview, he talks about moving from assembly to C. He disliked some of the assembly an early compiler generated enough to write tools that corrected its output.

I recognize something familiar in that reaction. We learn a way of working, become good at it, and then a tool takes over part of the work. We still see the details it gets wrong because we know how to do those things ourselves.

The compiler analogy has limits. A compiler translates a language with defined semantics. A coding agent has to interpret a request that may leave half the requirements unstated. And a compiler bug doesn't make the compiler nondeterministic. It can produce the same wrong result every time.

Still, there's a useful lesson here. As we delegate more implementation work, we need to be precise about what we expect from the result and how we'll check it.

Shared language

This is where boundaries matter to me.

I'm borrowing some of the language from domain-driven design. A bounded context establishes where a particular model and its vocabulary apply. An API establishes what one part of a system can ask of another. They aren't identical concepts, but both force us to decide what belongs together and what other people are allowed to depend on.

Lauren Tan, also known as poteto, put it well in her AIE Code talk: "anything that requires nuance to use well often leads to slop."

That connects directly with what I've been seeing. If using an API correctly requires knowing five unwritten exceptions, we're asking every developer and every agent to rediscover those exceptions. We can often do better by changing the API or making the invalid choice fail automatically.

The reasons that make software easier for people to work with overlap a lot with what makes it easier for agents. Clear names, explicit dependencies, and rules that the code actually enforces help both.

This is also why I keep coming back to ubiquitous language. Eric Evans used that term for a shared language grounded in the domain model, developed through conversations between developers and domain experts. AI gives us another participant that needs to work within that vocabulary. It doesn't remove the need to talk to the people who understand the business.

Try asking several people on your team to describe the same change to an agent. Compare what they write. Does "customer" mean the same thing in every prompt? Does "cancel" mean stopping future billing, refunding a payment, or deleting an account?

Different wording isn't automatically a problem. Different meanings hidden behind the same word are. A shared vocabulary gives us a better chance of noticing that before it becomes code.

And the prompt is only part of the input. Agents read files, inspect types, run commands, and use the results to decide what to do next. If our conversations use one model of the business and the repository expresses another, the agent has to reconcile that contradiction somehow.

I originally thought about this as making AI more deterministic. That's too strong. The same prompt can produce different results, even with the same model. Model providers explicitly document this. Different models also bring different capabilities and failure modes.

What I want is more consistent behavior at the boundaries. Two implementations can look completely different and still satisfy the same contract. Conversely, two almost identical implementations can disagree about whether a customer gets charged twice.

One useful way to measure agent readiness would be to give an agent representative tasks repeatedly, starting from the same repository state, and check whether it preserves the contracts while completing the work. Then vary the wording and the model. Measure broken guarantees and human corrections, not how similar the generated files look. A model that changes nothing would preserve every boundary, so task completion has to be part of the measurement too.

This changes where I want to put the rules. If a restriction can be expressed in a type, an API, a dependency rule, or a meaningful test, I want it there. Otherwise we're depending on the agent remembering a paragraph somewhere.

Let the code carry the rules it can enforce. Keep the explanation of why those rules exist where people can find it. There are decisions the code can't explain by itself, especially business tradeoffs and constraints outside the system.

Keep the promise, replace the implementation

The reason I keep emphasizing boundaries is that they're where we make commitments to other people. Rich Hickey's Spec-ulation is a good talk about this. Once someone depends on what your software provides, changing that promise has a cost for them.

An implementation behind a stable contract is often a two-way-door decision. We can replace it, compare the behavior, and roll back. Public contracts can be much harder to reverse because consumers have already built around them. Persistent data deserves the same attention. A bad migration doesn't become reversible just because the function that ran it was private.

Also, a contract includes more than a function signature. Authorization, side effects, ordering, and acceptable latency may all be part of what someone relies on. An internal change that violates those expectations has crossed the boundary, even if the compiler is happy.

One signal I watch for is unrelated new features forcing changes to the same files over and over. If every new capability requires editing the same shared logic, I start questioning whether I've put the boundaries in the right place. That code may be carrying responsibilities that need to evolve independently.

Changing a file every day isn't proof of a bad design. We may be deliberately evolving the same boundary, or still learning what it should be. The useful question is why the changes keep meeting there. It's one signal to investigate, not a score based on how little code we touch.

That gives me a practical place to focus. I want to understand what the system promises, how we know it keeps that promise, and which decisions will be expensive to undo. I still need to inspect the implementation when the evidence isn't good enough.

Users depend on a stable contract while an AI swaps two implementations underneath it; the replacement must preserve the guarantees and support rollback.

Autonomy inside the contract depends on verification and real reversibility.

Two technical bets

There are two technical bets I'd make based on this. I may be late to both of them.

Event sourcing

The first is that event-sourced applications will become more attractive in domains where history matters.

In event sourcing, the durable record is a sequence of events, and current state is derived from them. An order was placed, payment was accepted, then the order was canceled. That gives us more to investigate than a row whose status currently says canceled.

I think this is useful for agents because an investigation can work from recorded events and replayable behavior. We can ask what happened, reconstruct a state, and test a hypothesis against the sequence that produced it. That seems like a good fit for tools that can inspect code and work through a lot of evidence.

But replay has to be designed. We need to separate state reconstruction from effects such as sending an email or charging a card. Old event schemas, duplicate delivery, and the cost of rebuilding state still exist. Event sourcing brings those obligations with it.

So my bet is about the value of explicit history and reproducibility. Cheaper storage alone doesn't make event sourcing cheap, and an agent doesn't automatically understand an event log correctly. For a simple CRUD application, it may still be unnecessary work.

F# and explicit domain models

The second bet is on languages that make the domain easy to express. I'm particularly interested in F#.

Look at this small example:

type OrderState =
    | AwaitingPayment
    | Paid
    | Shipped

type ShippingError =
    | PaymentRequired
    | AlreadyShipped

let ship = function
    | AwaitingPayment -> Error PaymentRequired
    | Paid -> Ok Shipped
    | Shipped -> Error AlreadyShipped

let ``an unpaid order cannot be shipped`` () =
    let result = AwaitingPayment |> ship
    assert (result = Error PaymentRequired)

let ``a paid order can be shipped`` () =
    let result = Paid |> ship
    assert (result = Ok Shipped)

``an unpaid order cannot be shipped`` ()
``a paid order can be shipped`` ()

You can read the rule directly. An order awaiting payment can't be shipped. A paid order can. An already shipped order produces an explicit error. This is a tiny model, but the vocabulary is visible in the types, implementation, and examples.

F#'s discriminated unions let us name the possible cases instead of scattering combinations of flags through the code. Pipelines help express transformations in the order we read them. Those things appeal to me because they make it easier to see whether the implementation matches the domain.

Rust also has expressive enums and pattern matching, alongside its ownership model and performance characteristics. I'm not claiming that F# has a monopoly on good modeling, or that agents have been proven to perform better with it. For the kind of business software I'm interested in, I think F# deserves more attention. That's my preference and my bet. I'd choose based on the problem, the ecosystem, and the people maintaining the result.

"Give me the contract, not the implementation" is how I keep describing this to myself. It reminds me of the Go advice to accept interfaces and return concrete types. That advice has exceptions, but the instinct is familiar. Be deliberate about what a consumer needs to know and what they should be able to rely on.

Owning outcomes and costs

This also changes how I think about ownership. I expect developers working with agents to become more independent in how they implement things. In that sense, development may move toward individual silos. The part that needs to stay shared is what each piece of the system promises to the rest.

We used to learn a lot of the system by talking to the person who had implemented a particular part. Now I can ask Claude to change code that a colleague wrote without having that conversation. The agent lowers the effort required to make the edit. It doesn't automatically give me the understanding that conversation would have produced.

For a local change behind a well-tested contract, that may be fine. For a change in what the system means or promises, we still need to talk. Otherwise every person can move faster while the team develops several incompatible ideas of the same product.

So I'd want each developer to be responsible for defining two things for the capability they own:

  1. The success measure. What should improve for the user or the system, how we'll observe it, and which guarantees must hold while we improve it.
  2. The cost of the solution. What it takes to build, run, and maintain it, including agent usage and the human effort still required.

For that invoice export service, I'd want to see the rate of correctly completed exports alongside the cost per completed export. I'd also want to know what the latest change cost to develop and verify. That gives us something concrete to discuss when deciding whether an optimization was worthwhile.

This is the direction I want us to go. Every capability comes with a way to measure its result and its cost. Measurement is part of the implementation, and checking the effect of a change becomes a normal part of delivery.

The calculations can be automatic once the definitions and instrumentation exist. Deciding what those calculations mean still takes care. A metric improving after a release doesn't by itself prove the release caused it. We need a useful baseline, and sometimes a controlled experiment, before claiming impact. Some maintenance costs also take time to become visible.

I want those questions to be built into the work, so we can discuss outcomes using evidence instead of guessing from the size of a diff.

A shared platform for independent work

This is one reason I think internal developer platforms and application frameworks become more useful as coding agents improve. A shared way to deploy, handle identity, or publish an event gives both people and agents fewer decisions to reinvent. A platform can be small. It doesn't have to start as a big infrastructure project.

The distinction between essential and accidental complexity is helpful here. Some difficulty comes from the problem we actually need to solve. Some comes from how we've chosen to implement it. A good platform absorbs recurring work so product teams can spend more attention on their domain. It also needs to earn that role. If it makes ordinary work harder, we've added another problem.

My prediction is that one person, working with agents, will be able to maintain larger implementations behind clearly defined contracts. The team agrees on the commitments and how success is measured. The individual owns the result and its cost, with more freedom to let agents work on the implementation.

That doesn't make the agent the accountable owner. We can delegate execution and rely on a tool within tested limits. The responsibility for what we ship still belongs to people and organizations. It should also be possible for another person to take over the work. Otherwise we've just made a very productive silo.

Where I want to spend my time

So this is me trying to get a mental dump out of my head. I don't know how all of these bets will age. Better models may change where I draw the line, and experience may change my mind about some of the tools.

What I keep coming back to is the work of turning a complicated problem into something people can understand and use. Outcome-driven development is how I want to put that into practice. Define the promise, decide what success is worth, and give AI room to find an implementation that delivers it. Then check what actually happened.

Oh, and this blog itself was built with AI. AI also helped me organize this post. I'm not very good at putting my thoughts into a linear order, and it helps me arrange the ideas so the explanation makes sense.

Everything here was personally curated by me. I stand behind what I've written, and I'm happy to discuss any of these ideas in as much depth as you want.

These are my own views and don't necessarily reflect those of the company I work for. They come from what I've learned and the conversations I've been part of about what we should try and what we shouldn't.

Maybe you've already arrived at a different conclusion. I'm putting this out there because I'd like to hear it. Feel free to reach out, or open a discussion in the design-principles repository.