20 of the best prompts for preventing module export breakages, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for preventing module export breakages, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
When GitHub Copilot changes a module's exports, it can break existing imports across your codebase. This leads to runtime errors and unexpected behavior in dependent modules. These prompts help ensure all dependent files are updated to maintain functionality. Built across 4 distinct stages covering Diagnose the Wall, Isolate and Fix, Verify the Resolution and more, this guide gives you one expert prompt per step so you never have to write from scratch or guess what the AI needs. The prompts work in ChatGPT, Claude, and Gemini and are designed to get usable output on the first try.
Identify which exports have been modified and where they are imported.
Identify Changed Exports
Please identify all the exports from the module [MODULE_NAME] that have been modified. For each export, provide both the previous export name and the current export name. Additionally, include a brief explanation of the changes made and the reason for these modifications. Format the response in a table with columns for 'Previous Export Name', 'Current Export Name', and 'Reason for Change' to ensure clarity and organization.
Locate Import Dependencies
Please locate all files in the project that import from [MODULE_NAME]. For each file, provide a list of the specific imports being used along with the line numbers where they appear. Additionally, include a brief description of how each import is utilized within the file. Format the output as a structured report, clearly separating each file and its corresponding imports.
Check for Missing Imports
Please analyze my project for any missing imports that may have arisen due to recent changes in [MODULE_NAME]. For each missing import, provide the specific file paths and the corresponding line numbers where these imports should be included. Additionally, include a brief explanation of why each import is necessary for the functionality of the project. Format the output as a structured list for easy reference.
Review Module Change Impact
Analyze the recent changes in the exports of [MODULE_NAME] and explain how these modifications will impact the files that import this module. Identify specific potential errors or issues that could arise as a result of these changes, such as broken imports, type mismatches, or changes in functionality. Provide examples of how these issues might manifest in the importing files and suggest possible solutions or adjustments that developers can make to mitigate these problems. Structure your response clearly, highlighting the key points for easy reference.
Confirm Export Changes
Please confirm whether the changes made to the exports of [MODULE_NAME] are intentional and necessary. Include a detailed summary explaining the reasons behind these changes, highlighting any potential impacts on existing functionality or dependencies. Additionally, outline any steps that may need to be taken to accommodate these changes in the codebase. Your response should be clear and structured, providing insights into the rationale and implications of the export modifications.
Ensure all importing files are updated to match the new exports.
Update Import Statements
Please review the import statements in each file that imports from [MODULE_NAME] and update them to reflect the new export names. For each file, provide the original import statement alongside the updated version for comparison. Ensure that the updated code snippets are clear and well-formatted, and include comments explaining any significant changes made. Aim to cover all relevant files and ensure that the code remains functional after the updates.
Refactor Affected Code
Refactor the code in each file that imports [MODULE_NAME] to accommodate the changes in its exports. For each affected file, provide the original code snippet along with the refactored version, clearly indicating what modifications were made and why. Ensure that the new code maintains the same functionality and adheres to best practices. Additionally, include comments explaining the changes for clarity and ease of understanding.
Resolve Import Errors
Identify and resolve any import errors that have arisen due to the recent export changes in [MODULE_NAME]. Please analyze the codebase and pinpoint the specific lines where the import issues occur. Provide the corrected code snippets along with brief explanations of the changes made, ensuring that all dependencies are properly addressed. Additionally, include any relevant context about how these changes impact the overall functionality of the module.
Synchronize Export Usage
Please review the entire project for any usage of exports from [MODULE_NAME] and ensure they are synchronized with the new export definitions. Identify and list any discrepancies or inconsistencies you find, including the specific locations in the code where these issues occur. Additionally, provide recommendations on how to resolve these discrepancies to ensure that the project functions correctly with the updated exports. Format the findings in a clear report that highlights the discrepancies and suggested fixes.
Validate Export Consistency
Please validate the export consistency for the module [MODULE_NAME]. Review all files that import from this module and ensure they are using the same export names consistently. Identify any discrepancies or inconsistencies in the export names across the files. Provide a summary of your findings, including a list of files with issues and recommendations for how to resolve them to maintain uniformity in the codebase.
Ensure all import dependencies are functioning correctly after changes.
Run Import Tests
Please execute tests for all files that import from [MODULE_NAME] to ensure they function correctly with the new exports. For each test, provide a detailed report that includes the test name, the expected outcome, and whether it passed or failed. If there are any failures, include specific error messages and suggest potential fixes or areas to investigate further. Additionally, summarize the overall success rate of the tests and highlight any critical issues that need immediate attention.
Check Runtime Behavior
Please simulate the runtime execution of the files that utilize exports from [MODULE_NAME]. Ensure that the execution runs smoothly without any runtime errors. Provide a detailed report of the execution process, including any warnings or issues encountered, and confirm the successful completion of the simulation. Additionally, outline the expected behavior of the exports during the runtime and any relevant context that may affect their performance.
Confirm Import Validity
Please verify the validity of all import statements for the module [MODULE_NAME]. Check each import to ensure it is correctly resolved and does not lead to any errors. If there are any issues, provide a detailed list of the problematic imports along with suggestions for how to resolve them. Additionally, confirm if all imports are functioning as expected and include any relevant context or recommendations for improvement.
Ensure Code Integrity
Review the code integrity of all files that import from [MODULE_NAME]. Analyze each file to ensure that the imports function correctly and do not cause any issues in the codebase. Identify and highlight any anomalies or errors that may arise from these imports, providing specific examples and suggestions for resolution. Additionally, summarize the overall impact of these imports on the functionality of the code and recommend best practices for maintaining code integrity moving forward.
Validate Project Build
Please validate the build of my project to ensure there are no errors related to the exports of [MODULE_NAME]. Compile the entire project and confirm whether the build is successful. If there are any errors, please list them in detail, including the specific files and lines where the issues occur, so I can address them effectively.
Create mechanisms to avoid future export-related issues.
Draft Export Change Rule
Draft a rule for CLAUDE.md that requires a review of all import dependencies prior to making any changes to exports. The rule should clearly outline the process for reviewing dependencies, including who is responsible for the review, the criteria for evaluating the impact of changes, and any documentation that must be updated as a result. Ensure the language is clear and concise, suitable for inclusion in a formal document, and provide the exact text that can be directly used in the CLAUDE.md file.
Create Export Checklist
Please create a comprehensive checklist that outlines the necessary steps to follow before modifying module exports in a codebase. The checklist should include specific actions for verifying that all import statements are updated accordingly to prevent any potential issues. Additionally, include steps for testing the modified exports to ensure they function as intended and do not break existing functionality. Format the checklist in a clear, easy-to-follow manner, with each step numbered for clarity.
Suggest Naming Convention
Propose a comprehensive naming convention for exports that minimizes the risk of breaking existing imports in a codebase. Include specific examples of naming patterns that can be used, as well as guidelines on how to implement these conventions effectively. Discuss considerations such as versioning, clarity, and consistency in naming to ensure that future changes do not disrupt existing functionality. Additionally, provide recommendations on how to document these conventions for team members to follow.
Add Code Comments
Please add detailed comments to the code in [MODULE_NAME]. Explain the purpose of each export clearly, including any dependencies that are relevant to understanding the code's functionality. Ensure that the comments are concise yet informative, making it easy for someone unfamiliar with the module to grasp its structure and purpose. After adding the comments, provide the complete updated code with the comments included.
Develop Guard Function
Please develop a guard function that will log any discrepancies in import usage whenever the exports of [MODULE_NAME] are modified. The function should monitor the import statements and compare them against the current exports of the module. If any discrepancies are detected, it should log a detailed message indicating the nature of the discrepancy, including the specific imports that are affected. Additionally, provide the complete code for this function along with comments explaining each part of the implementation.
GitHub Copilot suggests code based on patterns and context it identifies in your files. It may change exports if it predicts a different structure could be more efficient or align with recent edits.
Use GitHub Copilot to list all files importing the modified module and update their import statements. This ensures consistency across your codebase.
Diagnose the issue by checking the import paths and export names. Use Copilot to refactor and synchronize the imports with the new export structure.
No, GitHub Copilot suggests changes but does not automatically update your code. You need to manually accept and apply its suggestions.
Implement rules and checklists in your CLAUDE.md to review all dependencies before changing exports. Use Copilot to draft these preventive measures.
AI Prompts for Identifying Changes Breaking Tests
When code changes cause previously passing tests to fail, it disrupts the development process and delays releases.
See promptsAI Prompts for Identify Export Changes Impacting Imports
The issue arises when Bolt modifies a module's exports without updating the dependent files, leading to broken imports.
See promptsAI Prompts for Prevent Module Export Conflicts
When a module's exports change without updating the importing files, it can lead to runtime errors and broken functionality.
See prompts