AI Prompts for Resolving Module System Conflicts

20 of the best prompts for resolving module system conflicts, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

AI Prompts for Resolving Module System Conflicts

20 of the best prompts for resolving module system conflicts, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

Scroll to explore

Published June 28, 2026

Mixing CommonJS require and ES module import/export in the same codebase leads to runtime errors and unexpected behavior. This inconsistency can cause modules to fail to load or execute properly. These prompts guide developers to identify, fix, and prevent such conflicts using Windsurf. This guide walks you through every stage of Resolving Module System Conflicts, from Diagnose the Wall all the way through Prevent Recurrence, with a curated, copy-ready prompt at each step. Each stage targets a specific phase of the process so you always know exactly what to ask and what output to expect. Works with ChatGPT, Claude, and Gemini and any other major AI tool.

Diagnose the Wall

Identify where both CommonJS and ES modules are being used inappropriately.

Identify Mixed Modules

Please scan the project directory for any files that utilize both 'require' and 'import' statements. For each identified file, provide a list that includes the file name and the specific lines where both types of module imports are present. Additionally, summarize the potential implications of having mixed module systems in the same file and suggest best practices for resolving these issues.

Diagnose the Wall

Check Module Config

Please examine the project's configuration files and provide a detailed analysis of the module type settings. Confirm whether the 'type' is consistently set to 'module' across all configurations or if there are any discrepancies, such as a mix of different types. If there are inconsistencies, please list the specific files and settings that need to be addressed. Additionally, suggest any necessary changes to ensure uniformity in module type settings.

Diagnose the Wall

Locate Import Errors

Please check the codebase for any import or export errors. Provide a detailed list of any errors you find, including the specific file names and line numbers where each error occurs. Additionally, include a brief description of the nature of each error to help with troubleshooting. Format the output as a structured report for easy reference.

Diagnose the Wall

Verify Package.json

Please review the contents of the package.json file for a JavaScript project. Confirm whether the 'type' field is correctly set to either 'module' or 'commonjs' based on the module system being utilized in the project. Additionally, check for any other potential inconsistencies or errors within the file that could affect the module system's functionality. Provide a summary of your findings and any recommendations for corrections if necessary.

Diagnose the Wall

Detect Inconsistent Usage

Please analyze the codebase for inconsistent module usage patterns. Identify and list any files where both systems are utilized, providing specific examples of the inconsistencies found. Additionally, explain the potential implications of these inconsistencies on the overall functionality and performance of the application. Format your findings in a clear report that includes file names, the specific modules in question, and recommendations for resolving the inconsistencies.

Diagnose the Wall

Isolate and Fix

Focus on resolving the identified module system conflicts.

Convert to ES Modules

Please convert all instances of 'require' in the provided files to use 'import' syntax instead. For each file, show the original code snippet alongside the updated version using 'import'. Ensure that you maintain the functionality of the code and address any dependencies that may need to be adjusted as a result of this change. Additionally, provide a brief explanation of any significant changes made to the code structure during this conversion process.

Isolate and Fix

Switch to CommonJS

Please convert the code in the following files from ES6 'import' syntax to CommonJS 'require' syntax. For each file, provide the updated code along with a brief explanation of the changes made. Ensure that the conversion maintains the original functionality of the code. The files to be converted are: [FILE_1], [FILE_2], and [FILE_3].

Isolate and Fix

Update Configurations

Please modify the configuration files to ensure that all module type settings are consistent across the system. Provide a detailed summary of the changes made, including the specific lines or sections that were updated. Additionally, show the complete updated configuration files in a clear format, highlighting any significant alterations. Ensure that the modifications align with best practices for configuration management and document any potential impacts these changes may have on system performance.

Isolate and Fix

Refactor Mixed Files

Refactor the following code files that currently use both CommonJS and ES module systems to utilize only one module system. Identify which module system is more appropriate for the project based on best practices and compatibility. Provide the refactored code for each file, ensuring that all imports and exports are correctly updated to reflect the chosen module system. Additionally, include comments explaining the changes made and any potential impacts on the overall functionality of the project.

Isolate and Fix

Resolve Import Errors

Identify and resolve any import or export errors in the provided code snippet. Please analyze the code for issues related to module imports, ensuring that all necessary dependencies are correctly referenced. After making the necessary corrections, provide the revised code along with a brief explanation of the changes made and why they were necessary. Ensure that the final code is functional and free of errors.

Isolate and Fix

Verify the Resolution

Ensure that the module system conflicts have been resolved.

Run Module Tests

