AI Prompts for Fixing Authentication Flow Breaks

20 of the best prompts for fixing authentication flow breaks, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

AI Prompts for Fixing Authentication Flow Breaks

20 of the best prompts for fixing authentication flow breaks, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.

Scroll to explore

Published June 28, 2026

A new feature or refactor can break login, session management, or authentication flows, causing user access issues. This can lead to frustrated users and potential security vulnerabilities. These prompts help developers diagnose, fix, and prevent these issues efficiently using Windsurf. 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.

Diagnose the Wall

Identify the specific authentication component that is failing.

Identify Failing Component

Analyze the recent changes made in the authentication flow of the project and identify which specific component is failing. Please provide a thorough breakdown of the affected areas, including any error messages or behaviors observed during the failure. Additionally, outline potential reasons for the failure and suggest steps for troubleshooting or resolving the issue. Format your response in a structured way, highlighting key findings and recommendations for each component analyzed.

Diagnose the Wall

Check Error Logs

Please review the error logs related to authentication for the system. Identify and summarize the key issues that are present, including the types of errors, their frequency, and any patterns that may indicate underlying problems. Additionally, provide recommendations for addressing these issues to improve the authentication process. Format your findings in a clear report with bullet points for each key issue and suggested actions.

Diagnose the Wall

Examine Recent Commits

Please examine the recent commits in the repository and identify any changes that are related to authentication. For each change, provide a detailed explanation of how it may have impacted the authentication flow within the application. Include any potential issues that could arise from these changes, as well as suggestions for testing or further investigation. Format your response in a structured way, with bullet points for each commit and a summary of the overall impact on the authentication process.

Diagnose the Wall

Inspect Session Management

Please evaluate the session management code for [APPLICATION NAME] to identify any discrepancies or errors. Analyze the implementation for potential vulnerabilities such as session fixation, cookie security, and timeout settings. Provide a detailed summary of the issues found, including their potential impact on security and user experience. Suggest best practices for improving session management to enhance security and reliability.

Diagnose the Wall

Review Dependency Updates

Please review the recent updates to dependencies related to the authentication process for [APPLICATION NAME]. Identify any updates that could potentially impact authentication functionality, including version numbers and descriptions of the changes. For each update, provide a brief analysis of how it might affect the authentication process, whether positively or negatively. Summarize your findings in a structured format, highlighting any critical updates that require immediate attention.

Diagnose the Wall

Isolate and Fix

Focus on the specific part of the code that needs correction.

Correct Authentication Logic

Identify the issues in the authentication logic of the system. Analyze the current implementation and describe the specific areas where the logic fails, including potential security vulnerabilities. Suggest detailed corrections to improve the authentication process, and provide code snippets that illustrate the necessary changes. Ensure that the corrections enhance both functionality and security, and explain the reasoning behind each suggested fix.

Isolate and Fix

Adjust Session Handling

Please review the current session management code for [APPLICATION NAME] and identify any potential issues related to session handling. Provide a detailed analysis of the problems you find, including security vulnerabilities, performance concerns, or usability issues. Then, offer a revised version of the session management code that addresses these issues, ensuring it follows best practices for security and efficiency. Include comments in the code to explain the changes made and the rationale behind them.

Isolate and Fix

Resolve Dependency Conflicts

Identify and analyze any dependency conflicts that are impacting the authentication process in the project. Provide a detailed list of the conflicting dependencies, including their current versions and the specific issues they are causing. Suggest compatible versions or alternative libraries that can be used to resolve these conflicts, along with a brief explanation of why each suggestion is appropriate. Additionally, outline the steps needed to implement these changes and ensure that the authentication functionality works seamlessly after the updates.

Isolate and Fix

Patch Security Vulnerabilities

Identify and analyze any security vulnerabilities that may have been introduced by recent changes in the codebase. Provide a detailed report outlining the specific vulnerabilities, including their potential impact and the areas of the code affected. Propose effective patches for each identified vulnerability, and include relevant code examples demonstrating how to implement these fixes. Ensure that the recommendations follow best practices for security and are clearly explained for easy understanding.

Isolate and Fix

Refactor for Stability

Refactor the authentication code to enhance its stability and prevent potential issues in the future. Please provide a detailed code sample that includes comments explaining the changes made and the reasoning behind each modification. Additionally, outline any best practices that were implemented in the refactoring process, and suggest any potential areas for further improvement or testing. Ensure that the final code is well-structured and adheres to coding standards.

Isolate and Fix

Verify the Resolution

Ensure the authentication flow is working as expected after fixes.

Run Authentication Tests

Please execute the authentication test suite for the [APPLICATION NAME] and provide a detailed report of the results. Include the total number of tests run, how many tests passed, and any failures along with their error messages. Additionally, summarize any patterns observed in the failures and suggest potential areas for improvement in the authentication process. Format the report in a clear and structured manner for easy review.

