Strong types are a non-negotiable for LLMs

Claude writes better code than most humans now. The work that's left is system design, code quality, and staying on top of the agent so it actually ships something good.

The best way to build a codebase where agents can confidently make changes is to lean hard on the type system. That doesn't just mean using TypeScript. It means no any, exhaustive pattern matching, discriminated unions, branded types, the whole toolkit. Done well, your types become self-documenting, and that's exactly what LLMs thrive on.

This barely comes up in engineering circles. We talk about slop, shipping fast, security issues. But it's underappreciated how much the type system shapes what an agent can do. I've seen it first-hand at HireUp.

  • Type check. Sounds simple, but it's a real unlock. It's always been an unlock for human coders too, but with agents you can let them run with some assurance they aren't breaking things. You can even instruct them to type check between changes to keep them honest. If you've ever been bowling, the type check is like putting up the gutter bumpers. There's only so much you can mess up.
  • Self-documenting code. This is where the magic happens. All the information an agent needs is baked right into the code itself. A typed interface makes the shape of the data obvious. A discriminated union spells out every case that needs handling. An exhaustive match guarantees you've covered all of them. This isn't a nice-to-have. It's the context an agent needs to make informed decisions about what to change.
  • Escape hatches. Just like with human coders, agents are tempted to take shortcuts to get the code compiling. But these become obvious red flags when I review the changes. Forced type casts, sprinkles of any, overlapping interfaces. They all point to a deeper issue. Maybe the abstraction is wrong. Maybe it's time for a refactor. Maybe the types themselves need to be rethought.

The crazy thing is none of this is new. These patterns have always paid off for humans. But with agents in the loop, the leverage has gotten absurd. The cost of maintaining good types has dropped, since the agent is doing most of the writing. And agents work with limited context, so having everything baked into the types pays off enormously.

In a world where unstructured code is cheap to produce, quality is the differentiator. A strongly-typed codebase where agents can work quickly and confidently isn't a luxury anymore. It's table stakes for any serious engineering effort.