Skip to content

devlog/model-bench/claude-opus-55-and-sonnet-55-refactor-a-cli-286.md

Claude Opus 5.5 and Sonnet 5.5 Refactor a CLI

Claude Opus 5.5 and Sonnet 5.5 at the Same Git Checkpoint

A multi-file refactor gets interesting when the compiler stays green but behavior changes. Moving a request helper is easy. Preserving retry limits, cancellation, error messages, and configuration precedence across every caller is the actual job.

Here is a side-by-side walkthrough for Claude Opus 5.5 and Claude Sonnet 5.5 on that problem. This is an illustrative engineering comparison, not a report of executed model runs. There are no invented timings, token counts, or pass rates. The verdict is about which model I would assign first, and what evidence would justify keeping it there.

The Refactor: Extract a Shared Client Without Changing CLI Behavior

The repository is a TypeScript CLI with duplicated HTTP logic in three commands. The task is to extract a shared client, centralize configuration, and preserve existing output and exit codes. The change crosses command handlers, transport code, configuration parsing, and tests.

I would create two worktrees from the same commit, provide identical instructions, and give both models the same tool permissions. Neither branch gets hints discovered while reviewing the other. The prompt asks for an initial dependency map, implementation, regression tests, and a final explanation of behavior preserved.

  • Configuration flags must continue overriding environment variables and stored defaults.
  • Cancellation must stop pending requests without triggering another retry attempt.
  • Authentication failures must preserve existing messages and command exit codes.
  • The refactor must avoid unrelated formatting changes and dependency upgrades.

Claude Sonnet 5.5: The Bounded Implementation Lane

For Claude Sonnet 5.5, I would start with a tightly scoped contract: inspect all callers, propose the shared interface, then implement it without redesigning the command layer. The useful deliverable is a small, reviewable patch, not an impressive new abstraction.

The review question is whether centralization actually happened. A helper that accepts fifteen options while callers still assemble headers and interpret transport errors has mostly relocated duplication. I would search the repository for the old request function, authorization-header construction, and retry loops before accepting the branch.

If this branch preserves behavior with a clean interface and targeted tests, it wins the implementation task. There is no reason to escalate simply because another model is available. That is an acceptance rule, not a claim that this model has already passed it.

Claude Opus 5.5: The Cross-File Reasoning Lane

For Claude Opus 5.5, I would use the same prompt and inspect the same acceptance criteria. Its proposed assignment is the ambiguity-heavy version of the work: tracing where configuration becomes immutable, deciding which layer owns retries, and checking whether cancellation survives every wrapper.

I would scrutinize architectural changes just as hard. A broader explanation does not justify a broader patch. If the model introduces a transport interface, factory, and error hierarchy, each addition needs a concrete caller or preserved invariant. Otherwise, I would ask it to simplify.

The decisive comparison is not which explanation sounds more senior. It is which branch makes behavior easier to verify while leaving fewer hidden assumptions.

The Terminal Checks That Decide This Refactor

On each branch, I would run type checking, linting, unit tests, and CLI integration tests. Then I would add adversarial cases: cancellation during retry backoff, an empty environment variable, and an authentication error returned through the new client. Finally, I would inspect the diff manually. Passing tests cannot expose a behavior nobody asserted.

Fluxo makes this workflow easier to wire into an editor-and-terminal setup: one key and the base URL https://api.fluxorelay.com cover Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok, and more. It works with Claude Code, Codex, Gemini CLI, and any OpenAI SDK. Tool compatibility does not imply identical model features, so keep settings comparable and record any differences.

The Verdict: Sonnet First, Opus for Unresolved Risk

My assignment verdict is Claude Sonnet 5.5 first for this bounded refactor, with Claude Opus 5.5 reserved for unresolved cross-file invariants or architectural ambiguity. That is a workflow recommendation, not a measured capability ranking. Promote whichever branch produces the clearer, verified patch.

Track actual usage rather than assuming the smaller-looking change costs less. Fluxo bills per real token, including cache reads and writes, with no monthly fee. Users also earn a referral share when people they invite pay. If you want to try this two-worktree routine, consider creating a Fluxo account.

Next in the buffer

Sign up in a minute and get credit to try every model mentioned here. Sign up →