← 返回 Skills 市场
loredunk

china-mirror-skills

作者 gavinC · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
270
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install china-mirror-skills
功能描述
Main entry point for configuring and diagnosing all development tools in China's network environment. Detects installed tools (pip/uv/poetry, npm/yarn/pnpm,...
使用说明 (SKILL.md)

Bootstrap China Network Environment

One-stop configuration and diagnostics for all development tools in China. Diagnose first, then apply fixes.

All setup scripts are bundled under this skill's scripts/ directory as resources — they are not loaded into context but invoked via bash.

Steps

1. Determine SKILL_DIR

All script paths are relative to this skill's directory:

SKILL_DIR="\x3Cabsolute path to skills/bootstrap-china-network>"

Use the directory where this SKILL.md resides.

2. Diagnose (if user wants diagnostics or troubleshooting)

If the user wants to diagnose their environment, check what's configured, or understand why things are slow:

bash "$SKILL_DIR/scripts/diagnose.sh"

This will:

  • Collect system info and detect proxy conflicts
  • Scan installed development tools and their mirror configurations
  • Test connectivity to official sources and Chinese mirrors (with timing)
  • Output structured recommendations (HIGH/MEDIUM/LOW priority)

After diagnostics, review the recommendations and offer to apply fixes for unconfigured tools.

3. Quick environment scan (for direct configuration)

# Detect installed tools
for tool in pip uv npm yarn pnpm docker cargo go conda flutter brew; do
  which $tool 2>/dev/null && echo "✓ $tool" || true
done

# Check proxy conflicts
[[ -n "$HTTP_PROXY$HTTPS_PROXY$http_proxy$https_proxy" ]] && echo "⚠️ Proxy detected"

4. Check for proxy conflicts

If HTTP_PROXY or HTTPS_PROXY is set, warn the user:

Proxy environment variables are set. In China, using a VPN/proxy alongside mirrors can cause conflicts. Consider: unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY

5. Apply mirror configurations

For each detected tool, run the corresponding script. Ask the user for preferences or use sensible defaults:

Tool Script (relative to SKILL_DIR) Default Mirror
pip/uv/poetry scripts/python/setup.sh tuna
npm/yarn/pnpm scripts/node/setup.sh npmmirror
APT (Ubuntu/Debian) sudo scripts/apt/setup.sh tuna
Docker CE + Hub sudo scripts/docker/setup.sh tuna
Homebrew scripts/homebrew/setup.sh tuna
Conda/Anaconda scripts/conda/setup.sh tuna
Cargo/Rust scripts/rust/setup.sh ustc
Go modules scripts/go/setup.sh goproxy
Flutter/Dart scripts/flutter/setup.sh tuna
GitHub Releases/Clone scripts/github/setup.sh tuna (支持 --proxy-clone 全局加速 clone)

All scripts support these flags:

  • -m / --mirror \x3Cname> — choose mirror source
  • -f / --force — force overwrite
  • -d / --dry-run — preview changes without applying
  • -y / --yes — skip confirmation prompts

Run scripts for detected tools. Each script is idempotent — safe to run multiple times.

Example:

bash "$SKILL_DIR/scripts/python/setup.sh" --mirror tuna
bash "$SKILL_DIR/scripts/node/setup.sh" --mirror npmmirror
sudo bash "$SKILL_DIR/scripts/apt/setup.sh" --mirror tuna

6. Verify configurations

After applying, run a quick verification for each configured tool:

pip config get global.index-url 2>/dev/null
npm config get registry 2>/dev/null
go env GOPROXY 2>/dev/null
cat ~/.cargo/config.toml 2>/dev/null | grep index

7. Provide summary

Report:

  • What was configured (tool -> mirror URL)
  • Any warnings (proxy conflicts, permission issues, tool not found)
  • How to restore: bash "$SKILL_DIR/scripts/restore_config.sh" --tool \x3Cname> --latest

Dry Run

If the user wants to preview changes first, add --dry-run to each script:

bash "$SKILL_DIR/scripts/python/setup.sh" --dry-run
bash "$SKILL_DIR/scripts/node/setup.sh" --dry-run

Backup & Restore

Backups are stored in ~/.china-mirror-backup/.

# Backup all tool configs
bash "$SKILL_DIR/scripts/backup_config.sh" --all

