20 of the best prompts for correcting shell command errors, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
20 of the best prompts for correcting shell command errors, step by step across 4 stages. Works with ChatGPT, Claude, and Gemini.
Published June 28, 2026
Most people try to use AI for Correcting Shell Command Errors with a single vague prompt and get generic results. This guide takes a different approach: 4 targeted stages, from Diagnose the Wall through Prevent Recurrence, each with a prompt that gives the AI exactly the context it needs. Windsurf executes shell commands that break the environment or are incompatible with the project setup. This can lead to broken builds, failed deployments, or corrupted environments. These prompts help developers diagnose, fix, and prevent these issues effectively. Works with ChatGPT, Claude, and Gemini.
Identify which shell commands are causing issues and why they are problematic.
Identify Problematic Commands
Please provide a detailed list of all shell commands you have executed recently. For each command, indicate whether it resulted in an error or unexpected behavior. Additionally, explain the context in which each command was used, including the expected outcome and any discrepancies you observed. This will help in diagnosing the issue more effectively.
Check Environment Compatibility
Given the following environment setup: [PASTE DETAILS], please analyze the compatibility of the executed commands. Identify any commands that may be incompatible with this setup and explain why they are problematic. Additionally, suggest alternative commands or modifications that could resolve these compatibility issues.
Review Command History
Please provide a detailed review of the command history from the last shell session. Identify any commands that may have the potential to disrupt the environment, and explain why each of these commands could be problematic. Additionally, categorize the commands based on their function, such as file manipulation, system changes, or network configurations. Summarize your findings in a clear format that highlights the most concerning commands and includes recommendations for avoiding similar issues in the future.
Analyze Command Outputs
Please provide the output of the last five shell commands executed in the terminal. Analyze this output to identify any errors or warnings present. For each error or warning, explain its potential cause and suggest possible solutions to resolve the issues. Format your response clearly, listing each command output followed by the corresponding analysis.
Examine Cascade Mode Changes
Please examine the files modified in Cascade mode. Provide a comprehensive list of these files, including their modification dates and the specific changes made. Additionally, analyze the shell command executions associated with these modifications and identify any that appear to be unintended or erroneous. Summarize your findings in a structured report format, highlighting any potential issues and recommendations for corrective actions.
Focus on correcting the specific shell commands causing issues.
Correct Incompatible Commands
Given the environment setup details: [PASTE DETAILS], analyze the provided shell commands and identify any that are incompatible. For each incompatible command, suggest a corrected version that would work within this specific environment. Additionally, explain briefly why each correction is necessary and how it resolves the compatibility issue. Format your response in a clear list, including the original command, the corrected command, and the explanation.
Undo Harmful Changes
Identify and revert any harmful changes made to the environment by shell commands. Please provide a detailed summary of each action that was reverted, including the original state of the environment before the changes were made, the specific commands that caused disruption, and the steps taken to restore the environment to its previous state. Ensure that the summary is clear and structured, allowing for easy understanding of what changes were undone and why they were necessary.
Replace with Safe Alternatives
Identify the problematic shell commands that have been flagged as unsafe. For each command, provide a safer alternative that achieves the same outcome without compromising system security or stability. Include a brief explanation of why the alternative is safer, and ensure that the suggested commands are compatible with [OPERATING SYSTEM] and follow best practices for command-line usage. Format your response in a clear list, with each alternative command followed by its explanation.
Update Command Syntax
Please review the syntax of the following shell commands: [LIST OF COMMANDS]. Identify any errors and provide corrected versions for each command. Additionally, explain the corrections made and why they are necessary for proper execution. Format your response in a clear, structured manner, listing each original command followed by its corrected version and explanation.
Restrict Command Execution
Propose a comprehensive method to restrict the execution of harmful shell commands in future sessions. Include specific strategies for identifying and categorizing harmful commands, as well as mechanisms for preventing their execution. Discuss the implementation of user permissions and access controls, and suggest ways to monitor command usage for compliance. Additionally, outline how to educate users about safe command practices and the importance of adhering to these restrictions. Provide a detailed plan that can be followed to enhance security in shell environments.
Ensure the shell command issues are resolved and the environment is stable.
Confirm Environment Stability
Please conduct a thorough check on the current environment setup to confirm its stability after recent fixes have been applied. Identify any potential issues or discrepancies that may affect performance, and provide a summary of your findings. Include specific metrics or indicators that demonstrate the environment's stability, and suggest any further actions if necessary. Format your response in a clear report style, highlighting key areas of concern and recommendations.
Validate Command Outputs
Please execute the following shell commands: [COMMAND 1], [COMMAND 2], and [COMMAND 3]. After running each command, provide the output for each one and confirm whether they executed successfully without errors. Additionally, include any relevant information about what each command is intended to accomplish and any differences observed compared to previous outputs.
Check for Residual Errors
Please scan the environment for any remaining errors or warnings after applying the recent fixes. Provide a detailed report that includes the specific types of errors or warnings found, their severity levels, and any potential impacts they may have on system performance. Additionally, suggest any further actions that may be necessary to resolve these issues completely. Format the report in a clear, organized manner for easy review.
Verify File Integrity
Please verify the integrity of all files that were modified by Cascade mode. List each file and check for any discrepancies or issues that may affect their functionality. Provide a summary of your findings, including any files that are not intact, along with suggestions for how to resolve any identified issues. The report should be structured clearly, with sections for each file and a final conclusion on the overall integrity of the modified files.
Test Project Functionality
Please run a comprehensive test suite to verify that the project functions correctly after the recent shell command corrections. Ensure that all functionalities are tested, including [LIST SPECIFIC FUNCTIONALITIES OR MODULES TO TEST]. Provide a detailed report on any issues found, including error messages, and categorize them by severity. Additionally, summarize the overall health of the project and any areas that may require further attention or improvement.
Create safeguards to avoid similar shell command issues in the future.
Draft a CLAUDE.md Rule
Please draft a new rule for CLAUDE.md aimed at preventing shell command errors that have been occurring recently. The rule should address common mistakes that users make when entering commands, provide clear examples of incorrect versus correct usage, and outline best practices for command entry. Additionally, include a section on how to troubleshoot and resolve these errors if they occur. Format the rule in a structured manner with headings and bullet points for clarity.
Add Command Restrictions
Help me develop a comprehensive set of restrictions for shell commands that should be implemented in the project setup to prevent incorrect terminal usage. The restrictions should cover areas such as disallowing certain dangerous commands, limiting access to specific directories, and enforcing user permissions. Additionally, provide examples of commands that should be restricted and explain the rationale behind each restriction. Format the response as a detailed guideline that can be easily referenced during the project setup process.
Create a Command Checklist
Please create a comprehensive checklist that I can use to review before executing shell commands in my project environment. The checklist should include key considerations such as verifying the current directory, ensuring the correct terminal is being used, checking for any unsaved changes in files, confirming the command syntax, and reviewing any potential impacts of the command on the system. Additionally, include a section for common troubleshooting steps in case of errors. Format this checklist in a clear and organized manner for easy reference.
Document Safe Practices
Please create a detailed documentation snippet outlining safe shell command practices for users. Include key points such as the importance of double-checking commands before execution, using the `--dry-run` option where applicable, and the benefits of working in a test environment before applying changes to production. Additionally, provide examples of common commands that can be risky if misused, and suggest best practices for logging and monitoring command usage. Format this as a clear and concise guide that can be easily referenced by users.
Establish Naming Conventions
Please provide a detailed set of naming conventions for shell scripts that effectively communicate their purpose and safety level. Include guidelines on how to structure the names, such as using prefixes or suffixes that indicate whether a script is safe to run or if it performs critical operations. Additionally, suggest examples of naming formats for different types of scripts, such as those for automation, backups, or system maintenance. Aim for a comprehensive list that can help ensure clarity and consistency across all scripts in a project.
Windsurf's Cascade mode may execute shell commands autonomously, which can lead to environment issues if the commands are not compatible with your setup. Ensuring correct configuration and rules can mitigate this.
You can prevent harmful shell commands by setting up strict rules in your CLAUDE.md file and using environment-specific restrictions.
Immediately identify the command, revert any changes it made, and consult your CLAUDE.md rules to prevent recurrence.
Yes, by updating your CLAUDE.md file with specific rules and restrictions, you can guide Windsurf to avoid executing certain shell commands.
Regularly update your environment setup details in CLAUDE.md and verify compatibility with the shell commands you intend to use.
AI Prompts for Identify Shell Command Failures
Executing shell commands can lead to environment breakage or incompatibility issues, causing unexpected failures in your web app.
See promptsAI Prompts for Identifying Shell Command Failures
Executing incorrect shell commands can lead to environment failures, causing the application to break or behave unexpectedly.
See promptsAI Prompts for Correcting Shell Command Errors
Cursor executes shell commands that disrupt the environment or clash with project settings.
See prompts