- Draw the three-step data path and label each value type.
- List four accepted/rejected quantity cases and the expected error shape.
- Ask an assistant to challenge the invariants, then retain only claims supported by the fixture.
A short function can sit inside a larger contract that its author never wrote down. An AI suggestion may look reasonable while breaking a caller, changing a saved record or widening a permission boundary. Start by reconstructing what the current code promises, using a small fictional repository.
Follow an input to its consumer
The fixture contains parseQuantity, a checkout caller and a saved-order reader. Trace the value through all three instead of asking an assistant to rewrite the first file immediately. Record whether the input arrives as text, what happens to an empty string and which error shape the caller expects. A function name is not a specification. The caller may depend on an unusual behavior, so mark each observation as existing behavior or proposed requirement rather than quietly treating your preferred design as the current contract.
Write invariants as testable statements
Turn the trace into explicit invariants: accepted quantities are whole numbers from one through nine, invalid input returns a named error and the saved order keeps a numeric quantity. Include a legitimate zero-like string as a rejected case rather than relying only on a happy path. These statements constrain the patch without prescribing its implementation. An assistant can identify missing cases, but verify its claims in the supplied code and label any unobserved assumption before adding it to the requirement.
Ask for a change inside the mapped boundary
Give the assistant the relevant excerpts and your invariant list, then request an explanation of the smallest change. Compare its proposed files with the call graph you drew manually. A new storage format or an unrelated UI rewrite needs separate justification. Preserve the original fixture and record how to revert the patch. This small preparation makes later test failures interpretable: you can distinguish a genuine contract regression from a deliberate change that still needs migration or caller updates.
Fictional worked example — Quantity contract
Supplied input
"2" → parseQuantity → checkout → saved order
Example result to inspect
2 accepted; "0", "2.5" and "" rejected with quantity_invalid
This is a hand-worked contract table, not an executed application or model result.
This is an authored teaching example, not a recorded live provider run or an independent performance test.
Make the idea concrete.
- Draw the three-step data path and label each value type.
- List four accepted/rejected quantity cases and the expected error shape.
- Ask an assistant to challenge the invariants, then retain only claims supported by the fixture.
What a useful outcome looks like
A caller trace and explicit cases define the compatibility boundary more reliably than naming or confidence.
Ask for reasoning you can verify.
Use fictional or permitted data. This is a copyable brief for a separate approved model; no model is called from this article.
Help me review this fictional coding with ai exercise: Map callers, inputs and invariants before requesting a change. I will supply the original input, my expected result and the actual transformation. Explain quantity boundary, identify unsupported assumptions about unobserved assumptions, and propose one bounded negative control. Keep observations separate from hypotheses; do not invent output or act on external systems.
Turn reading into a reviewed checkpoint.
Complete the manual exercise, review each item, then answer the evidence question. This records self-study, not independent assessment of expertise.
Review the checklist and pass the question to save this lesson.
Primary references
References support further checking; cited organizations do not endorse AgentX. This guide is original AI-assisted educational content with illustrative examples. Read the editorial policy or report a correction.
Continue with a related task.
Request a minimal diff with explicit exclusions
Keep an AI-assisted patch focused enough to review and revert.
Test the requirement rather than the generated implementation
Use independent examples to challenge an AI-written function.
Check dependency advice against the installed version
Ground AI coding advice in the project lockfile and official API documentation.