Files
leo-claude-mktplace/plugins/claude-config-maintainer/skills/pre-change-protocol.md
lmiranda 7c8a20c804 refactor: extract skills from commands across 8 plugins
Refactored commands to extract reusable skills following the
Commands → Skills separation pattern. Each command is now <50 lines
and references skill files for detailed knowledge.

Plugins refactored:
- claude-config-maintainer: 5 commands → 7 skills
- code-sentinel: 3 commands → 2 skills
- contract-validator: 5 commands → 6 skills
- data-platform: 10 commands → 6 skills
- doc-guardian: 5 commands → 6 skills (replaced nested dir)
- git-flow: 8 commands → 7 skills

Skills contain: workflows, validation rules, conventions,
reference data, tool documentation

Commands now contain: YAML frontmatter, agent assignment,
skills list, brief workflow steps, parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:32:24 -05:00

2.7 KiB

Pre-Change Protocol

This skill defines the mandatory Pre-Change Protocol section that MUST be included in every CLAUDE.md file.

Why This Is Mandatory

The Pre-Change Protocol prevents the #1 cause of bugs from AI-assisted coding: incomplete changes where Claude modifies some files but misses others that reference the same code.

Without this protocol:

  • Claude may rename a function but miss callers
  • Claude may modify a config but miss documentation
  • Claude may update a schema but miss dependent code

Detection

Search CLAUDE.md for these indicators:

  • Header containing "Pre-Change" or "Before Any Code Change"
  • References to grep -rn or impact search
  • Checklist with "Files That Will Be Affected"
  • User verification checkpoint

Required Section Content

## MANDATORY: Before Any Code Change

**Claude MUST show this checklist BEFORE editing any file:**

### 1. Impact Search Results
Run and show output of:
```bash
grep -rn "PATTERN" --include="*.sh" --include="*.md" --include="*.json" --include="*.py" | grep -v ".git"

2. Files That Will Be Affected

Numbered list of every file to be modified, with the specific change for each.

3. Files Searched But Not Changed (and why)

Proof that related files were checked and determined unchanged.

4. Documentation That References This

List of docs that mention this feature/script/function.

User verifies this list before Claude proceeds. If Claude skips this, stop immediately.

After Changes

Run the same grep and show results proving no references remain unaddressed.


## Placement

Insert Pre-Change Protocol section:
- **After:** Critical Rules section
- **Before:** Common Operations section

## If Missing During Analysis

Flag as **HIGH PRIORITY** issue:

  1. [HIGH] Missing Pre-Change Protocol section CLAUDE.md lacks mandatory dependency-check protocol. Impact: Claude may miss file references when making changes, leading to broken dependencies and incomplete updates.

    Recommendation: Add Pre-Change Protocol section immediately. This is the #1 cause of cascading bugs from incomplete changes.


## If Missing During Optimization

**Automatically add the section** at the correct position. This is the highest priority enhancement.

## Variations

The exact wording can vary, but these elements are required:

1. **Search requirement** - Must run grep/search before changes
2. **Affected files list** - Must enumerate all files to modify
3. **Non-affected files proof** - Must show what was checked but unchanged
4. **Documentation check** - Must list referencing docs
5. **User checkpoint** - Must pause for user verification
6. **Post-change verification** - Must verify after changes