VanaAPI

← Writing

A billing module between two small commits

Agents at the terminalEN2026-10-29

A legacy billing module is rarely difficult because of its length alone. The harder problem is that calculations, database reads, and historical exceptions have become inseparable. Moving a function can change when a query runs. Simplifying a condition can remove a rule that still matters.

Consider a module that calculates invoice totals, applies discounts, and writes an audit record. The comparison below follows the same refactor in two working styles: a developer working directly, and a developer delegating bounded tasks to Claude Code. It is an illustrative workflow, not a benchmark. The acceptance criteria stay identical.

§ Reading the module before changing it

Working directly: The developer traces callers, reads existing tests, and writes down observable behavior. They identify inputs, outputs, side effects, and failure paths before deciding where to split the module.

With Claude Code: The first request is inspection only: identify entry points, trace the calculation path, list side effects, and report uncertainties with file references. Explicitly prohibit edits. Ask it to distinguish facts visible in the repository from assumptions about production behavior.

Comparison: Delegation can reduce navigation work, but a plausible summary is not proof. Check references and inspect the important callers yourself. Neither approach can recover undocumented business intent from code alone.

§ Capturing behavior before improving structure

Working directly: The developer adds characterization tests around the existing public function. Useful cases include an empty invoice, a discount boundary, fractional amounts, and a failed audit write. Expected results come from observed behavior and confirmed requirements.

With Claude Code: Request tests for those same cases before requesting a refactor. Require the agent to explain what each assertion protects and run the relevant test command. Review fixtures carefully: generated expectations can accidentally encode the behavior the agent wants to introduce.

Comparison: Both routes need an independent oracle. If rounding looks suspicious, preserve it during this change and record a separate question. A structural refactor should not silently become a billing-policy correction.

§ Extracting one boundary at a time

Working directly: The developer separates pure calculation from persistence, keeps the public interface unchanged, and reviews the diff after each extraction. Query order and exception handling remain explicit review points.

With Claude Code: Give one narrow instruction: extract the calculation into a pure function, preserve rounding and exception behavior, leave persistence in place, and avoid unrelated formatting or dependency changes. Name the allowed files and ask the agent to stop if a wider change appears necessary.

Comparison: The agent-assisted route needs a more explicit task boundary. That effort is useful: it turns an informal intention into reviewable constraints. If the diff expands beyond them, narrow or revert it rather than accepting the expansion because tests pass.

§ Reviewing evidence, not the completion message

Working directly: The developer inspects the patch, runs focused tests, then runs the broader checks appropriate to the repository. They compare both returned values and observable side effects.

With Claude Code: Ask for the exact commands executed, their outcomes, and any checks that could not run. Then inspect the diff independently. A statement that the refactor is complete does not establish that integration tests ran or that database access stayed unchanged.

Comparison: Use the same merge standard in both cases. Tests provide evidence, not exhaustive equivalence. Keep the extraction and any later cleanup in separate commits so reviewers can isolate the behavioral risk.

§ Keeping access separate from the refactor

Vana API can provide the model connection for this workflow. Its endpoint, https://api.vanaapi.com, supports OpenAI-compatible requests as well as Anthropic Messages and Gemini native protocols. For Claude Code, follow the documented Anthropic-compatible configuration rather than assuming OpenAI SDK settings are interchangeable.

A model such as Claude Sonnet 5.5 can handle the delegated sessions. Vana API bills per real token with no monthly fee; repeated repository reads and broad test output still deserve attention. Create a Vana API account if you want to try this workflow through one endpoint.

The useful outcome is not a larger patch produced sooner. It is a smaller change whose preserved behavior can be explained. Claude Code can assist with tracing, testing, and extraction; responsibility for the boundary and the evidence remains with the developer.