Please execute a series of tests to verify the loading and execution of the module in question. Provide a detailed report on the results, including any errors encountered during the process, along with their descriptions and potential causes. If the tests are successful, confirm this with a summary of the successful outcomes. Additionally, include any recommendations for further actions based on the test results.

Verify the Resolution

Check Runtime Behavior

Please run the application and monitor its runtime behavior specifically for any module-related errors. Document any errors that occur and note if the application runs smoothly without interruptions. Provide a summary of your findings, including any specific error messages encountered, the conditions under which they occurred, and whether the application met the expected performance standards. Additionally, suggest any potential fixes or improvements based on the observed behavior.

Verify the Resolution

Validate Imports

Please perform a thorough validation check on all import and export statements in the code. Ensure that each statement is correctly formatted and does not contain any syntax errors. Additionally, verify that all imported modules are available and correctly referenced within the project. Provide a summary of any issues found, including the specific lines where errors occur, and suggest corrections for each identified problem.

Verify the Resolution

Verify Config Consistency

Please verify the consistency of the configuration files related to module type settings. Check that these settings align with the corresponding elements in the codebase. Provide a detailed report highlighting any discrepancies found, including specific file names, line numbers, and the nature of the inconsistencies. Additionally, suggest any necessary corrections to ensure that the configuration files are properly aligned with the codebase standards.

Verify the Resolution

Confirm Code Integrity

Please review the codebase for the [PROJECT NAME] to ensure that no new issues have been introduced since the last update. Specifically, check for any errors, warnings, or deprecated functions that may affect functionality. Provide a summary of your findings, including any identified issues and recommendations for resolving them. Additionally, confirm that all existing features are working as intended and document any changes made during your review.

Verify the Resolution

Prevent Recurrence

Create safeguards to avoid future module system conflicts.

Create Module Rule

Draft a CLAUDE.md rule that enforces a single module system for our project. The rule should clearly define the requirements for module creation, including naming conventions, structure, and any dependencies or limitations that must be adhered to. Additionally, include guidelines for how to handle exceptions or special cases, and specify the consequences for non-compliance with this rule. Format the rule in a clear and concise manner, suitable for inclusion in our project documentation.

Prevent Recurrence

Add Code Comments

Please add detailed comments in the key files of the project that explain the chosen module system. For each comment, provide a brief description of the purpose of the module, how it integrates with the overall system, and any important considerations or decisions made during its implementation. Additionally, include examples of specific code snippets where these comments would be placed, ensuring that the explanations are clear and helpful for future developers. Aim for a comprehensive overview that enhances understanding and facilitates maintenance.

Prevent Recurrence

Develop Checklist

Please develop a comprehensive checklist for new files that ensures consistent module usage across our projects. The checklist should include specific criteria such as naming conventions, required documentation, version control practices, and any necessary dependencies that must be included. Additionally, outline steps for reviewing and approving new files before they are finalized, and suggest best practices for maintaining module integrity. Format the checklist in a clear, organized manner, using bullet points for easy reference.

Prevent Recurrence

Establish Naming Convention

Propose a detailed naming convention for files that aligns with the module system used in our project. The convention should include guidelines on how to structure names based on the type of module, its purpose, and any relevant versioning information. Provide at least five examples of file names that adhere to this convention, explaining the rationale behind each choice. Additionally, outline any best practices for maintaining consistency and clarity in naming across the project.

Prevent Recurrence

Implement Project Guard

Please create a project guard script that enforces module system rules for a project. The script should include specific checks for module imports, dependencies, and naming conventions to ensure compliance with best practices. Additionally, provide comments within the code to explain the purpose of each section and how it contributes to maintaining the integrity of the module system. Format the output as a well-structured code snippet that can be easily integrated into a project.

Prevent Recurrence

Frequently asked questions

How can I identify mixed module systems in my project?+

Windsurf can scan your codebase to detect files using both 'require' and 'import'. Use its diagnostic capabilities to list these instances.

Why does mixing module systems cause issues?+

Mixing CommonJS and ES modules can lead to runtime errors because they handle module loading differently. Windsurf helps identify and resolve these conflicts.

What configuration changes are needed for consistent module usage?+

Ensure your package.json and other configuration files specify a consistent module type. Windsurf can assist in updating these settings.

How do I convert CommonJS to ES modules?+

Windsurf can refactor your code by replacing 'require' with 'import' statements, ensuring compatibility with ES module syntax.

Can Windsurf prevent future module conflicts?+

Yes, by creating CLAUDE.md rules and project guards, Windsurf can help enforce consistent module usage across your project.