Validated Fixes and CLAUDE.md Rules

Fix a coding mistake, verify the correction, and capture a scoped CLAUDE.md rule that helps prevent repeat errors.

Development / Engineeringclaude-codeclaude-md
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Claude broke our custom hook pattern. Fix it and update the rules permanently.”
Beforegeneric AI agent
I can fix that issue for you. What specific pattern did Claude break or violate? I'd strongly recommend documenting that rule manually in CLAUDE.md so it doesn't happen again in future conversations. What should the rule statement say exactly? Do you want me to add it to the very top of the file where the highest-priority rules go? This is a really important step to keep Claude on track with your codebase style and conventions.
Afterwith Validated Fixes and CLAUDE.md Rules
AUTO-UPDATE WORKFLOW — CLAUDE.MD RULE CAPTURE:
SCENARIO: Claude generated a custom React hook without first reading /hooks/PATTERNS.md documentation file. Violates team-defined rule: always check hook patterns before generating new code.
WORKFLOW EXECUTION:
1. FIX PHASE: Claude identifies violation and updates hook code to match defined pattern. Adds proper TypeScript typing, applies naming convention (usePrefix), implements named export only structure.
2. VALIDATE PHASE: Test suite runs end-to-end. Confirms fix works correctly.
3. UPDATE RULES PHASE: Claude adds permanent never-do line to top of /hooks section in CLAUDE.md:
   'NEVER generate a custom hook without reading /hooks/PATTERNS.md first. This file defines: naming convention (usePrefix), typing requirements (strict generics), export style (named export only).'
4. COMMIT PHASE: Git commit with message 'chore: add never-do rule for custom hook generation.' Includes never-do line verbatim in commit message.
OUTCOME & PERMANENCE:
Next Claude session automatically reads updated CLAUDE.md file at startup. Similar hook generation request triggers new rule recognition. Hook gets generated correctly first time. No repeat mistake occurs.
MAINTENANCE & GOVERNANCE:
All rules remain git-committed in repository. Team engineers can diff what changed. Rules ordered by priority (most important rules at top of file). File auto-prunes to 200-line maximum (oldest, lowest-priority rules automatically removed when limit reached).

About this skill

“You fixed this last session. Why are you doing it again?” This workflow repairs the immediate mistake, checks the behavior that actually failed, and turns the verified lesson into a concise CLAUDE.md rule with the right scope.

A green build alone is not enough. The workflow distinguishes a real regression check from unrelated passing tests, and a reusable project rule from a one-off workaround.

What it does

  • Traces the mistake to a specific decision, expected behavior, and supporting project evidence.
  • Fixes the affected code and selects validation that exercises the original failure.
  • Runs a bounded repair loop, separating new regressions from pre-existing failures and environment blockers.
  • Adds or revises a scoped CLAUDE.md rule with a concrete prohibited action and replacement behavior.
  • Checks for duplicate, conflicting, stale, or overly broad instructions before saving the lesson.
  • Reports the code change, validation evidence, exact rule change, and any remaining uncertainty.

What you get

A verified code correction and a small, reviewable CLAUDE.md patch, with the commands and results supporting the lesson. If execution or file access is unavailable, you get a clearly labeled provisional patch and the checks required before adopting it.

Best for

Engineers using Claude Code on an active repository where recurring mistakes involve local conventions, configuration semantics, custom APIs, or validation commands that new sessions keep missing.

SKILL.md preview

SKILL.md
---
name: validated-fixes-and-claude-md-rules
description: Repair a coding mistake, validate the failed behavior with a bounded regression loop, and capture the verified lesson in the narrowest appropriate CLAUDE.md without duplicating or broadening existing rules. Use when the user says "fix this and update CLAUDE.md", "you made the same mistake again", "make sure you remember this correction", "my Claude sessions keep ignoring our pattern", "add a rule so this stops happening", "the build passes but the bug is still there", or "clean up the rule after fixing it".
---

# Validated Fixes and CLAUDE.md Rules

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →