data-backup-manager
Backup and manage game data including maps, NPCs, and configurations. Use when the user wants to backup data, create snapshots, export data, or restore from backups.
When & Why to Use This Skill
The Data Backup Manager is a specialized Claude skill designed to automate the protection and management of game development assets. It streamlines the process of creating timestamped backups, validating JSON integrity, and restoring specific configurations for Babylon.js projects, ensuring data safety and workflow continuity during iterative development.
Use Cases
- Pre-refactoring Snapshots: Create a secure, timestamped backup of all game maps and NPC configurations before performing major code changes or data migrations.
- Data Integrity Validation: Automatically scan and verify the syntax of JSON data files to prevent game crashes caused by malformed configuration files.
- Granular Asset Recovery: Restore specific game components, such as a single world map or a specific NPC's data, from historical backups without affecting other project files.
- Automated Storage Optimization: Manage local disk space by automatically cleaning up old backup versions while retaining a configurable number of recent snapshots.
- Compressed Data Export: Generate compressed archives of game assets for easy sharing with team members or for off-site storage.
| name | Data Backup Manager |
|---|---|
| description | Backup and manage game data including maps, NPCs, and configurations. Use when the user wants to backup data, create snapshots, export data, or restore from backups. |
Data Backup Manager
Backup, export, and manage game data for the Babylon.js first-person game.
Quick Start
Create timestamped backup
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
mkdir -p backups/$TIMESTAMP
cp -r public/data backups/$TIMESTAMP/
echo "Backup created: backups/$TIMESTAMP"
List all backups
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
ls -lht backups/
Restore from latest backup
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
LATEST=$(ls -t backups/ | head -1)
cp -r backups/$LATEST/data/* public/data/
echo "Restored from: $LATEST"
Backup Operations
Backup specific data type
# Backup maps only
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
mkdir -p backups/$TIMESTAMP
cp -r public/data/maps backups/$TIMESTAMP/
# Backup NPCs only
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
mkdir -p backups/$TIMESTAMP
cp -r public/data/npcs backups/$TIMESTAMP/
Create compressed backup
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
tar -czf backups/backup_$TIMESTAMP.tar.gz public/data
echo "Compressed backup: backup_$TIMESTAMP.tar.gz"
Export as JSON
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
# Pretty print all JSON files
for file in public/data/**/*.json; do
echo "Formatting: $file"
node -e "console.log(JSON.stringify(JSON.parse(require('fs').readFileSync('$file')), null, 2))" > "$file.tmp" && mv "$file.tmp" "$file"
done
Data Validation
Check JSON validity
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
for file in public/data/**/*.json; do
echo -n "Checking $file: "
node -e "JSON.parse(require('fs').readFileSync('$file'))" && echo "✓ Valid" || echo "✗ Invalid"
done
Count data files
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
echo "Maps: $(find public/data/maps -name '*.json' | wc -l)"
echo "NPCs: $(find public/data/npcs -name '*.json' | wc -l)"
echo "Events: $(find public/data/events -name '*.json' | wc -l)"
echo "Investigations: $(find public/data/investigations -name '*.json' | wc -l)"
Restore Operations
Restore from specific backup
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
# List available backups first
ls -1 backups/
# Restore from chosen backup (replace BACKUP_NAME)
BACKUP_NAME="20250117_143000"
cp -r backups/$BACKUP_NAME/data/* public/data/
echo "Restored from: $BACKUP_NAME"
Restore specific file
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
LATEST=$(ls -t backups/ | head -1)
cp backups/$LATEST/data/maps/world.json public/data/maps/
echo "Restored world.json from: $LATEST"
Best Practices
- Backup before major changes: Always create backup before editing data
- Use timestamps: Makes it easy to track when backups were created
- Validate JSON: Check JSON validity after editing
- Regular backups: Create backups at end of work sessions
- Test restores: Periodically test that backups work
- Version control: Backups complement git, don't replace it
Cleanup
Remove old backups (keep last 10)
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
ls -t backups/ | tail -n +11 | xargs -I {} rm -rf backups/{}
echo "Cleaned up old backups"