Seven Prompts: Solving Hallucination and Improving Efficiency
1. Step by Step
Sometimes when we use AI models like Claude, they might overlook certain details leading to various issues. Using the COT (Chain of Thought) structure prompt below can effectively help Claude analyze the cause of errors and create a fix plan.
Prompt:
@page.tsx I got this error:{{erros}}
Use Chain of thought reasoning to find the core issue of this error,
then create a step by step plan to fix the error.
Note: "step by step" is a magic phrase in prompt writing that utilizes the chain of thought to inspire AI models to reason and provide answers. Conversations using this magic phrase tend to yield higher quality responses compared to those without it.
2. Reference Current Documentation Again
After successfully executing a command, reference the current documentation again to help AI understand the scope of work for the next module. Using this information allows AI to understand more before writing code, which helps eliminate code generation hallucinations.
Prompt:
Great. Header looks good.
Now we move to "x" section. Refer to @frontend-guidelines.md to understand the scope of work for this feature.
Before implementation if you need more clarification or have any questions, ask me!
3. Explain Implementation First, Then Process After Confirmation
This structure is used to provide updates to AI, indicating that the current task is complete and we can move on to the next task.
- Provide update: "Header menu is now perfectly centered"
- Provide next task: "Now we need sign in and sign up buttons"
- Reference correct documentation: "Check documentation and explain how you will implement these requirements"
Prompt:
Header menu is now aligned in center perfectly.
Now we need a sign in and sign up buttons.
Check @frontend-guidelines.md and explain how you will implement this.
4. Track Progress with Status Files, Provide Context
Use this prompt to track all work, which can provide progress context for AI and resolve errors.
At the end of each completed step, record your work in the .md document. Then answer these three questions in sequence, don't miss any information:
What features did we implement? What problems did we encounter? How did we fix these errors?
5. Keep Work Logs
When we use AI again, we need to know what has been done before. Therefore, this file helps us maintain work logs and understand both completed work and remaining tasks.
At the end of the conversation, record your work log in the process-status.md file.
First, check the process.md file to understand all the features we implemented in this conversation. Then write a detailed meeting report and provide detailed background information for the next work session.
6. Define Scope, Prevent Over-execution
Cursor's Agent mode might over-execute operations, causing previously developed features to fail.
Prompt: Read the instructions in @(document name) to understand the scope of work for this feature. Use chain of thought reasoning to create a step-by-step implementation plan. Ensure you explain how every section of this feature works providing macro-level details. Break these items into detailed numbered steps.
1.Read instructions in @ (document name) to understand the scope of work for this feature.
2.Use chain of thought reasoning to create a step by step implementation plan.
3.Ensure you explain how every section of this feature works providing macro-level details.
4.Break these items into detailed numbered steps.
After executing this prompt, verify that all content aligns with the request and approve. This helps resolve the issue of Cursor Agent making unnecessary edits.
7. Centralize Core Documentation for Easy Access
Create a folder to store all core documentation, including but not limited to:
Project requirements documentation, application flow documentation, frontend development documentation, backend architecture documentation, tech stack documentation, file structure documentation