// 24 tips tagged "refactoring"
Before asking Claude to scaffold a new feature, point it at your existing code first — it will match your naming, structure, error handling, and test patterns exactly rather than defaulting to framework boilerplate.
Ask Claude to migrate your Tailwind v2 utility classes and config to v4 — it handles renamed utilities, the new CSS-first config format, and @theme variable mappings across your whole codebase.
Pipe your SQL DDL or Laravel migrations to Claude and get a complete Prisma schema back — foreign keys become relations, enums map correctly, and @@map attributes preserve your existing table names.
Migrate JavaScript to TypeScript one file at a time with Claude — set up allowJs, convert leaf modules first, then tighten strict mode when you're ready.
Convert your existing REST API routes into fully typed tRPC procedures with Zod validation — Claude reads your handlers and generates the routers.
Migrate React class components to functional components with hooks — Claude handles lifecycle methods, state, refs, and HoC replacements automatically.
Fat controllers are where good architecture goes to die — paste yours into Claude and ask it to extract the business logic into a proper service layer.
Paste your webpack.config.js into Claude and get a working vite.config.ts back, with notes on any plugins, aliases, or environment variable handling that needs updating.
Describe your domain and let Claude design an event sourcing implementation with event classes, a store interface, and aggregate reconstruction logic.
Paste old PHP 7 code and ask Claude to modernise it with enums, named arguments, match expressions, and constructor property promotion.
Chain multi-step operations with && so Claude's sequence halts immediately on failure — no more half-applied refactors or committed broken code.
Paste a Vue component packed with inline data-fetching logic and ask Claude to extract it into a typed Pinia store — it handles the refactor, updates the component, and writes the Vitest tests.