Unit 15 · lesson

Prompt, Inspect, Verify

A prompt is not a spell. It is the beginning of a change request.

The safest mental model for AI-assisted coding is the same one you would use for a pull request from an unfamiliar contributor:

REQUEST

CANDIDATE CHANGE

INSPECT THE DIFF

VERIFY BEHAVIOR

COMPARE WITH REQUIREMENT

ACCEPT / REVISE / REJECT
Interactive model

Prompt, inspect, verify — then decide

AI output is a candidate change. Human review and evidence determine whether it is accepted, revised, or rejected.

Drag nodes to inspect the relationships. Motion shows the active path; the plain background keeps attention on the relationships instead of graph-paper decoration.

View static diagramStatic AI-assisted development review loop

Write boundaries another developer could review

Weak request:

Add CSV export.

The missing decisions are obvious once you ask what “done” means:

  • Which records are exported?
  • Which fields?
  • Which filename/path?
  • What happens for an empty list?
  • Can dependencies be added?
  • Which files may change?

A bounded request might be:

Goal: export player name and score to export.csv.
Current data: list of dictionaries with name and score keys.
Constraint: Python standard library only.
Allowed files: reports.py and tests/test_reports.py.
Required cases: multiple players and empty list.
Do not change storage.py or the Player data shape.

The stronger request is easier to review because it defines what should and should not move.

Ask for a plan when the blast radius is unclear

Before generating code, you can request:

Describe the files and functions you expect to change. Do not write code yet.

If the plan proposes a database migration for a two-function console feature, you can reject the architecture before it becomes a 500-line diff.

That is cheaper than repairing over-generation.

Inspect exact changes, not the summary

Suppose the tool says:

Added CSV export and tests.

That is a claim.

Use repository evidence:

git status
git diff

Ask:

Which files changed?
Which imports changed?
Were dependencies added?
Did existing interfaces change?
Were tests deleted or weakened?
Did formatting noise hide the functional change?
Is every changed line connected to the task?
AI Code Review Diff
AI Code Review Diff

Diagrams open at a readable shape-aware scale. Zoom or expand when you need more detail.

A small requested feature that changes twelve unrelated files deserves investigation even if every test is green.

Verification has multiple layers

For a candidate feature, use more than one kind of evidence when appropriate.

Static inspection

Can you explain the code and imports? Does it follow project boundaries?

Automated tests

Run the existing relevant suite plus new tests.

python -m pytest

Manual behavior

Exercise the feature using a normal case and an edge/failure case.

Requirement comparison

Return to the original request. Did the implementation solve the requested behavior without inventing new scope?

A candidate can pass tests and still violate a dependency or privacy constraint.

Generated tests are candidates too

Consider the requirement:

Export name and score only.

Candidate implementation:

def export_players(players):
    fieldnames = list(players[0].keys())
    ...

Candidate test:

def test_export_players(tmp_path):
    players = [{"name": "Nova", "score": 10, "secret_note": "x"}]
    export_players(players)
    assert output_file.exists()

The test passes even if the private/unwanted field is exported.

The problem is not that the test is syntactically bad. It tests the wrong claim.

A stronger test inspects the actual fields:

assert rows[0] == {"name": "Nova", "score": "10"}

This is why requirement review cannot be delegated to the same generation loop without inspection.

A plausible solution can still violate the specification

Requirement:

Standard library only.
Export name and score only.

Candidate:

import pandas as pd


def export_players(players):
    pd.DataFrame(players).to_csv("export.csv", index=False)

That may create a CSV successfully.

It still fails review because:

  • it adds an unauthorized dependency; and
  • it exports every field in each record rather than the required two fields.

The correct decision is revise or reject.

Working output is necessary. It is not sufficient.

Use a rejection record

When you reject or revise a candidate, keep a short record:

CANDIDATE CLAIM:
EVIDENCE CHECKED:
PROBLEM FOUND:
DECISION:
NEW BOUNDARY / REQUIREMENT:

That turns “AI gave bad code” into a useful engineering history.

Privacy is part of the prompt boundary

Before sending context to any tool, classify it.

SAFE TO SHARE IN APPROVED TOOL
REDACT / REPLACE WITH FIXTURE
DO NOT SHARE

A traceback can contain local usernames or paths. A configuration file can contain tokens. A dataset can contain personal records.

Use minimal, sanitized context needed for the technical question.

No-tool path

If your environment does not provide an AI assistant, review the supplied candidate patch for this Unit.

Run the exact same loop:

read requirement
inspect candidate
run tests/checks
compare behavior
accept/revise/reject

The course is testing developer judgment, not access to a particular product.

Vocabulary lab

Flip the idea, not just the card

Explain the term before you reveal the back. Then compare your explanation with the definition, example, and warning.

1 / 5
Read all terms without animation
Prompt Boundary
An explicit limit on the requested change, assumptions, files, dependencies, or behavior. Example: Modify only reports.py and its tests; add no dependencies. Do not confuse it with: A guarantee that a generated response will obey the limit.
Diff Review
Inspection of the exact repository changes proposed by a candidate implementation. Example: Using git diff to inspect changed lines before acceptance. Do not confuse it with: Trusting the assistant's summary of its own work.
Verification
Collecting execution, test, inspection, and requirement evidence to determine whether a candidate behaves acceptably. Example: Running the suite and checking the exported CSV fields. Do not confuse it with: Assuming correctness because the code looks professional.
Self-Confirming Test
A test that agrees with a generated implementation while both encode the same misunderstanding of the requirement. Example: Testing only that a CSV exists while the requirement restricts which fields may be exported. Do not confuse it with: Independent requirement-based verification.
Rejection Record
A short engineering record explaining why a proposed change was not accepted and what evidence caused the decision. Example: Rejecting an unauthorized dependency after diff inspection. Do not confuse it with: Deleting a response with no trace of what was learned.