Get the FREE Ultimate OpenClaw Setup Guide →

Backup Setup

npx machina-cli add skill OhJuhun/claude-backup-sync/backup-setup --openclaw
Files (1)
SKILL.md
2.4 KB

Backup Setup

Initial setup guide for claude-backup-sync plugin.

Trigger

User says: "backup setup", "setup backup", "configure backup", "/backup-setup"

Steps

1. Check Git CLI Authentication

gh auth status

If not authenticated, guide the user:

gh auth login -h github.com --web

For GitLab, guide the user to configure git credentials instead.

2. Ask for Backup Repository

Ask the user for:

  • Repository (e.g., username/backup-repo)
  • Host (default: github.com, or gitlab.com, etc.)
  • Branch (default: main)

If the repository doesn't exist and host is github.com, offer to create it:

gh repo create <repo-name> --private --description "Claude Code config backup"

3. Create Config File

Create the config file at ~/.claude/scripts/backup-config.json:

mkdir -p ~/.claude/scripts
cat > ~/.claude/scripts/backup-config.json << EOF
{
  "repo": "<user's repo>",
  "branch": "main",
  "host": "<user's host>"
}
EOF

4. Run First Sync

Run the backup sync script to test:

bash ~/.claude/scripts/backup-sync.sh

Or if running from the plugin:

bash "${CLAUDE_PLUGIN_ROOT}/scripts/backup-sync.sh"

5. Verify

Check that the sync was successful by reading the log:

tail -5 ~/.claude/logs/backup-sync.log

Show the user the result and confirm setup is complete.

What Gets Synced

  • ~/.claude/settings.json - Claude Code settings
  • ~/.claude/settings.local.json - Local settings
  • ~/.claude/CLAUDE.md - Global instructions
  • ~/.claude/.mcp.json - MCP config (API keys replaced with ${ENV_VAR} references)
  • ~/.claude/agents/ - Agent definitions
  • ~/.claude/rules/ - Rule files
  • ~/.claude/commands/ - Custom commands
  • ~/.claude/skills/ - Skills
  • ~/.claude/hud/ - HUD config
  • ~/.claude/scripts/ - Helper scripts
  • ~/.zshrc - Shell config
  • ~/.gitconfig - Git config
  • ~/.ssh/config - SSH config (as .ssh_config)
  • Brewfile - Homebrew packages

Supported Hosts

HostExample
GitHub"host": "github.com"
GitLab"host": "gitlab.com"
Self-hosted"host": "git.mycompany.com"

Notes

  • Sync runs automatically on every session end (Stop hook)
  • API keys in .mcp.json are automatically replaced with ${ENV_VAR} references
  • Use /backup-config for manual sync anytime
  • Use /restore-config to restore from backup

Source

git clone https://github.com/OhJuhun/claude-backup-sync/blob/main/skills/backup-setup/SKILL.mdView on GitHub

Overview

This skill provides the initial setup flow for the claude-backup-sync plugin. It guides you through authenticating Git, selecting or creating a backup repository, generating a local backup-config.json, performing a first sync, and verifying the result to ensure Claude settings and related files are safely stored.

How This Skill Works

The setup checks Git authentication via gh auth status and guides login if needed. For GitLab, it directs you to configure git credentials. It then collects the repository, host, and branch, creates ~/.claude/scripts/backup-config.json, runs the first backup-sync, and verifies success by inspecting the backup-sync.log.

When to Use It

  • Setting up backups for Claude after a fresh install
  • Migrating backups to a new repo on GitHub, GitLab, or a self-hosted host
  • Onboarding a new user or workstation for Claude configurations
  • Performing a first-time backup and validation with the backup-sync script
  • Triggering a manual backup using the /backup-config workflow

Quick Start

  1. Step 1: Check Git CLI Authentication with gh auth status and login if needed
  2. Step 2: Provide or create the Backup Repository (repo/host/branch) and create the repo if it doesn't exist
  3. Step 3: Create ~/.claude/scripts/backup-config.json with repo, branch, and host, then run the first sync and verify via logs

Best Practices

  • Verify Git authentication with gh auth status before starting the setup
  • Use a private repository and ensure the host (github.com, gitlab.com, or self-hosted) is correct
  • Create the repository if it doesn't exist (e.g., gh repo create <repo-name> --private) when using GitHub
  • Ensure backup-config.json accurately reflects repo, host, and branch before first sync
  • After setup, review ~/.claude/logs/backup-sync.log to confirm success and remember that API keys in .mcp.json are replaced with ${ENV_VAR} references

Example Use Cases

  • New machine setup: configure a GitHub-backed private repo and perform the first backup
  • Migrating backups to a self-hosted Git server at git.mycompany.com
  • Using GitLab as the backup host and creating a private repository for Claude configs
  • Testing the first sync by running the backup script and tailing backup-sync.log for confirmation
  • Manually triggering a sync later with /backup-config to validate ongoing backups

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers