Mirror optimizer

From huangwb8/skills · View interactive version

Mirror optimizer is an AI agent skill from the GitHub repository huangwb8/skills. 当用户明确要求优化镜像源、配置国内镜像、加速部署或切换依赖源时使用。分析项目技术栈并生成适配的镜像配置。⚠️ 不适用:用户只是询问镜像源概念、无需部署加速,或明确要求使用官方源。

How to use this skill

Skill file

Mirror Optimizer - 镜像源优化代理

铁律

NO DEPLOYMENT WITHOUT MIRROR CONFIGURATION FIRST

任何涉及依赖下载的部署任务,必须先确认并优化镜像源配置,否则在国内环境下部署将极慢或失败。

核心理念

智能适配,透明可逆。根据项目技术栈自动识别需要配置的镜像源类型,生成标准化的配置文件,同时保持官方源兼容性,支持一键切换。

何时使用

输入

输出

支持的镜像源类型

| 类型 | 检测文件 | 配置输出 | 国内镜像源 |

|------|----------|----------|-----------|

| Docker | Dockerfile, docker-compose.yml, .dockerignore | Dockerfile.mirror | 阿里云、腾讯云 |

| Python/pip | requirements.txt, pyproject.toml | pip.conf | 清华、阿里云、中科大 |

| Node.js/npm | package.json, package-lock.json | .npmrc | 淘宝、腾讯云 |

| Node.js/yarn | yarn.lock | .yarnrc.yml | 淘宝、腾讯云 |

| Go Modules | go.mod, go.sum | go.env | 阿里云、腾讯云 |

| Java/Maven | pom.xml | settings.xml | 阿里云、腾讯云 |

| Java/Gradle | build.gradle*, settings.gradle* | init.gradle | 阿里云、腾讯云 |

| Ruby/Bundler | Gemfile, gems.rb | config | 淘宝、腾讯云 |

| Rust/Cargo | Cargo.toml | config.toml | 清华、中科大 |

工作流

  1. 项目扫描
  1. 智能分析
  1. 配置生成
  1. 文档输出
  1. 验证检查

配置文件结构

输出目录以 config.yaml:mirror_optimization.output_dir 为准,以下以默认 .bensz-api/task-{yyyymmdd-hhmm}-{简短描述}/mirror-optimizer/output/ 为例。

.bensz-api/task-{yyyymmdd-hhmm}-{简短描述}/mirror-optimizer/output/
├── docker/
│   ├── Dockerfile.mirror        # 优化的 Dockerfile
├── python/
│   └── pip.conf                 # pip 配置
├── nodejs/
│   ├── .npmrc                   # npm 配置
│   └── .yarnrc.yml              # yarn 配置
├── golang/
│   └── go.env                   # Go Modules 配置
├── java/
│   ├── maven/
│   │   └── settings.xml          # Maven 配置
│   └── gradle/
│       └── init.gradle           # Gradle 配置
└── MIRROR_OPTIMIZATION_REPORT.md

质量门槛

国内镜像源推荐

| 类型 | 推荐源 | URL |

|------|--------|-----|

| Docker | 阿里云 | https://registry.cn-hangzhou.aliyuncs.com |

| Docker | 腾讯云 | https://mirror.ccs.tencentyun.com |

| Python | 清华 | https://pypi.tuna.tsinghua.edu.cn/simple |

| Python | 阿里云 | https://mirrors.aliyun.com/pypi/simple/ |

| Node.js | 淘宝 | https://registry.npmmirror.com |

| Go | 阿里云 | https://mirrors.aliyun.com/goproxy/ |

| Go | 腾讯云 | https://mirrors.tencent.com/go/ |

| Java/Maven | 阿里云 | https://maven.aliyun.com/repository/public |

| Ruby | 淘宝 | https://gems.ruby-china.com |

| Rust | 清华 | https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git |

安全注意事项

相关参考

约束

<!-- BEGIN COMMON CONSTRAINTS -->

<!-- Source-Hash: sha256:15120201e9e0c7569517261d57ecefb63ac279c26ed13876f8e95b6dc35854d3 -->

<!-- Template-ID: skill-common-constraints; Template-Version: 1; Sync-Policy: exact-block -->

公共硬约束

本块由 docs/templates/skill-common-constraints.md 统一维护;每个 SKILL.md 的 ## 约束 必须逐字同步本块,不得在副本中改写公共规则。

<!-- End of canonical common constraints. -->

<!-- END COMMON CONSTRAINTS -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.