34

Working with AI and LLM tools: a verification gate

A behavior-test gate that accepts a correct AI-drafted strategy and rejects a plausible-but-wrong one.

Demo 34Source on GitHub ↗

AI tools emit fluent pattern code without judgment, so the engineer keeps responsibility through a verification gate. This module shows a return-eligibility Strategy with a correct drafted implementation and a plausible-but-wrong one (an off-by-one <= on the day-30 boundary). The gate, a parameterized behavior-test suite over the boundary table, accepts the correct draft and rejects the wrong one, turning a misclassification that looks right into a caught $40 overpayment.

The chapter covers naming the forces before prompting, a pattern name as precise vocabulary for the assistant, and reviewing AI output for justified, idiomatic, behavior-correct patterns.

Build, run, observe

cd examples/34-ai-verification-gate
mvn -q test
./demo.sh

The module also runs from the aggregator root with mvn -q -f examples/pom.xml test.