A professional session follows inspect → plan → edit → verify → review. Claude’s final explanation is not evidence; the diff, tests, and observed behavior are.
Define the Task Contract
State exact behavior, scope, and checks:
Problem: negative quantity is accepted
Required: reject non-integer and non-positive quantity
Preserve: valid quotation totals and public API
Allowed files: src/quote.ts and tests/quote.test.ts
Verify: npm test and npm run lint
Stop: unclear requirement or same failure twice
Ask Claude to inspect before editing. Review its understanding and file list. A plan is useful when it exposes assumptions; it is not permission to expand scope.
Make the Change Reviewable
Keep the patch small. Avoid unrelated formatting, dependency upgrades, or generated-file churn. Run targeted tests first, then broader relevant gates. Read the diff yourself and test an edge case the model did not mention.
If a command is destructive, changes external state, accesses credentials, publishes, deploys, sends a message, or modifies production data, stop and use a separate authorized workflow.
Worked Example
Claude reads the quotation function and tests, proposes an integer/positive guard, and edits two files. The targeted tests pass. The developer inspects the diff and adds a maximum-quantity business rule only after confirming that it is actually required; it is not smuggled into the first patch.
An independent command run confirms lint and tests. git status shows only the intended files. The completion note names behavior, evidence, and remaining assumptions.
Failure Cases to Diagnose
- “Fix this” with no observable requirement: write acceptance criteria.
- Agent edits before inspecting: restore and begin from current facts.
- Test rewritten to accept the bug: compare against the requirement.
- Large formatting diff hides logic: separate mechanical changes.
- Command output assumed successful: check exit code and relevant result.
- Untracked generated files ignored: review complete status.
🇵🇰 Pakistan Angle
Test exact PKR handling with integers or decimal-safe types; floating-point shortcuts can corrupt money. Use local examples but label sample tax, delivery, or discount rules rather than inventing legal or business policy.
For freelance work, preserve client changes already in a dirty worktree. Do not reset or overwrite unknown edits. Record what you changed and let the client reproduce checks without access to your Claude session.
Hands-On Exercise
- Write a bounded bug contract.
- Ask for inspection and plan only.
- Approve the smallest edit.
- Run targeted and broader checks independently.
- Review diff/status and produce evidence-based handoff.
Completion Rubric
- Required and preserved behavior are explicit.
- File and command scope are bounded.
- The diff contains no unrelated change.
- Tests represent requirements, not implementation.
- Checks are independently verified.
- Handoff names assumptions and evidence.
Sources
- Anthropic — Claude Code common workflows
- Anthropic — Claude Code best practices
- GitHub Docs — Reviewing changes
Key takeaway: treat Claude Code output as a proposed patch; completion comes from a small diff and independently reproducible behavior.