AI Prompts for Diagnosing Cascade Failures in Code

20 of the best prompts for diagnosing cascade failures in code, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

AI Prompts for Diagnosing Cascade Failures in Code

20 of the best prompts for diagnosing cascade failures in code, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

Scroll to explore

Getting Diagnosing Cascade Failures in Code right takes more than a single prompt. This 4-stage guide covers Diagnose the Wall, Isolate and Fix, Verify the Resolution, and more, breaking the whole process into focused steps where each prompt builds on the last. A single code edit causing unrelated files or features to break is frustrating and time-consuming. This often leads to unexpected bugs and system instability. These prompts help developers identify, fix, and prevent such issues efficiently. Every prompt is optimized and runs in ChatGPT, Claude, and Gemini.

Diagnose the Wall

Identify the specific edit that caused the cascade failure.

Identify Recent Changes

Please provide a comprehensive list of all recent changes made to the codebase, specifically focusing on the last edit. Include details such as the names of the files that were modified, the specific lines that were affected, and a brief description of the nature of each change. Additionally, summarize the overall impact of these changes on the codebase, highlighting any potential issues or improvements that may arise from them. Format the response in a clear and organized manner for easy reference.

Diagnose the Wall

Analyze Error Logs

Please analyze the following error logs: [PASTE LOGS]. Focus on identifying any errors that are directly related to the recent code changes made in the project. Provide a summary of the key issues found, including the type of error, possible causes, and any recommendations for resolving these issues. Additionally, categorize the errors by severity and suggest next steps for debugging each type of error identified.

Diagnose the Wall

Check Dependency Impact

Please examine the dependencies of the modified file [FILE NAME] and identify any potential impacts on other files or features within the project. Provide a detailed analysis that includes a list of all dependent files, the nature of their relationships, and any potential issues that may arise from the changes made. Additionally, assess how these impacts could affect the overall functionality and performance of the project. Summarize your findings in a report format that highlights key areas of concern and recommendations for mitigation.

Diagnose the Wall

Review Code Context

Please review the following code context surrounding a recent change: [PASTE CODE]. Identify any potential issues or bugs that may arise from this change, including logical errors, performance concerns, or compatibility problems with other parts of the codebase. Additionally, provide recommendations for improvements or best practices that could enhance the overall quality and maintainability of the code. Format your response in a structured manner, detailing each issue and suggestion clearly.

Diagnose the Wall

Trace Execution Path

Trace the execution path of the code starting from the recent change made in [FILE NAME] at [LINE NUMBER]. Identify and highlight any unexpected interactions or dependencies with other parts of the codebase that may affect functionality. Provide a detailed explanation of how these interactions occur, including the specific functions or modules involved, and any potential implications for the overall system behavior. Format your response as a structured report with sections for the execution path, unexpected interactions, and recommendations for addressing any issues found.

Diagnose the Wall

Isolate and Fix

Focus on isolating the problematic change and applying a fix.

Suggest Code Revisions

Please analyze the identified issue in my code and suggest specific revisions that will effectively fix the problem. Ensure that your recommendations do not impact any unrelated files or functionalities. Provide a detailed explanation of each suggested change, including the rationale behind it and how it addresses the issue. Additionally, include any relevant code snippets to illustrate your suggestions clearly.

Isolate and Fix

Propose Alternative Solutions

Provide a list of alternative solutions to resolve the issue of breaking unrelated files in the system while ensuring overall stability. For each solution, explain how it addresses the problem, the potential risks involved, and any necessary steps for implementation. Additionally, include a brief comparison of the effectiveness of each solution and any trade-offs that may be required. Aim for a comprehensive overview that can guide decision-making.

Isolate and Fix

Highlight Unintended Effects

Identify any unintended effects of the recent change made in the codebase and provide a detailed analysis of how these effects could impact the overall functionality. Include specific examples of potential issues that may arise and suggest actionable steps to mitigate these effects. Additionally, recommend testing strategies to ensure that the changes do not adversely affect other parts of the system. Format your response as a structured report with clear headings for each section.

Isolate and Fix

Recommend Best Practices

Please provide a detailed list of best practices to follow when making changes to code that could potentially lead to cascade failures. Include specific strategies for isolating changes, testing dependencies, and ensuring that unrelated files are not affected. Additionally, discuss the importance of documentation and communication within the team to prevent similar issues in the future. Format your response as a structured guide with bullet points for clarity.

Isolate and Fix

Validate Code Logic

Please review the logic of the recent code changes made in [FILE NAME] and confirm whether it is correct. Analyze the key functions and their interactions to ensure they align with the intended functionality. If you identify any issues or potential improvements, provide detailed suggestions for corrections, including examples of how to implement these changes. Additionally, summarize the overall impact of the changes on the existing codebase and any potential side effects that may arise.

Isolate and Fix

Verify the Resolution

