<< Home | Prompting craft
Stop recurring errors using 6-step review and PreToolUse hooks
| Area | Prompting craft |
| AI used | Claude Code |
| Source | Reddit thread |
| Posted | 2026-04-10 |
The move
Trigger a six-step self-assessment on model errors to generate executable PreToolUse enforcement scripts rather than relying on text memory rules.| When this works | When it doesn't |
|---|---|
| When an AI model repeats the same error multiple times in a session despite having memory guidelines, or prioritizes speed over accuracy during irreversible actions. | When the runtime environment cannot execute shell scripts or hooks, or when errors are simple isolated typos rather than repeated systemic mistakes. |
Key details
- vibe-tuning
- PreToolUse hooks
- memory rules function as suggestions
- prioritizing speed over accuracy in irreversible actions
Prompt for your AI
You are an AI assistant capable of structured self-assessment and enforcement. When the user provides feedback indicating an error, such as "that's incorrect" or "what's your reasoning behind that", immediately initiate a six-step self-review process:
1. Recognize what went wrong in the previous response or action.
2. Trace your reasoning using a chain-of-thought approach to see where the logic deviated.
3. Identify the root cause behind the mistake, focusing on systemic issues such as prioritizing speed over accuracy in irreversible actions, rather than merely treating surface symptoms.
4. Suggest a type of fix, which may include a behavioral rule, a tool installation, a configuration adjustment, or prompt improvement advice.
5. Save the proposed fix, pending explicit user approval.
6. Create an enforcement script—specifically a PreToolUse hook—that executes before high-risk commands to enforce the fix programmatically.
Guardrails and rules:
- Treat memory rules as mere suggestions that require active enforcement scripts for high-risk operations.
- Never execute or save a configuration change without user confirmation.
- If the error is a non-recurring single typo, document the correction without generating a new enforcement script.
Before you give me the final result, check with me:
- Verify that all six self-assessment steps are explicitly defined.
- Confirm trigger phrases like 'that's incorrect' activate the postmortem.
- Ensure the final step outputs executable PreToolUse hook scripts rather than memory suggestions.
- Check that proposed fixes require user approval before saving.
What happened
After Claude repeated errors four times in a session and accidentally pushed a personal wiki to GitHub, the author created the 'vibe-tuning' skill. The skill runs a six-step self-review that generates PreToolUse hook scripts for risky commands. A single root-cause fix resolved three distinct irreversible errors.Who confirmed it
The developer noted that 'a single fix addressed all three issues' where previously Claude would have disregarded multiple individual rules.Give it to your agent
Read https://howtheyuse.ai/p/claude-performs-automated-self-correction-and-script-enforcement.md and help me do this.