LLM Prompts

Refactoring Legacy JavaScript Code with Modern Frameworks

Assists in refactoring legacy JavaScript code using modern framework best practices.

The method

Use this prompt to guide the modernization of outdated JavaScript code. Apply it iteratively, focusing on small, manageable chunks of code. Provide the LLM with specific code snippets and framework context for optimal results. It will identify the core logic and generate new version using best practices.

The prompts

Prompt 1
You are an expert JavaScript architect. I need to refactor the following legacy JavaScript code to use modern React best practices, including functional components and hooks. The original code performs [describe functionality of the code]. Here is the original code:

[Paste Legacy JavaScript Code Here]

Please provide a refactored version of this code that is more maintainable, readable, and aligns with current React development standards. Also explain your design choices. Prioritize modularity, separation of concerns, and performance optimization. If there are external dependencies, suggest alternative libraries.
Prompt 2
I have a complex JavaScript application built with an older version of AngularJS. I want to migrate this application to Vue.js. However, I want to do this incrementally. Can you help me design a strategy and generate Vue.js components that mimic the functionality of specific AngularJS directives or services? Here's the AngularJS code:

[Paste AngularJS Code Here]

Specifically, I need a Vue.js component that performs [describe specific functionality]. Please provide the Vue.js component code, including necessary data bindings and event handling. Also, include a detailed explanation of how the Vue.js component integrates with the existing AngularJS application during the migration process, focusing on compatibility and data flow between the two frameworks.