SuperAPI AI Directory

env-setup

Deployment & operations

View repository

Updated 10-15 10:22

About this skill

One-click environment sync tool for Claude Code & OpenClaw

One-click sync of all configurations from a GitHub repository to the local Claude Code and OpenClaw environments.

Feature Overview

This skill providesone-click syncfunctionality, syncing configurations from a GitHub repository to local:

  • sync_env.py - Sync all configurations to local

Sync Contents

Component Source Target Description
Output Styles config/output-styles/ ~/.claude/output-styles/ Claude Code conversation style
CLAUDE.md config/CLAUDE.md ~/.claude/CLAUDE.md Global prompt
MCP Config config/mcp_config.json ~/.claude.json MCP servers (merged)
Agent Configs agents/ ~/.openclaw/agents/ OpenClaw Agent configuration
MCP Servers mcp/ Integrated into ~/.claude.json MCP server standalone configuration
Plugins plugins/ ~/.openclaw/plugins/ OpenClaw plugin configuration

GitHub Repository Structure

your-claude-env/              (GitHub 仓库)
├── env-setup.skill/          (或任意名称,放在 skills/ 下)
│   ├── SKILL.md
│   ├── scripts/
│   │   ├── sync_env.py       (主同步脚本)
│   │   ├── backup_env.py     (备份脚本,可选)
│   │   └── restore_env.py    (恢复脚本,可选)
│   └── config/               (配置模板目录)
│       ├── output-styles/    (对话风格配置)
│       ├── CLAUDE.md         (全局提示词)
│       └── mcp_config.json   (MCP服务器配置)
├── agents/                   (Agent 配置目录)
│   ├── multimodal-agent/
│   │   ├── AGENT.md
│   │   └── system.md
│   ├── healthcare-monitor/
│   └── ...
├── mcp/                      (MCP 服务器配置)
│   ├── github/
│   │   ├── config.json
│   │   └── README.md
│   ├── lark-mcp/
│   └── ...
└── plugins/                  (插件配置)
    ├── feishu/
    │   └── config.json
    ├── telegram/
    └── ...

Configuration Directory Description

agents/ - Agent configuration

Used to store OpenClaw Agent configurations:

agents/
├── multimodal-agent/
│   ├── AGENT.md           (Agent 描述)
│   └── system.md          (System prompt)
├── healthcare-monitor/
│   ├── AGENT.md
│   └── system.md
└── ...

Sync target: ~/.openclaw/agents/

mcp/ - MCP server configuration

Used to store standalone MCP server configurations:

mcp/
├── github/
│   ├── config.json         (MCP 服务器配置)
│   └── README.md          (使用说明)
├── lark-mcp/
│   └── ...
└── ...

Sync target: Integrated into ~/.claude.json mcpServers

plugins/ - Plugin configuration

Used to store OpenClaw plugin configurations:

plugins/
├── feishu/
│   └── config.json
├── telegram/
│   └── config.json
└── ...

Sync target: ~/.openclaw/plugins/

Usage

1. Initialize a GitHub Repository

Create a repository on the primary device:

# 1. 创建项目目录
mkdir claude-env-sync
cd claude-env-sync

# 2. 复制 env-setup skill
cp -r ~/.claude/skills/env-setup ./

