Use before implementing or refactoring software. Contains two skills: (1) Modular Software Design — for designing module boundaries, APIs, layers, abstractions, services, repositories, adapters, or architecture, helping reduce total system complexity by creating deep modules, hiding implementation knowledge, avoiding leakage and pass-through APIs, comparing alternative designs, documenting interfaces before coding, and critiquing existing architecture; and (2) Software Testing — for writing unit tests, integration tests, or end-to-end tests, creating mocks/stubs/fakes, designing a testing strategy, doing TDD, reviewing test quality, fixing flaky tests, or refactoring test suites, generating risk-focused test plans, picking appropriate test levels, choosing between mocks/fakes/real dependencies, and applying Arrange-Act-Assert patterns with concrete examples.
93
94%
Does it follow best practices?
Impact
92%
1.12xAverage score across 5 eval scenarios
Passed
No known issues
A checkout service repeats promotion calculation in cart preview, checkout, and invoice generation. Product plans seasonal codes, employee discounts, and partner-specific rules. Propose and sketch a small refactor so callers can apply promotions without coordinating rule ordering or provider quirks.
Produce design_brief.md, promotions.py, and architecture_result.md.
Input:
def preview(cart, user, code):
total = sum(i.price * i.qty for i in cart.items)
if user.employee: total *= .85
if code == 'SPRING': total *= .90
return total
def checkout(cart, user, code, gateway):
total = sum(i.price * i.qty for i in cart.items)
if user.employee: total *= .85
if code == 'SPRING': total *= .90
gateway.charge(user.card, total)
return total