| name | clawdbot-backup |
| description | Backup and restore ClawdBot configuration, skills, commands, and settings. Sync across devices, version control with git, automate backups, and migrate to new machines. |
| homepage | https://github.com/clawdbot/backup-skill |
| metadata | {"clawdbot":{"emoji":"๐พ","requires":{"bins":["git","tar","rsync"],"env":[]}}} |
ClawdBot Backup Skill
Backup, restore, and sync your ClawdBot configuration across devices directly from Clawdbot.
Overview
This skill helps you:
- Backup all ClawdBot data and settings
- Restore from backups
- Sync between multiple machines
- Version control your configuration
- Automate backup routines
- Migrate to new devices
ClawdBot Directory Structure
Key Locations
~/.claude/ # Main ClawdBot directory
โโโ settings.json # Global settings
โโโ settings.local.json # Local overrides (machine-specific)
โโโ projects.json # Project configurations
โโโ skills/ # Your custom skills
โ โโโ skill-name/
โ โ โโโ SKILL.md
โ โ โโโ supporting-files/
โ โโโ another-skill/
โโโ commands/ # Custom slash commands (legacy)
โ โโโ command-name.md
โโโ contexts/ # Saved contexts
โโโ templates/ # Response templates
โโโ mcp/ # MCP server configurations
โโโ servers.json
~/projects/ # Your projects (optional backup)
โโโ project-1/
โ โโโ .claude/ # Project-specific config
โ โโโ settings.json
โ โโโ skills/
โโโ project-2/
What to Backup
ESSENTIAL (Always backup):
โ ~/.claude/skills/ # Custom skills
โ ~/.claude/commands/ # Custom commands
โ ~/.claude/settings.json # Global settings
โ ~/.claude/mcp/ # MCP configurations
RECOMMENDED (Usually backup):
โ ~/.claude/contexts/ # Saved contexts
โ ~/.claude/templates/ # Templates
โ Project .claude/ folders # Project configs
OPTIONAL (Case by case):
โ ~/.claude/settings.local.json # Machine-specific
โ Cache directories # Can be rebuilt
โ Log files # Usually not needed
Quick Backup Commands
Full Backup
BACKUP_DIR="$HOME/clawdbot-backups"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
BACKUP_NAME="clawdbot_backup_$TIMESTAMP"
mkdir -p "$BACKUP_DIR"
tar -czvf "$BACKUP_DIR/$BACKUP_NAME.tar.gz" \
-C "$HOME" \
.claude/skills \
.claude/commands \
.claude/settings.json \
.claude/mcp \
.claude/contexts \
.claude/templates \
2>/dev/null
echo "Backup created: $BACKUP_DIR/$BACKUP_NAME.tar.gz"
Quick Skills-Only Backup
tar -czvf ~/clawdbot_skills_$(date +%Y%m%d).tar.gz \
-C "$HOME" .claude/skills .claude/commands
Restore from Backup
BACKUP_FILE="$HOME/clawdbot-backups/clawdbot_backup_20260129.tar.gz"
tar -tzvf "$BACKUP_FILE"
tar -xzvf "$BACKUP_FILE" -C "$HOME"
echo "Restore complete!"
Backup Script
Full-Featured Backup Script
#!/bin/bash
set -e
BACKUP_ROOT="${CLAWDBOT_BACKUP_DIR:-$HOME/clawdbot-backups}"
CLAUDE_DIR="$HOME/.claude"
MAX_BACKUPS=10
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
check_claude_dir() {
if [ ! -d "$CLAUDE_DIR" ]; then
log_error "ClawdBot directory not found: $CLAUDE_DIR"
exit 1
fi
}
create_backup() {
local backup_type=
backup_name=
backup_path=
-p
log_info
full)
tar -czvf \
-C \
.claude/skills \
.claude/commands \
.claude/settings.json \
.claude/settings.local.json \
.claude/projects.json \
.claude/mcp \
.claude/contexts \
.claude/templates \
2>/dev/null ||
;;
skills)
tar -czvf \
-C \
.claude/skills \
.claude/commands \
2>/dev/null ||
;;
settings)
tar -czvf \
-C \
.claude/settings.json \
.claude/settings.local.json \
.claude/mcp \
2>/dev/null ||
;;
*)
log_error
1
;;
[ -f ];
size=$( -h | -f1)
log_info
log_error
1
}
() {
log_info
[ -d ];
-lh /*.tar.gz 2>/dev/null | \
awk || \
}
() {
backup_file=
[ -z ];
log_error
list_backups
1
[ ! -f ];
backup_file=
[ ! -f ];
log_error
1
log_warn
-p confirm
[ != ] && [ != ];
log_info
0
log_info
tar -xzvf -C
log_info
}
() {
log_info
2>/dev/null ||
count=$( -1 *.tar.gz 2>/dev/null | -l)
[ -gt ];
to_delete=$((count - MAX_BACKUPS))
-1t *.tar.gz | -n | xargs -v
log_info
log_info
}
() {
log_info
-sh /skills 2>/dev/null ||
-sh /commands 2>/dev/null ||
-sh /mcp 2>/dev/null ||
-sh 2>/dev/null ||
find -name 2>/dev/null | -l | xargs
find -name 2>/dev/null | -l | xargs
[ -d ];
-sh
-1 /*.tar.gz 2>/dev/null | -l | xargs
}
() {
<<
}
() {
check_claude_dir
backup)
create_backup
;;
restore)
restore_backup
;;
list)
list_backups
;;
cleanup)
cleanup_backups
;;
stats)
show_stats
;;
|--|-h)
usage
;;
*)
log_error
usage
1
;;
}
main
Save and Use
cat > ~/.local/bin/clawdbot-backup << 'SCRIPT'
SCRIPT
chmod +x ~/.local/bin/clawdbot-backup
clawdbot-backup backup
clawdbot-backup backup skills
clawdbot-backup list
clawdbot-backup restore <file>
Git Version Control
Initialize Git Repo
cd ~/.claude
git init
cat > .gitignore << 'EOF'
settings.local.json
cache/
*.tmp
*.log
*.tar.gz
*.zip
*.pem
*.key
credentials/
EOF
git add .
git commit -m "Initial ClawdBot configuration backup"
Push to Remote
git remote add origin git@github.com:username/clawdbot-config.git
git push -u origin main
Daily Workflow
cd ~/.claude
git add .
git commit -m "Updated skill: trading-bot"
git push
Auto-Commit Script
#!/bin/bash
cd ~/.claude || exit 1
if git diff --quiet && git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
CHANGED=$(git status --short | head -5 | awk '{print $2}' | tr '\n' ', ')
git add .
git commit -m "Auto-backup: $CHANGED ($(date +%Y-%m-%d))"
git push 2>/dev/null || echo "Push failed (offline?)"
Sync Between Devices
Method 1: Git Sync
git clone git@github.com:username/clawdbot-config.git ~/.claude
cd ~/.claude && git pull
cd ~/.claude && git add . && git commit -m "Update" && git push
Method 2: Rsync
rsync -avz --delete \
~/.claude/ \
user@server:~/clawdbot-backup/
rsync -avz --delete \
user@server:~/clawdbot-backup/ \
~/.claude/
Method 3: Cloud Storage
CLOUD_DIR="$HOME/Dropbox/ClawdBot"
rsync -avz ~/.claude/skills/ "$CLOUD_DIR/skills/"
rsync -avz ~/.claude/commands/ "$CLOUD_DIR/commands/"
cp ~/.claude/settings.json "$CLOUD_DIR/"
Sync Script
#!/bin/bash
SYNC_DIR="${CLAWDBOT_SYNC_DIR:-$HOME/Dropbox/ClawdBot}"
CLAUDE_DIR="$HOME/.claude"
sync_to_cloud() {
echo "Syncing to cloud..."
mkdir -p "$SYNC_DIR"
rsync -avz --delete "$CLAUDE_DIR/skills/" "$SYNC_DIR/skills/"
rsync -avz --delete "$CLAUDE_DIR/commands/" "$SYNC_DIR/commands/"
rsync -avz "$CLAUDE_DIR/mcp/" "$SYNC_DIR/mcp/" 2>/dev/null
cp "$CLAUDE_DIR/settings.json" "$SYNC_DIR/" 2>/dev/null
echo "Sync complete!"
}
sync_from_cloud() {
echo "Syncing from cloud..."
rsync -avz "$SYNC_DIR/skills/" "$CLAUDE_DIR/skills/"
rsync -avz "$SYNC_DIR/commands/" "$CLAUDE_DIR/commands/"
rsync -avz "$SYNC_DIR/mcp/" "$CLAUDE_DIR/mcp/" 2>/dev/null
[ ! -f ];
2>/dev/null
}
push) sync_to_cloud ;;
pull) sync_from_cloud ;;
*)
;;
Automated Backups
Cron Job (Linux/Mac)
crontab -e
0 2 * * * /home/user/.local/bin/clawdbot-backup backup full
0 3 * * 0 /home/user/.local/bin/clawdbot-backup cleanup
0 */6 * * * cd ~/.claude && git add . && git commit -m "Auto-backup $(date +\%Y-\%m-\%d)" && git push 2>/dev/null
Systemd Timer (Linux)
cat > ~/.config/systemd/user/clawdbot-backup.service << 'EOF'
[Unit]
Description=ClawdBot Backup
[Service]
Type=oneshot
ExecStart=/home/user/.local/bin/clawdbot-backup backup full
EOF
cat > ~/.config/systemd/user/clawdbot-backup.timer << 'EOF'
[Unit]
Description=Daily ClawdBot Backup
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
EOF
systemctl --user enable clawdbot-backup.timer
systemctl --user start clawdbot-backup.timer
Launchd (macOS)
cat > ~/Library/LaunchAgents/com.clawdbot.backup.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.clawdbot.backup</string>
<key>ProgramArguments</key>
<array>
<string>/Users/username/.local/bin/clawdbot-backup</string>
<string>backup</string>
<string>full</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>2</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
EOF
launchctl load ~/Library/LaunchAgents/com.clawdbot.backup.plist
Migration Guide
Migrate to New Machine
clawdbot-backup backup full
scp ~/clawdbot-backups/clawdbot_full_*.tar.gz newmachine:~/
cd ~/.claude
git add . && git commit -m "Pre-migration backup"
git push
tar -xzvf ~/clawdbot_full_*.tar.gz -C ~
git clone git@github.com:username/clawdbot-config.git ~/.claude
ls -la ~/.claude/skills/
Export Single Skill
SKILL_NAME="my-awesome-skill"
tar -czvf "${SKILL_NAME}.tar.gz" -C ~/.claude/skills "$SKILL_NAME"
tar -xzvf "${SKILL_NAME}.tar.gz" -C ~/.claude/skills/
Export All Skills for Sharing
tar -czvf clawdbot-skills-share.tar.gz \
-C ~/.claude \
skills \
--exclude='*.local*' \
--exclude='*personal*'
Backup Verification
Verify Backup Integrity
tar -tzvf backup.tar.gz > /dev/null && echo "Backup OK" || echo "Backup CORRUPT"
tar -tzvf backup.tar.gz
tar -tzvf backup.tar.gz | grep "skills/my-skill/SKILL.md"
Compare Backup to Current
TEMP_DIR=$(mktemp -d)
tar -xzf backup.tar.gz -C "$TEMP_DIR"
diff -rq ~/.claude/skills "$TEMP_DIR/.claude/skills"
rm -rf "$TEMP_DIR"
Troubleshooting
Common Issues
chmod -R u+rw ~/.claude
tar --exclude='cache' --exclude='*.log' -czvf backup.tar.gz ~/.claude
cd ~/.claude
git stash
git pull
git stash pop
Recovery from Corruption
mv ~/.claude ~/.claude.corrupted
clawdbot-backup restore latest.tar.gz
git clone git@github.com:username/clawdbot-config.git ~/.claude
diff -rq ~/.claude ~/.claude.corrupted/
Quick Reference
Essential Commands
tar -czvf ~/clawdbot-backup.tar.gz -C ~ .claude/skills .claude/commands .claude/settings.json
tar -xzvf ~/clawdbot-backup.tar.gz -C ~
tar -tzvf ~/clawdbot-backup.tar.gz
cd ~/.claude && git add . && git commit -m "Backup" && git push
cd ~/.claude && git pull
Backup Checklist
Before major changes:
โก Create backup
โก Verify backup integrity
โก Note what you're changing
Regular maintenance:
โก Weekly full backup
โก Daily git commits (if using)
โก Monthly cleanup of old backups
โก Test restore procedure quarterly
Resources
Related Skills
- skill-creator - Create new skills
- mcp-builder - Configure MCP servers
- dotfiles - General dotfile management
Documentation
- ClawdBot Docs: docs.clawdbot.com
- Skills Guide: docs.clawdbot.com/skills
- MCP Setup: docs.clawdbot.com/mcp
Tip: Always test your backup restoration process before you actually need it. A backup you can't restore is worthless!