Pattern 6: Rush and Refactor

Human Builds Fast and Dirty, Then AI Refactors to Be Clean and Maintainable

Overview

Rush and refactor means writing quick, messy code to validate ideas, then using AI to make it production-quality.

Why do this?

  • Validate ideas without getting bogged down in patterns
  • Maintain creative flow on the fun stuff
  • Leverage AI’s strength at refactoring
  • Get working prototypes quickly

This pattern liberates perfectionists who overthink implementations. Write “bad” code first, knowing AI will clean it up.

Key Principles

  1. Function over form - Get it working first
  2. Preserve behavior - Never change functionality
  3. Systematic improvement - One code smell at a time
  4. Trust the process - Don’t pre-optimize

Exercise: API Pipeline

Build a script that fetches from multiple APIs, merges results, and writes to a database. Write it like a one-off task.

Steps:

  1. Rush (you do this): Write the pipeline quickly. Use globals. Copy-paste. Hardcode paths. Skip error handling. Just make it work.

  2. Refactor (AI helps): Show AI your mess. Ask it to identify issues: duplication, missing error handling, poor structure. Have it plan refactoring for production. Be clear about what you look for in good code.

  3. Review: Check the plan. Adjust until accurate.

  4. Implement: Have AI refactor one step at a time. Verify each change.

Your Turn

Pick your own project!

Examples:

  • Rush a news scraper for three sites, then have AI refactor to remove duplicates and categorize headlines (‘Tech’, ‘Politics’, ‘Sports’)
  • Build a single-file game (Tic-Tac-Toe or Wordle), then have AI refactor into modules for logic, UI, and state
  • Write a messy spending analyzer, then have AI refactor to generate clean reports with charts