| name | file-edit-safety |
| description | Safe file modification procedures following user's strict preferences. Use before ANY file modification - research first, verify changes, never leave things broken. |
File Edit Safety Protocol
User's strict rule: Be CAREFUL before modifying any files — research first, verify changes, don't leave things broken.
Mandatory Process
1. BEFORE Editing
2. DURING Editing
- Use
patch tool with EXACT unique strings (include surrounding context)
- Make one change at a time
- Verify syntax after each change
- Never batch-edit without understanding each change
3. AFTER Editing
Safe Patterns
Python Files
python3 -m py_compile <file.py>
Config Files (YAML/JSON)
python3 -c "import yaml; yaml.safe_load(open('file.yaml'))"
python3 -c "import json; json.load(open('file.json'))"
Shell Scripts
bash -n <script.sh>
Anti-Patterns to AVOID
- ❌ Writing entire files from scratch (use patch instead)
- ❌ Guessing config keys (check 3-10 sources first)
- ❌ Multiple edits at once (do one, verify, proceed)
- ❌ Assuming file format (read first!)
Quick Recovery
If something breaks:
- Check git for previous version
- Restore from backup
- Tell user what happened and fix it
Decision Framework
Before making a change, ask:
- Do I understand this file's purpose?
- Do I know the exact string to replace?
- Can I verify the change is correct?
- Can I revert if wrong?
If any answer is NO - research first.