# Backup specific tool
bash "$SKILL_DIR/scripts/backup_config.sh" --tool pip

# Restore latest backup for a tool
bash "$SKILL_DIR/scripts/restore_config.sh" --tool pip --latest

# List all backups
bash "$SKILL_DIR/scripts/restore_config.sh" --list
安全使用建议
This skill appears to do what it says: detect tools, run diagnostics, and change mirror settings. Before running it, review the scripts and run in dry-run mode where available. Expect the following: (1) Some scripts need sudo and will modify system files (/etc/apt, /etc/docker, /etc/yum.repos.d, shell profiles) — only proceed if you trust the changes. (2) The tool will create backups under ~/.china-mirror-backup; verify those backups before restoring. (3) Diagnostics perform outbound network tests (pypi, npm registry, goproxy, USTC, and an optional IP lookup endpoint), which may expose your IP/timing data to those services. (4) Use --dry-run and inspect generated config snippets, and avoid piping remote install scripts into sh unless you trust the source. If you want greater assurance, run each setup script manually rather than allowing an automated agent to execute them with sudo.
功能分析
Type: OpenClaw Skill Name: china-mirror-skills Version: 1.0.0 The skill bundle is a comprehensive and well-structured utility designed to configure Chinese mirrors for a wide range of development tools (Python, Node.js, Docker, APT, Rust, Go, etc.). It includes a diagnostic script (diagnose.sh) to audit the environment, a dedicated backup and restore system (backup_config.sh, restore_config.sh) to protect user configurations, and utility functions in common.sh. While the scripts perform high-privilege actions such as modifying system-level configuration files and shell profiles, these operations are transparently documented, include dry-run options, and are strictly aligned with the stated purpose of improving network performance for developers in China. No evidence of malicious intent, data exfiltration, or unauthorized persistence was found.
能力评估
Purpose & Capability
Name/description ask to detect installed dev tools and apply mirror configs; included scripts enumerate and configure pip/uv/poetry, npm/node, apt, docker, go, conda, cargo, rust, homebrew, flutter, GitHub, etc. Requested actions (backups, config writes, apt/yum changes, shell-profile edits) align with this purpose and are not extraneous.
Instruction Scope
SKILL.md instructs invoking bundled bash scripts to diagnose and apply mirror settings. The scripts perform system scans, read/write user and system config files, run network connectivity tests against official and mirror endpoints, and may suggest unsetting proxy variables. This is within scope, but the diagnostic actions include outbound network calls (curl/wget) to public endpoints for timing/IP info.
Install Mechanism
This is an instruction-only skill (no install spec). Scripts are bundled in the resource directory and invoked locally; there are no remote package installs by the skill itself. Some scripts will download GPG keys or call apt/yum/curl during execution, which is expected for configuring package repos.
Credentials
The skill requires no environment credentials or special env variables. It does inspect proxy-related environment variables (HTTP_PROXY, HTTPS_PROXY, etc.) and will append to shell profiles and create backups in ~/.china-mirror-backup. System-level changes (e.g., /etc/apt, /etc/docker) require sudo/root; this is proportional to the stated functionality but important to note for privileges and privacy (network checks contact external services, and some suggestions print curl | sh commands).
Persistence & Privilege
Skill is not forced-always and allows user invocation/autonomous invocation by default (platform normal). The scripts modify user shell profiles and system package config files and write backups under the user's home; some operations need sudo. The skill does not attempt to modify other skills or global agent configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install china-mirror-skills
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /china-mirror-skills 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
用于解决中国内网络,需要外网环境下fetch/pull/install/update等问题。
元数据
Slug china-mirror-skills
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

china-mirror-skills 是什么?

Main entry point for configuring and diagnosing all development tools in China's network environment. Detects installed tools (pip/uv/poetry, npm/yarn/pnpm,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 270 次。

如何安装 china-mirror-skills?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install china-mirror-skills」即可一键安装,无需额外配置。

china-mirror-skills 是免费的吗?

是的,china-mirror-skills 完全免费(开源免费),可自由下载、安装和使用。

china-mirror-skills 支持哪些平台?

china-mirror-skills 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 china-mirror-skills?

由 gavinC(@loredunk)开发并维护,当前版本 v1.0.0。

💬 留言讨论