AI for coding
Build a repeatable workflow
Repeatability comes from staged work, saved evidence, and an explicit recovery path.
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
The operating loop
Use this topic-specific sequence: reproduce → explain → patch → test → review. Give each stage one input, one output, and one gate. The first run should be narrow and reversible. Later automation is earned by measured reliability, not by how easy it is to connect tools.
For diagnose and repair a wrong order-total function without widening the change, begin with the job card and sanitized packet. Run the constrained prompt:
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.
Save the response beside its prompt and input version. Then apply the quality rubric and run the focused unit test, the full test suite, type-check, lint, and inspect the diff against the documented contract. A failed check returns to the smallest responsible stage; do not regenerate everything. If the source was missing, repair context. If the instruction was ambiguous, repair the prompt. If the candidate violates policy, stop and escalate rather than prompt around the policy.
Read
Roles and handoffs
Name an owner for source approval, generation, verification, and release. One person may hold several roles on a small project, but the role changes should remain visible. The reviewer needs the evidence packet, not merely the final artifact.
Define operational states: draft, needs evidence, blocked, approved, released, and rolled back. This vocabulary prevents a plausible draft from being mistaken for an approved result. Attach timeouts, retry limits, and an off switch to any automated stage.
Read
Observe and improve
Log the defect category rather than just “bad output.” This chapter's recurring defects are invented library methods; broad refactors disguised as fixes; tests that merely copy the implementation; ignored error output. Track their rate on representative cases. Review false positives and false negatives separately when classification is involved; track factual, continuity, or rights defects when producing media.
The end product is a debugging packet containing the repro, constrained prompt, minimal diff, test evidence, and reviewer checklist. A candidate patch is not working software until the local toolchain proves it. Prefer a five-line diff you understand over a polished rewrite you cannot defend. Periodically rerun a stable set of cases after changing models, prompts, source material, formulas, or settings.
Read
Recovery drill
Imagine the independent check fails after release. Identify how to stop distribution, identify affected outputs, restore the last approved version, notify the owner, and preserve enough evidence to learn. A workflow without rollback is only a happy-path demo.
Continue learning · glossary & guides
- Which artifact proves each handoff happened?
- When a check fails, which stage owns the correction?
- Reference · Related concept
- Previous
- Next