Ensure the applied fix resolves the issue without introducing new problems.

Run Automated Tests

Run the existing test suite for the project and provide a detailed report on any failures or unexpected results. Include information on which tests failed, the reasons for failure if available, and any relevant error messages or logs. Additionally, summarize the overall success rate of the test suite and highlight any tests that passed successfully. Format the report in a clear and organized manner, making it easy to identify issues that need to be addressed.

Verify the Resolution

Confirm Error Resolution

Please verify whether the errors identified earlier have been resolved with the recent changes made. List each error that was previously reported and indicate if it has been fixed or if it still persists. Additionally, provide a brief explanation of any remaining issues and suggest potential next steps for resolution. Format your response in a clear and organized manner for easy reference.

Verify the Resolution

Perform Regression Testing

Please perform regression testing on the latest version of the software to ensure that no new issues have been introduced. Outline the specific areas or functionalities that you will test, and provide a summary of the testing process. After completing the tests, report the results in a structured format, including any issues found, their severity, and recommendations for resolution. Additionally, include any relevant metrics or observations that may help in assessing the overall stability of the software.

Verify the Resolution

Verify Dependency Stability

Please verify the stability of all dependencies in the project after the recent changes. List each dependency along with its current version and indicate whether it remains stable or if any issues have been detected. If any dependencies are affected, provide details on the nature of the impact and suggest possible resolutions or next steps to address any instability. Format the results in a clear table for easy reference.

Verify the Resolution

Check System Performance

Please evaluate the system's performance after the recent fix to ensure that no degradation has occurred. Provide a detailed analysis that includes key performance metrics such as response time, error rates, and resource utilization. Compare these metrics to the baseline performance data collected prior to the fix. Additionally, identify any anomalies or unexpected behaviors observed during the evaluation period and suggest potential areas for further investigation if necessary.

Verify the Resolution

Prevent Recurrence

Create safeguards to prevent similar issues in the future.

Draft CLAUDE.md Rule

Please draft a new rule for the CLAUDE.md document aimed at preventing cascade failures similar to the recent issue. The rule should include a clear definition of what constitutes a cascade failure, specific guidelines on how to identify potential risks, and recommended practices for mitigating those risks. Additionally, outline the process for reporting and addressing any identified issues, and suggest a review timeline for ensuring compliance with the new rule. Format the rule in a structured manner with headings and bullet points for clarity.

Prevent Recurrence

Create Code Comment

Please write a detailed code comment for the following change: [DESCRIBE THE CHANGE IN DETAIL]. Explain why this change is important and how it helps prevent future misunderstandings. Include any relevant context about the code's functionality, potential pitfalls if the change is not understood, and how this change improves the overall code quality or performance. The comment should be clear, concise, and informative, ideally spanning three to five sentences.

Prevent Recurrence

Develop Checklist

Create a comprehensive checklist that I can use before making changes to ensure all potential impacts are thoroughly considered. The checklist should include sections for identifying related files, assessing dependencies, evaluating potential risks, and outlining necessary testing procedures. Additionally, include a step for documenting the changes made and any follow-up actions required. Format the checklist in a clear, organized manner with bullet points for easy reference.

Prevent Recurrence

Establish Naming Convention

Help me establish a comprehensive naming convention for files in a software project to enhance the identification of related files and features. The convention should include guidelines for naming files based on their purpose, functionality, and relationships with other files. Additionally, provide examples of naming patterns for different types of files, such as components, services, and utilities, and explain how this convention can improve collaboration and reduce confusion among team members. Aim for a clear and structured format that can be easily referenced by the development team.

Prevent Recurrence

Design Project Guard

Create a detailed project guard mechanism that alerts developers about potential cascade effects resulting from code changes. The guard should analyze the project's structure and dependencies to identify which files may be affected by modifications in a specific file. Include features such as real-time notifications, a summary report of impacted files, and recommendations for mitigating risks. Additionally, outline how this mechanism can be integrated into existing development workflows and tools. Provide a clear implementation plan that includes necessary technologies, potential challenges, and solutions.

Prevent Recurrence

Frequently asked questions

Why does a single code change affect unrelated files?+

GitHub Copilot suggests code based on the context of open files. If dependencies or shared resources are altered, it can inadvertently affect unrelated files.

How can I identify which change caused the issue?+

Use GitHub Copilot to list recent changes and analyze error logs to pinpoint the problematic edit.

What steps can I take to prevent cascade failures?+

Implement best practices, use checklists, and establish clear naming conventions to reduce the risk of cascade failures.

How does GitHub Copilot help in fixing cascade failures?+

GitHub Copilot suggests code revisions, alternative solutions, and best practices to address and prevent cascade failures.

Can GitHub Copilot verify if the issue is resolved?+

Yes, GitHub Copilot can run tests and confirm if the errors are resolved and no new issues have been introduced.