# 3. 复制当前配置到 config/
cp -r ~/.claude/output-styles/* env-setup/config/output-styles/
cp ~/.claude/CLAUDE.md env-setup/config/

# 4. 复制 agents 配置(如果有)
cp -r ~/.openclaw/agents/* env-setup/agents/

# 5. 提取 MCP 配置(如果有独立配置)
mkdir -p env-setup/mcp
# (手动复制 MCP 服务器配置)

# 6. 提取插件配置(如果有)
mkdir -p env-setup/plugins
# (手动复制插件配置)

# 7. 推送到 GitHub
git init
git add .
git commit -m "Initial Claude env config"
git remote add origin https://github.com/yourusername/claude-env-sync.git
git push -u origin main

2. Sync on a New Device

# 1. 克隆仓库到 skills 目录
cd ~/.claude/skills
git clone https://github.com/yourusername/claude-env-sync.git

# 2. 运行同步脚本
python ~/.claude/skills/claude-env-sync/env-setup/scripts/sync_env.py

# 3. 重启 Claude Code / OpenClaw Gateway

3. Command-Line Options

# 基本用法(同步所有配置)
python scripts/sync_env.py

# 强制覆盖已存在的文件
python scripts/sync_env.py --force

# 只同步特定组件
python scripts/sync_env.py --components agents mcp plugins

# 指定配置目录
python scripts/sync_env.py --claude-dir "/path/to/.claude" --openclaw-dir "/path/to/.openclaw"

Sync options:

  • output_styles - Sync conversation style configuration
  • claude_md - Sync global CLAUDE.md
  • mcp_config - Sync MCP server configuration
  • agents - Sync Agent configuration
  • mcp - Sync standalone MCP server configuration
  • plugins - Sync plugin configuration

Configuration File Format

mcp_config.json

{
  "mcpServers": {
    "chrome-devtools": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "chrome-devtools-mcp@latest"]
    },
    "github": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
      }
    }
  }
}

⚠️ Security reminder:

  • Do not commit real API keys or tokens to the repository!
  • Sensitive information should use environment variables or local configuration files (excluded in .gitignore)
  • Use placeholders to mark the key locations that need to be filled in, for example:"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"

Agent Configuration

Each Agent directory contains:

  • AGENT.md - Agent description and capability explanation
  • system.md - System prompt

Plugin Configuration

Each plugin directory contains:

  • config.json or config.yaml - Plugin configuration

Use Cases

Scenario 1: Unified Environment Across Multiple Devices

Keep consistent configurations across multiple computers:

# 主设备:更新配置后
git add .
git commit -m "Update config"
git push

# 其他设备:拉取并同步
git pull
python scripts/sync_env.py

Scenario 2: Team-Shared Configuration

Team members share a unified configuration:

  1. Create a team GitHub repository
  2. Each member clones to ~/.claude/skills/
  3. Regularly run sync_env.py to sync updates

Scenario 3: Quickly Switching Computers

# 新电脑上
git clone https://github.com/yourusername/claude-env-sync.git ~/.claude/skills/
python ~/.claude/skills/claude-env-sync/env-setup/scripts/sync_env.py --force

Scenario 4: Version-Managed Configuration

# 回滚到之前的配置
git log --oneline
git checkout <commit-hash>
python scripts/sync_env.py --force

Workflow

Daily Update Workflow

1. 修改本地配置
   ↓
2. 更新相应目录 (config/, agents/, mcp/, plugins/)
   ↓
3. git add . && git commit -m "Update xxx"
   ↓
4. git push
   ↓
5. 其他设备: git pull && python scripts/sync_env.py

Notes

Configuration Sync Policy

  • MCP configuration: Uses merge mode, will not overwrite existing other MCP servers
  • Agent configuration: Directly copies to the target directory, will overwrite Agents with the same name
  • Plugin configuration: Directly copies to the target directory, will overwrite Plugins with the same name
  • Do not use --force: Skip files that already exist (except MCP configuration, which is always merged)
  • Use --force: Overwrite files that already exist

Restart the application

After synchronization is complete, you need torestartfor it to take effect:

  • Claude Code - Output styles will be reloaded
  • OpenClaw Gateway - Agents/MCP/Plugins will be reloaded

Sensitive information management

  • Do not commit real API keys or tokens
  • Use environment variables or local configuration files
  • Exclude sensitive files in .gitignore
# .gitignore 示例
config/mcp_config.json.local
config/secrets/
*.key
*.token
.env

Cross-platform compatibility

  • The script automatically handles Windows/macOS/Linux path differences
  • Configuration files use UTF-8 encoding

Advanced usage

Branch management

# 创建设备特定配置分支
git checkout -b my-custom-config

# 切换回主配置
git checkout main

Partial synchronization

# 只同步 agents 和 plugins,不改变其他配置
python scripts/sync_env.py --components agents plugins

# 只同步 MCP,不改变其他配置
python scripts/sync_env.py --components mcp

Automated synchronization (optional)

Create a scheduled synchronization script:

# sync.sh
#!/bin/bash
cd ~/.claude/skills/claude-env-sync
git pull
python env-setup/scripts/sync_env.py

Add to cron or Task Scheduler to run periodically.

Troubleshooting

Synchronization failed

Problem: "config/agents not found"

  • Solution: Confirm the repository structure is correct

Problem: ".claude.json not found"

  • Solution: Confirm that Claude Code/OpenClaw is installed and has been run once

Problem: Agent configuration did not take effect

  • Solution: Check whether the configuration format is correct, and restart OpenClaw Gateway

Git-related

Problem: Push failed

  • Solution: Check GitHub repository permissions and network connection

Key security issues

Problem: Accidentally committed a key

  • Solution: Use git filter-branch or git filter-repo to remove it from history
# 从历史中删除包含密钥的文件
git filter-branch --force --tree-filter 'git rm -f filename' -- --all

# 强制推送
git push origin --force --all