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 leads to runtime errors and inconsistent behavior. This can cause modules to fail to load correctly, breaking application functionality. These prompts help developers standardize their module system, ensuring smooth and predictable code execution. 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 both CommonJS and ES module systems are being used in the codebase.
Identify Mixed Imports
Please scan the current project for files that utilize both CommonJS and ES module syntax. Identify and list the specific files where these mixed imports occur. For each file, highlight the conflicting lines of code that demonstrate the use of both syntaxes, and provide a brief explanation of the potential issues that may arise from this mixing. Additionally, suggest possible solutions or best practices to resolve these conflicts.
Check Configuration Files
Please review the configuration files, including package.json and .babelrc. Confirm whether they specify a module system preference and identify any inconsistencies present in these files. Provide a summary of your findings, highlighting any discrepancies and suggesting potential solutions to align the module system preferences across the configurations. Additionally, include recommendations for best practices in maintaining consistency in configuration files.
List All Import/Require Statements
Please generate a comprehensive list of all import and require statements used in the project. For each statement, categorize them based on the module system they belong to (e.g., CommonJS, ES6) and specify the file location where each statement is found. Additionally, provide a summary of the total number of statements for each module system and highlight any potential issues or redundancies that may arise from the current usage. Format the output in a clear and organized manner for easy reference.
Analyze Module System Usage
Please analyze the module system usage within the project. Start by examining the project's entry points and key modules to determine which module system is predominantly utilized. Identify any deviations from the expected module system and provide a summary of your findings, including potential impacts on project performance and maintainability. Format your analysis as a detailed report, highlighting specific modules, their usage patterns, and any recommendations for improvement.
Detect Module System Errors
Please run a diagnostic to identify any errors related to module system conflicts that occur during runtime in my application. I need a detailed summary of each error, including the specific locations in the code where they are found. Additionally, provide suggestions for how to resolve these conflicts and any best practices to prevent similar issues in the future. Format the results in a clear, organized manner for easy reference.
Focus on converting all module imports/exports to a single system.
Convert to ES Modules
Please convert all CommonJS require statements in the codebase to ES module import statements. Ensure that the transformation maintains compatibility with the existing code and does not introduce any breaking changes. Provide a summary of the changes made, highlighting any areas where additional attention may be needed for compatibility. Additionally, include examples of the original and transformed code for clarity.
Convert to CommonJS
Transform all ES module import and export statements in the provided code to CommonJS require and module.exports syntax. Ensure that the converted code maintains compatibility with the existing codebase, avoiding any breaking changes. Additionally, provide a brief overview of the changes made, highlighting any potential issues that may arise during the conversion process. Format the output as a clear, annotated code snippet that illustrates the differences between the original and converted code.
Update Configuration for ES Modules
Please update the configuration files for my project to explicitly set it to use ES modules. Ensure that all necessary settings are adjusted, including any relevant package.json entries or module type declarations. After making these changes, confirm that the configuration is correctly applied and provide a summary of what was modified. Additionally, check for any potential issues that may arise from this update and suggest solutions if necessary.
Update Configuration for CommonJS
Please modify the configuration files for my project to explicitly set it to use CommonJS. Ensure that all necessary settings are updated, and provide a summary of the changes made. After making the modifications, confirm that the configuration is correctly applied by checking for any errors or warnings. Additionally, provide guidance on how to verify that the project is now using CommonJS as intended.
Refactor Mixed Files
Identify the files in my project that currently use mixed module systems, such as CommonJS and ES modules. For each identified file, provide a detailed plan for refactoring them to adopt a single, consistent module system. Include specific code examples of the changes needed, explain any potential issues that may arise during the refactoring process, and suggest best practices to follow to ensure compatibility and maintainability of the code. Additionally, summarize the benefits of using a consistent module system for the overall project structure.
Ensure the module system is consistent and the application runs without errors.
Run Module System Tests
Please run a series of tests to verify that all modules in the system are loading correctly without any errors. Include checks for module dependencies, ensure that each module initializes as expected, and confirm that there are no conflicts or issues in the module system. Provide a detailed report on the results, highlighting any errors encountered, the modules affected, and suggestions for resolving any issues found. Format the report in a clear and organized manner for easy review.
Check Application Startup
Please check the startup process of the application. Confirm that it initializes correctly without encountering any module-related errors. Provide a detailed report on any issues found during the startup, including error messages, if applicable, and suggest potential solutions for any problems identified. Additionally, include the steps taken to verify the successful initialization of the application.
Validate Import/Export Consistency
Please review the project code to validate that all import and export statements are consistent with the chosen module system, which is [MODULE SYSTEM]. Identify any inconsistencies or errors in the statements and provide a summary of your findings. Additionally, suggest corrections for any issues you discover, and explain the importance of maintaining consistency in module imports and exports for the overall functionality and maintainability of the project. Format your response as a detailed report.
Confirm Configuration Settings
Please verify that all configuration files accurately reflect the chosen module system for [PROJECT NAME]. Check for any conflicting settings that may exist and provide a detailed report on any discrepancies found. Include specific examples of the settings that do not align with the chosen module system and suggest corrections to ensure consistency across all files.
Generate Module System Report
Please generate a detailed report summarizing the module system used across the project. Include an overview of each module, its purpose, and how it integrates with other modules. Additionally, verify that there are no inconsistencies or conflicts within the module system, and provide recommendations for any improvements if necessary. Format the report with headings for each section and ensure it is comprehensive enough to serve as a reference for future development.
Implement safeguards to maintain a consistent module system in future development.
Create Module System Rule
Draft a CLAUDE.md rule that outlines the module system to be implemented in the project. The rule should include a clear definition of the module system, specific examples of how it will be applied within the project, and a rationale explaining the benefits and reasoning behind choosing this particular system. Ensure the document is structured with headings for each section, and aim for a length of at least 300 words to provide comprehensive coverage of the topic.
Add Code Comments
Please add detailed comments in the following key files: [FILE NAMES]. Explain the chosen module system used in each file, including its advantages and any specific reasons for maintaining this system. Ensure the comments clarify how the module system contributes to the overall functionality and organization of the code. Aim for clarity and thoroughness, providing enough context for future developers to understand the rationale behind these choices.
Develop Session-Opener Checklist
Create a comprehensive checklist for opening coding sessions that ensures all necessary preparations are made. Include steps such as verifying module system consistency, checking for any updates or changes in dependencies, confirming the correct environment is set up, and ensuring all team members have access to the required resources. The checklist should be structured in a clear, easy-to-follow format and should cover at least ten key points to help facilitate a smooth and productive coding session.
Establish Naming Conventions
Please define a comprehensive set of naming conventions for files and directories that align with the [MODULE SYSTEM NAME]. Include guidelines for naming files based on their purpose, such as [EXAMPLES OF FILE TYPES], and specify how directories should be organized to enhance clarity and accessibility. Additionally, address any potential conflicts that may arise with existing naming practices and suggest solutions to prevent recurrence of these issues. Format your response as a clear, structured document that can be easily referenced by the team.
Implement Project Guard
Create a project guard that automatically checks for module system consistency during code commits in my project. The guard should analyze the codebase for any discrepancies in module imports and exports, ensuring that all modules adhere to the defined system. Please provide a detailed implementation plan that includes the necessary scripts or configurations, the specific checks that will be performed, and how to integrate this guard into the existing version control workflow. Additionally, include instructions on how to test the guard to ensure it functions correctly.
Cursor can analyze your configuration files like package.json to determine the module system. It can also scan your codebase to identify the predominant module syntax.
Mixing CommonJS and ES modules can lead to runtime errors because they have different loading mechanisms. Cursor helps identify and resolve these conflicts by standardizing your code.
Yes, Cursor can refactor your code to convert between CommonJS and ES modules, ensuring compatibility and consistency across your project.
Cursor can review and update your configuration files to align with the chosen module system, preventing future conflicts and errors.
Implementing rules in your CLAUDE.md and using Cursor's project guard features can help maintain consistency and prevent future issues.
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 Resolving Module System Conflicts
Mixing CommonJS require and ES module import/export in the same codebase leads to runtime errors and unexpected behavior.
See prompts