A coding assistant offers a function that calculates how many tables an event needs. It looks concise, and the explanation sounds confident. Before accepting it, can you predict what it does when the attendance does not divide evenly by the number of seats?
Before you begin: Know how to read a short Python function. You can follow the exercise without installing a coding assistant.
Treat generated code as a proposed change
Coding tools can suggest a line, explain a file, edit several files, or run commands with configured permissions. Products such as GitHub Copilot and Claude Code expose different workflows. The useful distinction is the scope of the action: a suggestion you accept, a file change you review, or an operation the tool performs.
Start in a small project with a clean checkpoint. Ask for one behavior and inspect the resulting change. A large unrelated rewrite makes it harder to understand whether the original problem was solved and whether new problems were introduced.
Find the bug before asking for a fix
Consider this illustrative snippet:
def tables_needed(people, seats):
return people // seats
For 16 people and four seats, it returns four. For 18 people, it also returns four because integer division discards the remainder. That is insufficient capacity. The requirement needs rounding up, not merely division.
Tell the assistant the intended behavior, including zero attendees and invalid seat counts. Ask for a small correction and tests that exercise the boundary. Avoid asking it only to “improve this code,” which leaves the success criterion unclear.
Read the corrected program
This complete Python 3 program uses no external packages. It defines inputs as integers, rejects invalid values, and checks both exact and partial tables.
# Runnable: Python 3, standard library.
def tables_needed(people, seats):
if type(people) is not int or type(seats) is not int:
raise TypeError('Use integer counts')
if people < 0 or seats <= 0:
raise ValueError('People must be nonnegative and seats positive')
return (people + seats - 1) // seats
assert tables_needed(16, 4) == 4
assert tables_needed(18, 4) == 5
assert tables_needed(0, 4) == 0
try:
tables_needed(3, 0)
except ValueError:
pass
else:
raise AssertionError('Zero seats must be rejected')
print('Capacity examples passed')
The expression adds enough before division to round a positive remainder up. The tests do more than repeat the function's implementation: they encode examples from the requirement. Predict the result for one person before running it.
Check what the assistant could not know
This function assumes every table has the same capacity and all tables can seat attendees. If a table holds supplies or a venue has layout restrictions, the requirement changes. A coding assistant cannot infer every real-world constraint from a function name.
Ask it to state assumptions, then compare them with your application. Check dependencies, error handling, and how callers use the result. Passing a few tests establishes those cases, not universal correctness.
Inspect tool actions separately
Before allowing command execution, understand the command and its scope. Installing packages, changing database records, and publishing a site are different actions from editing a local function. Keep credentials out of prompts and logs, and use the project's actual access controls.
Review the diff, which shows changed lines, and run the relevant project checks. A message saying “tests passed” is evidence only when the tests were actually executed and their result is available. Do not confuse generated test code with a successful test run.
Investigate a passing but incomplete test
An assistant tests only tables_needed(16, 4) and reports success. Why is that insufficient for the original bug?
Choose a test that can fail for the bug
Sixteen divides evenly by four, so both the incorrect and corrected functions return four. A non-divisible case such as 18 people distinguishes them. A useful regression test would fail under the old behavior and pass when the requirement is repaired.
Next, we will apply this review habit to an entire generated app, where a convincing screen can hide missing data behavior.
References
GitHub's responsible-use documentation discusses Copilot feature limitations. The Claude Code overview describes its coding workflow. Consult current product controls before granting tool permissions.