AI for coding
Pack the right inputs
Context is a curated evidence packet, not a dump of everything the tool can accept.
Before you start
Why this matters
Without opening an AI tool, write the acceptance test for this job: diagnose and repair a wrong order-total function without widening the change. Name one fact that must be exact, one judgment a person must make, and one condition that should stop the workflow. Compare your answer with the professional standard below; the gap is what you should practice.
1Learn the idea
Read
Build the input packet
For diagnose and repair a wrong order-total function without widening the change, assemble only what changes the answer: the function, failing test output, runtime and package versions, expected behavior, and the relevant API documentation. Label each item by authority and date. A source-of-truth document outranks a memory-based note; a current error log outranks a description of last month's behavior. State conflicts instead of letting the model blend them.
Use a four-part packet: task, evidence, constraints, and output contract. Put untrusted content inside clear delimiters and say that it is data, not instruction. Include representative examples, especially one normal case and one boundary case. Omit irrelevant history; excess context can hide the one line that controls the result.
Read
A concrete handoff
You are pairing on a TypeScript checkout service. The failing case has `shippingOverride=0`, but the result adds the default shipping fee. Explain the likely cause first. Then propose the smallest diff. Do not change public types or add dependencies. Return: diagnosis, unified diff, and three tests. Flag any assumption.
Before sending, annotate the packet. Mark which values are verified, which are illustrative, and which are unknown. If a screenshot is involved, transcribe critical small text. If structured data is involved, include headers, units, software version, and null behavior. If creative material is involved, record ownership and permitted use. This is how context becomes operational rather than decorative.
A useful response would look like this: The assistant identifies a truthiness fallback that replaces free shipping (0) with the default fee, changes it to a nullish fallback, and proposes tests for zero, undefined, and a positive override. That description is intentionally observable. “Looks good” is not acceptance. The operator must run the focused unit test, the full test suite, type-check, lint, and inspect the diff against the documented contract. Keep the source material beside the draft so review means comparison, not memory.
Read
Minimize and protect
The privacy boundary is specific: remove API keys, tokens, customer payloads, private repository URLs, and proprietary code not approved for the tool. Create the smallest synthetic example that preserves the problem. Replace names and identifiers consistently so relationships remain testable. Redaction is not merely drawing a box: crop surrounding notifications, remove metadata where relevant, and check that hidden sheets, comments, or revision history are not included.
Poor packets lead to predictable failures: invented library methods; broad refactors disguised as fixes; tests that merely copy the implementation; ignored error output. Another common failure is silently changing the source packet mid-run. Save a version or hash of the inputs beside the output, especially when another person will reproduce the work.
Read
Context quality drill
Rate a packet from zero to two on six dimensions: relevance, authority, recency, completeness, privacy, and reproducibility. A score below two on authority or privacy blocks the run. A low completeness score does not invite invention; it creates a question for the owner.
Continue learning · glossary & guides
- Can a reviewer distinguish supplied fact, example, and model inference?
- Could another person reproduce the run from the saved packet?
- Reference · Related concept
- Previous
- Next