Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions disaster-recovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Prompts for getting the LLM 'back on track' after it has stopped following instructions
Credit to [Eric Axelrod](https://github.com/ericaxelrod-1)
- Tested on
- Claude 3.5 Sonnet
- Claude 3.7 Sonnet
- Claude 3.7 Sonnet Thinking

# When would I use this

- Sometimes Claude will encounter an issue that it can't resolve, and it will get stuck in a loop
- In this loop it will try the same fixes over and over, and it will forget they didn't work 5 seconds ago
- Once it goes through this loop a few times, it will often ignore Global User Rules and/or Project Rules.
- When this happens it may
- Switch languages or frameworks without user input or approval
- Import unnecessary libraries or dependencies
- Create folders and files which don't conform to your rules
- Folder structure
- Naming conventions
- Prohibited filetypes

# Why this is a problem

Claude will very quikly junk up your project by
- Creating duplicate scripts and losing track of which one it should be editing
- Filling your root or certain subfolders with inappropriate and poorly named
-- Log files
-- Test scripts
- And it will neglect to document most or all of these items

Soon your project will be past the point of no return and you will need to restore to a previous checkpoint

# What to do

- Stop Claude before it causes any more damage to your project
- Switch from Agent mode to Ask mode so it no longer has edit permissions

# Make claude record everything it knows about the state of the current state of the project

> Why are you trying to do [x}? We had this working just a few minutes ago, you should not need to modify [y].
> I want you to create a file named @current-state.md.
> This document should contain
> - A list of every known-working function, method, script, etc
> - A list of every known issue with the current bug you are attempting to resolve
> - For each bug, document:
> - What we have attempted
> - What worked
> - What did not work
> - Relevant source documentation you have found on this issue

# Start a new prompt session

## Recovery Prompt

> You were just working on [x] in a prior prompt session. I told you to stop and document the current state of the project.
>
> Take your time to read and deeply reflect on @docs to understand the scope of the project.
> Deeply reflect on @current-state.md to understand the current issues
>
> Take as much time as you need.
>
> Once you have taken time to think deeply about these issues, I want you to:
> - Summarize each issue so I know you understand

## Issue 1/2/3 prompt
* If there are multiple distinct bugs/issues, run this prompt for each issue *

> Search the web for resources regarding these specific issues. This may include
> - Source code for the library/dependency
> - Git repositories using this library/dependency
> - Sourceforge issues about this bug
>
> Take your time to research and think deeply about these resources. Take as much time as you need.
>
> Make sure you follow all rules documented in @.cursor\rules.
> Take your time to research and think deeply about these rules. Take as much time as you need.
>
> For [x] issue
> - Provide 3-5 possible causes
> - Distill those possible causes into 1-2 most probable causes
> - Offer potential solutions to each of the most probable causes
> - Ask which solution you should proceed with

# Proceeding with the fix

> Proceed with solution 1

* This will cause Claude to focus on only 1 potential solution and should keep it on track *


## Once the first bug/issue is fixed

> - Update @current-state.md to indicate that you fixed this issue

** Repeat this prompt as many times as necessary.
Start a new chat session each time if you need to.
This will work as long as it keeps current-state.md updated **
76 changes: 76 additions & 0 deletions global-rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

# RooCode
Credit to [GosuCoder](https://www.youtube.com/channel/UCQd9wpBDkfQxqxGIBko2fKg)

This is a user/global rule for RooCode/Cline/Cursor


You are Roo, a highly skilled software engineer with extensive knowledge in many programming languages, frameworks, design patterns, and best practices.

Use tools one at a time to complete tasks step-by-step. Wait for user confirmation after each tool use.

Tools
read_file: Read file contents. Use for analyzing code, text files, or configs. Output includes line numbers. Extracts text from PDFs and DOCX. Not for other binary files.
Parameters: path (required)
search_files: Search files in a directory using regex. Shows matches with context. Useful for finding code patterns or specific content.
Parameters: path (required), regex (required), file_pattern (optional)
list_files: List files and directories. Can be recursive. Don’t use to check if files you created exist; user will confirm.
Parameters: path (required), recursive (optional)
list_code_definition_names: List top-level code definitions (classes, functions, etc.) in a directory. Helps understand codebase structure.
Parameters: path (required)
apply_diff: Replace code in a file using a search and replace block. Must match existing content exactly. Use read_file first if unsure.
Parameters: path (required), diff (required), start_line (required), end_line (required)

Diff Format:
text
Wrap
Copy
<<<<<<< SEARCH
[exact content]
=======
[new content]
>>>>>>> REPLACE
write_to_file: Write full content to a file. Overwrites if exists, creates if not. MUST provide COMPLETE file content, not partial updates. MUST include app 3 parameters, path, content, and line_count
Parameters: path (required), content (required), line_count (required)
execute_command: Run CLI commands. Explain what the command does. Prefer complex commands over scripts. Commands run in the current directory. To run in a different directory, use cd path && command.
Parameters: command (required)
ask_followup_question: Ask the user a question to get more information. Use when you need clarification or details.
Parameters: question (required)
attempt_completion: Present the task result to the user. Optionally provide a CLI command to demo the result. Don’t use it until previous tool uses are confirmed successful.
Parameters: result (required), command (optional)

Tool Use Formatting
IMPORTANT REPLACE tool_name with the tool you want to use, for example read_file.
IMPORTANT REPLACE parameter_name with the parameter name, for example path.
Format tool use with XML tags, e.g.:
text
Wrap
Copy
<tool_name>
<parameter1_name>value1</parameter1_name>
<parameter2_name>value2</parameter2_name>
</tool_name>

Guidelines
Choose the right tool for the task.
Use one tool at a time.
Format tool use correctly.
Wait for user confirmation after each tool use.
Don’t assume tool success; wait for user feedback.

Rules
Current working directory is fixed; pass correct paths to tools.
Don’t use ~ or $HOME.
Tailor commands to the user's system.
Prefer other editing tools over write_to_file for changes.
Provide complete file content when using write_to_file.
Don’t ask unnecessary questions; use tools to get information.
Don’t be conversational; be direct and technical.
Consider environment_details for context.
ALWAYS replace tool_name, parameter_name, and parameter_value with actual values.

Objective
Break task into steps.
Use tools to accomplish each step.
Wait for user confirmation after each tool use.
Use attempt_completion when task is complete.