A deterministic review pipeline for AI-assisted Python development covering scope, types, tests, security, architecture and human ownership.

Production principle

Constrain the task, require deterministic evidence and keep a human owner accountable for every architectural and operational decision.

Degraded
# Prompt: add retry support
for attempt in range(10):
    try:
        return requests.post(url, json=data)
    except Exception:
        time.sleep(1)
return None
Repaired
def send(command: DeliveryCommand, client: HttpClient) -> DeliveryResult:
    return retry(
        operation=lambda: client.post(
            command.url, command.payload,
            timeout=command.deadline.remaining,
            idempotency_key=command.id,
        ),
        policy=TRANSIENT_DELIVERY_POLICY,
    )
01

Constrain context and scope

Give an agent the relevant contract, local conventions and explicit acceptance criteria, not unrestricted authority to redesign adjacent systems. Small reviewable changes produce better feedback than broad prompts whose hidden assumptions are difficult to enumerate.

Never place production secrets, personal data or confidential logs in a model prompt. Use sanitized fixtures and the minimum repository context required for the task.

02

Make evidence deterministic

Formatting, linting, type checking, tests, dependency scanning and architecture rules should run automatically regardless of who wrote the code. Generated tests are not independent evidence when they simply encode the same mistaken assumption as the generated implementation.

Add failure cases and assertions from the contract before accepting implementation. Inspect changes to authentication, migrations, concurrency and external effects with the same scrutiny as handwritten code.

03

Preserve human ownership

A reviewer must be able to explain the code, its failure modes and why its abstractions fit the system. If nobody can maintain the generated solution without the original conversation, the change is not production-ready.

Record meaningful design decisions in code, tests or an architecture note rather than depending on prompt history. Delete speculative abstractions and dependencies that do not serve the accepted scope.

Review checklist

Evidence to take into review

  • The prompt contains no secrets or sensitive production data.
  • Scope and acceptance criteria are explicit before generation.
  • Independent tests cover failure and boundary behaviour.
  • Static, security and architecture gates run in CI.
  • A human reviewer can explain and own the final change.
Continue the inspection

Explore all engineering notes.

Use PRODUCTION-7 to connect this concern with the other dimensions of a trustworthy backend.

View all articles Get the checklist