Architect Nizar Selander Unveils Probity: Strict TDD Enforcement for Agentic AI Ensures Code Quality and Confidence

Emily B. of the Modern Software Engineering channel recently delved into the critical inner loop of Test-Driven Development (TDD) when working with agentic AI, building upon previous discussions around Acceptance Test-Driven Development (ATDD). The core question explored was whether strict red-green-refactor enforcement for AI agents improves code quality and is a worthwhile endeavor. Interviewing Nizar Selander, a software architect and early adopter of agentic AI from Factor 10, revealed a prevalent challenge: AI agents often seek shortcuts, skipping TDD steps or over-implementing solutions, necessitating constant manual policing. To counter this, Sander developed TDD Guard, his initial solution for automating TDD cycle enforcement. This evolved into Probity, a more comprehensive tool capable of running various rules across different agents and environments, addressing issues beyond TDD, such as agents attempting to disable lint rules or commit without proper checks.

Sander emphasizes that TDD’s importance remains unchanged, primarily offering confidence for developers to make changes productively. Probity actively prevents over-implementation, as demonstrated in an RPG Combat coding challenge where it flagged an uncalled use method, forcing the agent to find the simplest path to pass a test. This strict adherence to TDD ensures that every test is verifiable and reliable, leading to cleaner, more concise, and maintainable code. While agents write the majority of the code, Sander maintains a supervisory role, reading and understanding all changes. He stresses the “human in the loop” is crucial for providing essential context from stakeholders and project history that agents cannot infer alone, fostering ownership and responsibility for the generated code. Although this approach incurs higher token costs and takes more upfront time, Sander views it as a valuable investment for enhanced code quality and developer sanity. His advice to improve agentic AI code quality mirrors long-standing TDD principles: test behavior, not implementation shape, and prioritize confidence over mere coverage. Probity is currently available as an early project on GitHub (probity), inviting community feedback.