Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Code Migration at Scale: AI Agents and RuboCop

Avatar for George Ma George Ma
September 26, 2025

Code Migration at Scale: AI Agents and RuboCop

Learn how to automate large-scale code migrations by leveraging AI Agents to write Rubocop Cops

Avatar for George Ma

George Ma

September 26, 2025
Tweet

More Decks by George Ma

Other Decks in Programming

Transcript

  1. George Ma - Rails World 2025 Code Migration at Scale

    AI-Powered Test Driven Development
  2. Agenda - ❗Why agentic tooling alone was suboptimal - 💚

    Why a combination of Test Driven Development, RuboCop and agentic tooling succeeded
  3. 10,000+ instances/ 3000+ files Migrate all these instances to the

    new Rails Structured Logger ❗Why agentic tooling alone was suboptimal
  4. Base hash merged with additional parameters Kwsplat combined with explicit

    key-value pairs ❗Why agentic tooling alone was suboptimal
  5. - Read files one at a time, manually approve changes

    - Frequent hallucinations - Barely faster than performing manual edits and claude-3.5
  6. and claude-4.0 - Sub-tasks (better parallelization) - Great when the

    task at hand is simpler / smaller in scope - Imperfections when the prompt is too granular
  7. - Great when the task at hand is simpler /

    smaller in scope and claude-4.0 - Sub-tasks (better parallelization) - Imperfections when the prompt is too granular
  8. +

  9. 💚 Test Driven Development Step 0: Start with a new

    Cop and its corresponding test Cop Cop_test
  10. - Provides a base-line for Cop development / correctness -

    Prevents regressions as you add additional cases 💚 Test Driven Development
  11. Step 2: Ask Claude to create the Cop’s autocorrect logic

    to pass this test case 💚 Test Driven Development
  12. Step 2.5: Repeat steps 1 & 2 until all cases

    are autocorrectable 💚 Test Driven Development
  13. - Less token use/time spent waiting for agents to run

    - Leverage TDD and agentic tooling’s strengths to write the Cop itself - Cop that produces deterministic results every time 🚀