Backup Before Edit
Hooks pre-tool 1,297
Create automatic backup of files before any Edit operation for safety. This hook creates a timestamped backup copy (filename.backup.timestamp) of any existing file before Claude modifies it. Provides a safety net to recover previous versions if needed. Only backs up existing files, includes error suppression to handle edge cases gracefully.
npx claude-code-templates@latest --hook pre-tool/backup-before-edit claude-code — backup-before-edit
Content
JSON
{
"description": "Create automatic backup of files before any Edit operation for safety. This hook..."
"hooks": {
"PreToolUse": [1 item]
}
}