Spec-first AI coding: writing boring scenarios before C# code is generated
A developer describes writing acceptance scenarios for a coupon-redemption feature in .NET 10 before letting an AI coding agent implement it. The example centers on a coupon that should work on a retry after an initially rejected cart, illustrating how unstated rules can lead code to consume a coupon on a failed attempt. The spec was written in GitHub Spec Kit's layout, with each scenario mapped to an ID that is run as an xUnit test, totaling 37 tests. The author lists practices such as giving every scenario an ID, testing boundaries from both sides, and naming the clock and time zone. A test that cross-checks spec IDs against test data keeps the document and the test suite in sync.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in