Verify the Resolution

Simulate User Login

Simulate a user login process for [APPLICATION NAME] using the credentials [USERNAME] and [PASSWORD]. Ensure that the login completes successfully without any errors and that the user is directed to the appropriate landing page. After the simulation, provide a detailed summary of the results, including any error messages encountered, the time taken for the login process, and whether the expected user interface elements are displayed post-login. Additionally, include any observations regarding the overall user experience during the login process.

Verify the Resolution

Check Session Persistence

Please verify the persistence of user sessions during interactions within the application. Conduct a series of tests simulating user actions, such as logging in, navigating through different sections, and logging out. Document any anomalies encountered, such as unexpected session expirations or failures to maintain user state, and confirm correct behavior when sessions persist as expected. Provide a detailed report summarizing your findings, including steps taken during testing and any recommendations for improvements if issues are found.

Verify the Resolution

Validate Security Measures

Please assess the security measures implemented in the authentication flow for [APPLICATION NAME]. Evaluate each measure to ensure they are functioning as intended, including password policies, two-factor authentication, session management, and data encryption. Provide a detailed report on any vulnerabilities or weaknesses identified, along with recommendations for improvements. Additionally, confirm compliance with relevant security standards and best practices. Summarize your findings in a structured format, highlighting key areas of concern and suggested actions.

Verify the Resolution

Confirm Dependency Stability

Please verify the stability of all dependencies related to the authentication process. Create a detailed report that includes the following: a list of each dependency, its current version, and any known issues or conflicts that may affect authentication. Additionally, assess whether each dependency is up-to-date and provide recommendations for any necessary updates or changes. The report should be structured clearly with headings for each dependency and a summary of your findings at the end.

Verify the Resolution

Prevent Recurrence

Create safeguards to avoid similar issues in the future.

Draft Authentication Rules

Draft a set of comprehensive authentication rules for inclusion in CLAUDE.md to guide future implementations. These rules should address key areas such as password complexity requirements, multi-factor authentication protocols, session management practices, and guidelines for handling authentication failures. Ensure that the rules are clear, actionable, and structured in a way that allows for easy reference. Aim for a length of at least 300 words to cover all necessary aspects thoroughly.

Prevent Recurrence

Create Session Checklist

Please create a detailed checklist for session management that ensures consistency and reliability in web applications. The checklist should include key elements such as session creation, validation, expiration, and destruction processes. Additionally, cover best practices for secure session storage, handling session hijacking, and implementing user logout functionality. Format the checklist in a clear, organized manner with bullet points for easy reference, and ensure it is comprehensive enough to serve as a reliable guide for developers.

Prevent Recurrence

Implement Dependency Guidelines

Please formulate comprehensive guidelines for managing dependencies related to authentication that can be included in a document titled CLAUDE.md. The guidelines should cover best practices for selecting, updating, and monitoring authentication libraries and frameworks, as well as strategies for ensuring compatibility and security. Include sections on assessing the risks associated with dependencies, the importance of regular audits, and how to document any changes made to these dependencies. Aim for a clear and structured format that can be easily followed by developers.

Prevent Recurrence

Add Security Comments

Review the following code snippet for security vulnerabilities and add detailed comments to highlight critical security considerations. For each identified issue, explain why it is a concern and suggest best practices to mitigate the risk. Ensure that the comments are clear and informative, making it easy for future developers to understand the security implications. The code snippet is: [INSERT CODE SNIPPET HERE].

Prevent Recurrence

Establish Naming Conventions

Please define a comprehensive set of naming conventions specifically for authentication-related code. Include guidelines on how to name variables, functions, classes, and files to enhance clarity and maintainability. Ensure the conventions cover aspects such as consistency, readability, and the context of use. Provide examples for each type of naming convention and format the response in a clear, structured manner that can be easily referenced by developers.

Prevent Recurrence

Frequently asked questions

Why did my authentication flow break after a refactor?+

Windsurf's Cascade mode may have altered files beyond the intended scope, affecting the authentication flow. Use diagnostic prompts to identify unintended changes.

How can I ensure my session management is robust?+

Leverage Windsurf's ability to analyze session handling code for potential issues and apply fixes. Implement session checklists to maintain consistency.

What should I do if dependency updates break authentication?+

Review dependency updates with Windsurf to identify conflicts. Use its suggestions to resolve issues or revert to stable versions.

How can I prevent security vulnerabilities in my authentication code?+

Use Windsurf to scan for vulnerabilities and apply patches. Create CLAUDE.md rules to enforce security best practices in future changes.

Can Windsurf help with testing authentication flows?+

Yes, Windsurf can run authentication tests and simulate user interactions to verify the flow's correctness. Use verification prompts to ensure comprehensive testing.