Saltar al contenido

12. Safe Refactoring of Legacy Code (Characterize, Change, Verify)

29 de septiembre de 2026 · 45 min

Notas del episodio

In Episode 12 of Beyond Prompting, we tackle one of the most high-stakes tasks in software engineering: letting an AI agent refactor an existing codebase. Author Sho Shimoda breaks down why asking Claude to "modernize this module" in one giant prompt usually results in hundreds of changed lines, broken production, and hours spent untangling regressions. In this episode, we cover:

    • The "Big-Bang" Trap: Why a single commit touching twelve files leaves you with twelve suspects when tests go red, and why working in small, single-purpose steps makes debugging instant.
    • Characterization Tests First: How to lock down the current behavior of legacy code by generating tests before refactoring, creating a behavioral safety net when no specification exists.
    • The 4-Step Refactoring Loop: Forcing Claude into a disciplined cycle—list distinct changes smallest first, execute one change, verify against characterization tests, and commit before moving to the next.
    • Reviewing Agent Diffs: How to review AI-generated code for subtle failure modes (like changed return contracts or deleted code paths) and using /code-review as a mechanical first pass.
    • Checkpoint Rewinds: Using Esc Esc or /rewind to instantly restore conversation and file state to an earlier checkpoint when an exploration fails.

(Note for listeners: This episode covers Chapter 12 of Sho Shimoda's book RUNNING CLAUDE: The Operator’s Guide to Chat, Cowork and Claude Code, available on Amazon as the successor book to Master Claude: Chat, Cowork and Code).

Todos los episodios de Master Claude Chat, Cowork, Code

Ajustes

Visualización

Idioma

Determina qué emisoras ves primero en la página de inicio.

Historial

Las emisoras y episodios escuchados recientemente y tus últimas búsquedas solo se guardan en este navegador.

Avisos

Un breve aviso cuando un pódcast que sigues tiene un episodio nuevo. Puedes desactivar pódcast concretos con la campana de su página.

Cuenta

Guarda tus favoritos: en la app y en la web.

Atajos de teclado

/
Abrir búsqueda
Espacio
Reproducir o pausar
← →
En el reproductor: 15 s atrás, 30 s adelante (episodios) · en una fila: siguiente tarjeta
↑ ↓
En una fila: destino dentro de la tarjeta
Inicio / Fin
En una fila: primera o última tarjeta
Esc
Cerrar ventana o menú
?
Este resumen
Reproduciendo ahora

Ir a la emisora

A continuación

    Añade episodios con «A continuación»: sonarán después del episodio actual.