AI coding agents need software engineering guardrails

Jul 22, 2026

Problem

LLMs cannot reliably remember every rule in your codebase:

  • your coding style guide
  • how to write a database query returning multiple records in a deterministic order
  • add type specs to functions
  • soft deleting a record instead of hard deleting it
  • etc ...

Every time you tell an LLM to remember a rule, you're paying for that rule on every generation. The model may forget it, misunderstand it, or decide another instruction is more important. It is very tempting to pack a huge list of instructions into the LLM's prompt or even a review agent but:

  • it is slow
  • it is expensive
  • and above all, it is non-deterministic.

Engineering rules are different. Once you've decided that all public functions need typespecs, or that queries should always have deterministic ordering, there's little value in asking an AI agent to rediscover those rules every time it writes code.

Which is why, with LLMs, I always ask myself:

Can this probabilistic output be made deterministic so producing the output is faster, cheaper, and more reliable?

Solution

Encode engineering policies as deterministic guardrails enforced by:

Each tool encodes a different kind of rule. Formatters eliminate debates about syntax. Type checkers and static analyzers catch invalid assumptions. Linters and structural code checks can enforce project-specific conventions and code patterns. Tests protect behavioral invariants. Security checks detect known vulnerabilities and unsafe patterns. Architectural checks enforce dependencies and boundaries between components.

Instead of asking AI to remember your policies, configure tools that enforce them consistently.

Ensure those guardrails run throughout the software development lifecycle:

  • prevent commits and pushes when a guardrail fails
  • fail CI when a guardrail fails

When a policy is violated, its error message should clearly explain what policy was violated, why it exists, and whether bypassing it is ever appropriate.

Conclusion

If you find yourself repeatedly reminding an AI agent about the same engineering rule over again and again, stop and ask yourself if you could encode that rule as a deterministic guardrail. In the next article, we will look at how to build them.

https://ryanzidago.com/posts/feed.xml