Gusto removes OpenStruct from its Ruby codebase with a Claude Code skill and a two-agent refactor-and-benchmark team, grouping PRs by owning team, turning a months-long refactor into weeks with 25-39x faster instantiation
OpenStruct had spread across Gusto's Ruby codebase: hundreds of instances across dozens of teams, each 20-50x slower to create than a Struct or Hash and using ~15x more memory. Jose Miguel Colella used agentic workflows to remove it, and found the hard part was decomposing the work for review rather than generating code. One giant PR was ruled out. One PR per pack produced dozens of PRs within an hour but caused reviewer fatigue, since one team owns many packs. Switching to one PR per owning team (batched for large teams) immediately improved review throughput. He packaged the process as a Claude Code skill: scan for the pattern, group by team, generate replacements, open one PR per team, and measure before and after. A two-agent team ran it: a refactorer in a git worktree that also fixed failing tests and opened PRs, and a performance analyst that benchmarked each batch with benchmark-ips and memory_profiler so PR descriptions carried the numbers. A GitHub issue tracked progress and served as memory between Claude Code sessions. OpenStruct was removed entirely.
The numbers (as reported)
| Duration | A refactor that would have taken months, compressed into weeks |
|---|---|
| Instantiation (one team's batch) | 25-39x faster |
| Memory (one team's batch) | Over 90% reduction |
| Reads (one team's batch) | Above 1.5x faster |
| Scope | Hundreds of OpenStruct instances across dozens of teams, removed entirely |
Facts
- Company / subject
- Gusto
- Tools
- Claude Code
- Codebase
- brownfield
- Work type
- Refactor / maintenance
- Stack
- Ruby, benchmark-ips, memory_profiler
- Published
- 2026-03-27
- Last checked
- 2026-11-23
What the source claims Practitioner (own blog/paper)
Claimed by the builder, writing about their own work. Not checked independently.
- A refactor that would have taken months was done in weeks months → weeks
“A refactor that would have taken months got compressed into weeks.”
- OpenStruct was removed entirely from the codebase
“We removed a deprecated pattern entirely from the codebase”
- One team's batch showed 25-39x faster instantiation and over 90% less memory 25–39x faster; >90% less memory
- Grouping PRs by owning team immediately improved review throughput
“Review throughput went up immediately.”
Caveats
Written by the engineer who did the work on Gusto's engineering blog. The performance numbers are micro-benchmarks for one team's batch, not production measurements. No exact instance, PR or duration counts are given; 'months into weeks' is the author's estimate.
More stories by tool: Claude Code
Related topics: Refactoring and maintenanceBrownfield codebases