ToolBunny LogoToolBunny
Back to Library
Cursor
Software Engineer
Development
Legacy Code Refactoring Master

Instruct Cursor to analyze and refactor a complex, messy legacy file into clean, modern, testable code.

1. Customization Parameters

[FILE_PATH]

2. Compiled Prompt Preview

Live compiler active
output template
Analyze the current file `[FILE_PATH]` and perform a comprehensive refactoring. Goals: 1. Modernize the syntax (use modern ES6/TypeScript features, remove obsolete patterns). 2. Improve readability by extracting complex nested logic into small, pure helper functions. 3. Eliminate any 'any' types and replace them with strict TypeScript interfaces. 4. Optimize performance by reducing unnecessary re-renders or loops. 5. Add comprehensive JSDoc comments to all public functions and interfaces. 6. Generate a corresponding Jest unit test file covering the primary edge cases. Do not change the external API signature of the primary exported functions unless absolutely necessary. Explain the major architectural changes you make before providing the code.

1Customize Variables

Fill in the parameters on the left. Type custom topic, instructions, or adjust selectors to fit your exact business goals.

2Live Compiler Updates

The template values will be automatically inserted into the placeholders in real time on the right preview window.

3Copy & Paste to AI

Click the large action button to copy the compiled prompt, then paste it directly into Cursor to experience top outcomes.

Related Prompts

Cursor
Software Engineer

A comprehensive Cursor prompt for generating a full-stack Next.js component with database integration and API routes.

Claude
Software Engineer

Get an in-depth review of your React and TypeScript components focusing on performance, modularity, type-safety, and clean coding practices.

Cursor
Software Engineer

A professional system prompt to instruct Cursor or Copilot to write idiomatic Next.js 15 code using the App Router, Server Components, and Server Actions.