20 of the best prompts for resolving module system conflicts, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for resolving module system conflicts, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published June 28, 2026
Mixing CommonJS and ES module systems in the same codebase can lead to runtime errors and unexpected behavior. This inconsistency causes confusion and can break the build process. These prompts guide developers to identify, fix, and prevent this issue efficiently. 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.
Identify where the module system conflict occurs in the codebase.
Identify Mixed Modules
Please scan the entire codebase and provide a comprehensive list of all files that utilize CommonJS require statements and ES module import/export syntax. Additionally, identify and highlight any files that are using both module systems simultaneously. For each file, include the file path, a brief description of its purpose, and the specific lines where these module systems are implemented. Present the findings in a structured format that allows for easy review and analysis.
Check Configuration Files
Please review the configuration files, specifically package.json and CLAUDE.md, to identify the intended module system being used. Extract and summarize the relevant sections that indicate the module system, including any specific settings or dependencies that are crucial for understanding the configuration. Format your response clearly, highlighting the key points and any notable configurations that may affect the module system. Provide a brief explanation of how these configurations relate to the overall project setup.
Locate Entry Points
Please identify the main entry points of the application. For each entry point, specify the module system being used, including details on how each module interacts with the overall architecture. Additionally, provide insights into any potential issues or considerations related to the module systems that may affect application performance or maintainability. Format your response in a clear, structured manner, highlighting each entry point and its corresponding module system.
Analyze Dependency Usage
Please analyze the dependencies in my project and provide a comprehensive list of all dependencies being used. For each dependency, indicate which module system it utilizes, such as CommonJS, ES Modules, or AMD. Additionally, highlight any inconsistencies or conflicts between the module systems that may arise from the current setup. Format the output in a clear table with columns for the dependency name, module system, and any notes on inconsistencies.
Review Recent Changes
Please review the recent commits in the code repository and identify any changes related to the module system usage. Summarize the modifications, highlighting the specific files affected, the nature of the changes made, and any potential impacts these changes may have on the overall functionality of the system. Additionally, include any relevant context or reasoning provided in the commit messages that may help in understanding the purpose of these changes. Format your findings in a clear and concise report.
Focus on resolving the identified module system conflicts.
Convert to ES Modules
Please convert the following CommonJS files to ES module syntax. For each file, provide the updated code along with a brief explanation of the changes made. Ensure that you cover aspects such as the conversion of `require` statements to `import` statements, the use of `export` instead of `module.exports`, and any other relevant modifications necessary for compliance with ES module standards. The files to convert are: [FILE_1], [FILE_2], and [FILE_3].
Convert to CommonJS
Please convert the following ES module files to CommonJS syntax. For each file, provide the updated code along with a brief explanation of the changes made. Ensure that all import and export statements are correctly transformed, and that the functionality remains intact. The files to convert are: [FILE_1], [FILE_2], and [FILE_3]. Format the output clearly, indicating the original file name and the corresponding CommonJS code below it.
Update Configuration
Please modify the configuration files to ensure they are consistent with the chosen module system. Provide a detailed comparison of the original configuration and the updated version, highlighting the specific changes made. Include explanations for why each change was necessary to maintain consistency. Format the output in a clear, structured manner, with sections for the original configuration, the updated configuration, and the rationale behind each modification.
Refactor Mixed Files
Please analyze the provided code files and identify any instances where both module systems are being used. Refactor the code to ensure that it utilizes only one module system consistently throughout. Provide the refactored code along with a brief explanation of the changes made and the reasons for choosing the specific module system. Ensure that the refactored code maintains the original functionality and adheres to best practices.
Resolve Dependency Conflicts
Please analyze the current dependencies in my project that may be causing conflicts with the chosen module system, which is [MODULE SYSTEM]. Identify the specific dependencies that require adjustment and explain the reasons for each change. Provide a detailed list of the modifications made, including the original version and the updated version for each dependency. Additionally, suggest any best practices to prevent future dependency conflicts in this module system.
Ensure the module system conflict is resolved and the application runs correctly.
Run Build Process
Please execute the build process for the project and verify that there are no module-related errors. After running the build, provide a detailed output report that includes any warnings or errors encountered during the process. Additionally, summarize the overall status of the build, indicating whether it was successful or if any issues need to be addressed. Include specific information about the modules involved and any relevant dependencies that may impact the build outcome.
Execute Unit Tests
Please execute all unit tests for the current codebase to verify that they pass without any module system errors. Provide a detailed report of the test results, including the number of tests run, the number of tests that passed, and any errors or failures encountered during the process. Additionally, include information about the specific modules tested and any relevant error messages that may help identify issues. Format the results in a clear and organized manner for easy review.
Check Runtime Behavior
Please run the application and verify that it behaves as expected, ensuring there are no issues related to the module system. Summarize the runtime behavior in detail, including any errors encountered, performance metrics, and overall functionality. Additionally, describe any unexpected behaviors or discrepancies from the expected outcomes. Format your summary in a structured manner, highlighting key observations and recommendations for any necessary adjustments.
Validate Dependency Loading
Please validate the loading of all dependencies under the [MODULE SYSTEM] that I have selected. List each dependency and indicate whether it loaded successfully or if there were any errors encountered during the loading process. Additionally, provide a summary of any issues found, along with recommendations for resolving them. The output should be structured in a clear format that includes the dependency name, loading status, and any relevant error messages.
Confirm Configuration Consistency
Please review the configuration files for the module system to ensure they are consistent and accurately reflect the resolved settings. List the key configuration parameters that need to be verified, and provide the final configuration settings in a clear format. Additionally, include any discrepancies found during your review and suggest corrections to align with the resolved module system. Make sure to present this information in a structured manner for easy reference.
Implement measures to avoid future module system conflicts.
Create CLAUDE.md Rule
Please draft a new rule for CLAUDE.md that enforces consistent usage of the module system based on the resolved issue. The rule should clearly define what constitutes proper module system usage, including examples of correct and incorrect implementations. Additionally, outline the consequences for non-compliance and suggest best practices for developers to follow. Format the rule in a way that is easy to read and understand, using bullet points where appropriate.
Add Code Comments
Please add detailed comments to the key files in the project, explaining the chosen module system and any specific usage guidelines that should be followed. For each comment, include a brief description of the purpose of the module, how it integrates with the overall system, and any important considerations for usage. Additionally, provide examples of how to implement these guidelines in code snippets, ensuring that the comments are clear and informative for future developers. Aim for a comprehensive overview that enhances understanding and promotes best practices.
Develop Checklist
Please develop a comprehensive checklist for new code reviews that focuses on ensuring consistency in the module system. The checklist should include specific items such as naming conventions, file structure organization, dependency management, documentation requirements, and testing protocols. Each item should be clearly defined with actionable steps or criteria for evaluation. Format the checklist in a way that allows for easy tracking of compliance during the review process.
Establish Naming Conventions
Please define a set of naming conventions that clearly indicate the module system used in files. Include specific examples for each convention, explaining how they differentiate between various module systems. Additionally, outline the benefits of using these conventions in terms of code organization and maintainability. Aim for a comprehensive guide that can be easily referenced by developers.
Set Up Project Guard
Help me set up a guard in the build process to detect and warn about mixed module systems in my project. I need a detailed configuration that includes the specific settings and parameters required for the guard to function effectively. Please outline the steps to implement this guard, including any necessary code snippets or configuration files. Additionally, explain how to test the guard to ensure it is working correctly and what types of warnings or errors it should produce when mixed module systems are detected.
Claude Code may mix module systems if the CLAUDE.md file lacks clear rules or if recent changes introduced inconsistencies. Ensuring clear guidelines in CLAUDE.md can prevent this.
Use CLAUDE.md to specify the preferred module system and refactor existing code to comply. Regularly review code changes for adherence.
Mixed module systems can cause runtime errors, build failures, and dependency issues. Consistency ensures smoother development and deployment.
Yes, Claude Code can assist in refactoring by suggesting code changes and updating configurations to align with the chosen module system.
Run tests, build processes, and runtime checks to ensure all parts of the codebase adhere to the same module system. Use CLAUDE.md for guidance.
AI Prompts for Resolve Module System Conflicts
Mixing CommonJS require and ES module import/export can lead to silent failures in your application.
See promptsAI Prompts for Resolving Mixed Module Systems
Mixing CommonJS require and ES module import/export can lead to unexpected errors and failed builds.
See promptsAI Prompts for Correcting Incompatible Shell Commands
Claude Code executes shell commands that can break the environment or are incompatible with the project setup.
See prompts