Backup and restore ClawdBot configuration, skills, commands, and settings. Sync across devices, version control with git, automate backups, and migrate to new machines.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install clawdbot-backup或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install clawdbot-backup⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/clawdbot-backup/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- 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":[]}}} ---
Backup, restore, and sync your ClawdBot configuration across devices directly from Clawdbot.
This skill helps you:
~/.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/
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
# Create timestamped 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"
# Backup just skills
tar -czvf ~/clawdbot_skills_$(date +%Y%m%d).tar.gz \
-C "$HOME" .claude/skills .claude/commands
# Restore full backup
BACKUP_FILE="$HOME/clawdbot-backups/clawdbot_backup_20260129.tar.gz"
# Preview contents first
tar -tzvf "$BACKUP_FILE"
# Restore (will overwrite existing)
tar -xzvf "$BACKUP_FILE" -C "$HOME"
echo "Restore complete!"
#!/bin/bash
# clawdbot-backup.sh - Comprehensive ClawdBot backup tool
set -e
# Configuration
BACKUP_ROOT="${CLAWDBOT_BACKUP_DIR:-$HOME/clawdbot-backups}"
CLAUDE_DIR="$HOME/.claude"
MAX_BACKUPS=10 # Keep last N backups
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
# Colors
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 if ClawdBot directory exists
check_claude_dir() {
if [ ! -d "$CLAUDE_DIR" ]; then
log_error "ClawdBot directory not found: $CLAUDE_DIR"
exit 1
fi
}
# Create backup
create_backup() {
local backup_type="${1:-full}"
local backup_name="clawdbot_${backup_type}_${TIMESTAMP}"
local backup_path="$BACKUP_ROOT/$backup_name.tar.gz"
mkdir -p "$BACKUP_ROOT"
log_info "Creating $backup_type backup..."
case $backup_type in
full)
tar -czvf "$backup_path" \
-C "$HOME" \
.claude/skills \
.claude/commands \
.claude/settings.json \
.claude/settings.local.json \
.claude/projects.json \
.claude/mcp \
.claude/contexts \
.claude/templates \
2>/dev/null || true
;;
skills)
tar -czvf "$backup_path" \
-C "$HOME" \
.claude/skills \
.claude/commands \
2>/dev/null || true
;;
settings)
tar -czvf "$backup_path" \
-C "$HOME" \
.claude/settings.json \
.claude/settings.local.json \
.claude/mcp \
2>/dev/null || true
;;
*)
log_error "Unknown backup type: $backup_type"
exit 1
;;
esac
if [ -f "$backup_path" ]; then
local size=$(du -h "$backup_path" | cut -f1)
log_info "Backup created: $backup_path ($size)"
else
log_error "Backup failed!"
exit 1
fi
}
# List backups
list_backups() {
log_info "Available backups in $BACKUP_ROOT:"
echo ""
if [ -d "$BACKUP_ROOT" ]; then
ls -lh "$BACKUP_ROOT"/*.tar.gz 2>/dev/null | \
awk '{print $9, $5, $6, $7, $8}' || \
echo "No backups found."
else
echo "Backup directory doesn't exist."
fi
}
# Restore backup
restore_backup() {
local backup_file="$1"
if [ -z "$backup_file" ]; then
log_error "Please specify backup file"
list_backups
exit 1
fi
if [ ! -f "$backup_file" ]; then
# Try relative path in backup dir
backup_file="$BACKUP_ROOT/$backup_file"
fi
if [ ! -f "$backup_file" ]; then
log_error "Backup file not found: $backup_file"
exit 1
fi
log_warn "This will overwrite existing configuration!"
read -p "Continue? (y/N) " confirm
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
log_info "Restore cancelled."
exit 0
fi
log_info "Restoring from: $backup_file"
tar -xzvf "$backup_file" -C "$HOME"
log_info "Restore complete!"
}
# Clean old backups
cleanup_backups() {
log_info "Cleaning old backups (keeping last $MAX_BACKUPS)..."
cd "$BACKUP_ROOT" 2>/dev/null || return
local count=$(ls -1 *.tar.gz 2>/dev/null | wc -l)
if [ "$count" -gt "$MAX_BACKUPS" ]; then
local to_delete=$((count - MAX_BACKUPS))
ls -1t *.tar.gz | tail -n "$to_delete" | xargs rm -v
log_info "Removed $to_delete old backup(s)"
else
log_info "No cleanup needed ($count backups)"
fi
}
# Show backup stats
show_stats() {
log_info "ClawdBot Backup Statistics"
echo ""
echo "=== Directory Sizes ==="
du -sh "$CLAUDE_DIR"/skills 2>/dev/null || echo "Skills: N/A"
du -sh "$CLAUDE_DIR"/commands 2>/dev/null || echo "Commands: N/A"
du -sh "$CLAUDE_DIR"/mcp 2>/dev/null || echo "MCP: N/A"
du -sh "$CLAUDE_DIR" 2>/dev/null || echo "Total: N/A"
echo ""
echo "=== Skills Count ==="
find "$CLAUDE_DIR/skills" -name "SKILL.md" 2>/dev/null | wc -l | xargs echo "Skills:"
find "$CLAUDE_DIR/commands" -name "*.md" 2>/dev/null | wc -l | xargs echo "Commands:"
echo ""
echo "=== Backup Directory ==="
if [ -d "$BACKUP_ROOT" ]; then
du -sh "$BACKUP_ROOT"
ls -1 "$BACKUP_ROOT"/*.tar.gz 2>/dev/null | wc -l | xargs echo "Backup files:"
else
echo "No backups yet"
fi
}
# Usage
usage() {
cat << EOF
ClawdBot Backup Tool
Usage: $(basename $0) <command> [options]
...安装 Clawdbot Backup 后,可以对 AI 说这些话来触发它
Help me get started with Clawdbot Backup
Explains what Clawdbot Backup does, walks through the setup, and runs a quick demo based on your current project
Use Clawdbot Backup to backup and restore ClawdBot configuration, skills, commands, and se...
Invokes Clawdbot Backup with the right parameters and returns the result directly in the conversation
What can I do with Clawdbot Backup in my documents & notes workflow?
Lists the top use cases for Clawdbot Backup, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/clawdbot-backup/ 目录(个人级,所有项目可用),或 .claude/skills/clawdbot-backup/(项目级)。重启 AI 客户端后,用 /clawdbot-backup 主动调用,或让 AI 根据上下文自动发现并使用。
Clawdbot Backup 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Clawdbot Backup 可免费安装使用。请查阅仓库了解许可证信息。
Backup and restore ClawdBot configuration, skills, commands, and settings. Sync across devices, version control with git, automate backups, and migrate to new machines.
Clawdbot Backup 属于「Documents & Notes」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my documents & notes tasks using Clawdbot Backup
Identifies repetitive steps in your workflow and sets up Clawdbot Backup to handle them automatically