Write the invariants before the request
Suppose a cart total is calculated in several handlers. A shared helper may make the calculation easier to maintain, but a refactor should not also change discounts, rounding, invalid-input handling, or the response shape. List these constraints before asking LoopCode to edit.
The example below is an illustrative workflow, not a claim that LoopCode ran a benchmark. Adapt its paths and test commands to your repository.
Extract the repeated cart-total calculation into one helper.
Preserve rounding, empty-cart behavior, discounts, and the
response shape. Map callers first and show me the approach.
Keep the public API unchanged. Do not upgrade dependencies.
Add coverage for behavior we depend on and run the relevant checks.Establish a baseline you can return to
An existing bug can still be part of a compatibility decision. Decide separately whether to preserve it temporarily or fix it deliberately. Combining a redesign, dependency upgrade, and bug fix makes review harder because a failed check has more possible causes.
- Review the current working tree and create an appropriate Git checkpoint.
- Run existing tests and record unrelated failures.
- Read the public interfaces, callers, and edge-case tests.
- Add characterization tests for behavior that matters but lacks coverage.
Use semantic context, then keep the patch small
When a language server is available, use definitions and references to map the helper's callers. Read the callers rather than assuming they all use the same units or optional values. Search for serialized field names and dynamic usage that references may miss.
Use Plan mode when you want to review the proposed extraction. After approval, ask for one structural step at a time. A useful patch leaves compatibility at the boundary and makes internal intent clearer without spreading unrelated formatting changes across the repository.
Review behavior, types, and the patch together
Ask the agent to state which checks actually ran, their results, and what remains uncertain. Inspect changes to tests carefully: replacing an assertion with the new implementation's output can conceal a regression. Merge only after the evidence meets the requirements you set.
| Check | What it can establish | What it cannot establish alone |
|---|---|---|
| Characterization and regression tests | Selected inputs preserve expected behavior | Coverage of every production input |
| Compiler or type check | Static interfaces remain compatible | Correct runtime values |
| Diff and caller review | Scope and assumptions are visible | Successful execution |
| Browser interaction for a web app | An observed user flow behaves as expected | All devices and hidden backend paths |
KEEP GOING
A useful next step.
Put it to work in your project.
Desktop, CLI, and VS Code. One LoopCode account. Free to start.