> Markdown version of [/videos/100223-refactoring-in-the-age-of-ai](https://www.wearedevelopers.com/videos/100223-refactoring-in-the-age-of-ai). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Refactoring in the Age of AI Why do AI assistants create broken pull requests during refactoring? Discover how applying strict technical guardrails makes code changes safe, transforming your role from typist to director. - **Speakers:** [Dominik Srednicki](https://www.wearedevelopers.com/@dominik-srednicki), [Elena Lucarelli](https://www.wearedevelopers.com/@elena-lucarelli) - **Event:** World Congress 2026 Europe - **Published:** July 10, 2026 - **Duration:** 24:46 - **URL:** https://www.wearedevelopers.com/videos/100223-refactoring-in-the-age-of-ai ## Summary AI coding assistants excel at writing new code but often stumble when tasked with refactoring, leading to huge, broken pull requests—a phenomenon dubbed "vibe refactoring." The core issue isn't a lack of intelligence, but the AI's inherent blind spots regarding code state, sequential execution, and safety nets. When left mathematically unconstrained, language models will either ignore critical cross-file dependencies or generate massive, unreviewable diffs that disguise broken behaviors. To make AI-assisted refactoring safe and predictable, engineering teams must constrain the model using classical methodologies, such as Martin Fowler’s foundational 1999 refactoring playbook. Rather than relying on simple prompts, developers can implement a spec-driven workflow that forces the AI into tight technical guardrails. This involves deterministic codebase analysis to map dependencies upfront, selecting an established refactoring pattern, and generating a rigid, step-by-step execution checklist that the agent cannot skip. This workflow fundamentally transforms the developer's role from a typist into a director who reviews structured execution plans rather than thousands of lines of raw diffs. Trusting an agent with code changes hinges on permanently bounding the "blast radius," forcing atomic commits, and strictly forbidding AI modifications on untested code. Ultimately, wrapping LLM capabilities in these deterministic safety checklists turns refactoring from a solitary, undocumented chore into a collaborative planning exercise, drastically accelerating delivery times while preserving system integrity. **Keywords:** ai-assisted code refactoring, spec-driven development, codebase static analysis, martin fowler refactoring patterns, bounding blast radius, atomic code commits, refactoring execution checklists, test coverage validation, handling massive ai diffs, automated dependency mapping, enterprise ai adoption, vibe refactoring mitigation, developer role shift, legacy codebase modernization ## Chapters 1. **The problem of AI vibe refactoring in large codebases** (00:02) — Generic or hyper-specific prompts cause AI coding assistants to break application dependencies during refactoring. 1. **Why AI struggles with classical refactoring methodologies** (02:34) — Large language models understand classical refactoring steps but fail to maintain the sequence, state, and safety nets required to execute them. 1. **Enforcing hard constraints through AI workflows** (04:43) — Establishing a rigorous workflow limits AI workarounds by analyzing the codebase, matching intents to patterns, and generating a structured execution plan. 1. **Designing the architecture of an AI refactoring pipeline** (07:03) — Static analyzers and a prompt-aware context engine combine to generate step-by-step execution plans analogous to spec-driven development. 1. **Designing project constitutions and structured refactoring checklists** (08:58) — Defining project metadata, phased execution plans, and atomic task checklists ensures AI maintains invariants and test coverage throughout the refactoring loop. 1. **Transitioning from code typists to refactoring workflow directors** (11:49) — Reviewing structured execution plans and checklists replaces manual code diff reviews while integrating up-to-date documentation directly into the repository. 1. **Establishing safety boundaries for AI-assisted code refactoring** (14:55) — Mandatory green tests, bounded blast radiuses, verifiable patterns, and incremental changes are essential prerequisites for allowing automated refactoring. 1. **Improving git blame log traceability with structured guardrails** (18:07) — Visualizing the clarity of git commits produced via strict workflows versus vague AI adjustments demonstrates the necessity of system guardrails. 1. **Audience Q&A on workflow formulation and spec-driven development** (19:50) — Audience questions address the validation of step-by-step checklists, applying automation to feature development, and injecting markdown patterns into contexts without vector search. ## Related Moments - [Addressing refactoring challenges with AI tools](https://www.wearedevelopers.com/videos/959-supercharging-static-code-analysis-konveyor-ai-llms) (from "Supercharging Static Code Analysis: Konveyor AI & LLMs") - [Shifting developer workloads and realistic AI productivity gains](https://www.wearedevelopers.com/videos/1830-wearedevelopers-live-speculaitions) (from "WeAreDevelopers LIVE - SpeculAItions") - [Rethinking team structures around AI agent capabilities](https://www.wearedevelopers.com/videos/1539-agentic-devops-how-ai-powered-automation-transforms-software-delivery-on-github-and-azure) (from "Agentic DevOps: How AI-Powered Automation Transforms Software Delivery on GitHub and Azure") - [Turning repetitive developer tasks into automated AI agent skills](https://www.wearedevelopers.com/videos/100236-code-is-cheap-software-isn-t) (from "Code Is Cheap. Software Isn’t.") - [Balancing AI tool mandates with developer trust and productivity](https://www.wearedevelopers.com/videos/1365-wearedevelopers-live-the-weekly-developer-show-with-chris-heilmann-and-daniel-cranney) (from " WeAreDevelopers LIVE - the weekly developer show with Chris Heilmann and Daniel Cranney") - [Using AI copilots to explain and debug legacy codebases](https://www.wearedevelopers.com/videos/1302-wearedevelopers-live-dishonest-charts-britcss-debugging-with-ai) (from "WeAreDevelopers LIVE - Dishonest Charts, BritCSS, Debugging with AI") ## Related Articles - [Transforming Software Development: The Role of AI and Developer Tools](https://www.wearedevelopers.com/magazine/527-transforming-software-development-the-role-of-ai-and-developer-tools) - [AI-Powered Debugging: The Future of Fixing Your Code](https://www.wearedevelopers.com/magazine/553-ai-powered-debugging-the-future-of-fixing-your-code) - [Exploring AI: Opportunities and Risks for Developers](https://www.wearedevelopers.com/magazine/522-exploring-ai-opportunities-and-risks-for-developers) - [One billion (bad?) developers: How AI is changing the way we learn to code](https://www.wearedevelopers.com/magazine/516-one-billion-bad-developers-how-ai-is-changing-the-way-we-learn-to-code) ## Related Jobs - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub** - [Senior AI Agent Software Engineer (Go, Python) (m/f/x)](https://www.wearedevelopers.com/jobs/48277-senior-ai-agent-software-engineer-go-python-m-f-x) at **Dynatrace** - [Tribe Lead - ( Software) Engineering Centre of Excllence](https://www.wearedevelopers.com/jobs/ext/1475530-tribe-lead-software-engineering-centre-of-excllence) at **SD Worx** - [Principal Software Engineer, Enterprise AI Platform](https://www.wearedevelopers.com/jobs/ext/1467292-principal-software-engineer-enterprise-ai-platform) at **GitHub** - [Staff Developer Advocate, GitHub Security Lab](https://www.wearedevelopers.com/jobs/ext/1921051-staff-developer-advocate-github-security-lab) at **GitHub** - [Principal Product Manager, Agent Platform](https://www.wearedevelopers.com/jobs/ext/277541-principal-product-manager-agent-platform) at **GitHub**