cdn-replace

cdn-replace is a skill for Claude Code, Codex from guyulong/cn-agent-skills. It costs 28 tokens per session (741 once invoked), scanned A, original, MIT.

A guide for replacing references to overseas content-delivery networks, such as Google Fonts or JavaScript library CDNs, with sources that are accessible in China.

In plain words
What is it for?
Use it to identify CDN references in HTML, CSS, and JavaScript and plan replacements, self-hosting, private package sources, or locally bundled files.
Why use it?
It helps address resources that users in China cannot reach, while calling attention to version matching, security, licenses, and integrity checks.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/guyulong/cn-agent-skills/cdn-replace
Any agent
npx skills add guyulong/cn-agent-skills --skill cdn-replace
Clone the repo
git clone --depth 1 https://github.com/guyulong/cn-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cdn-replace

README.md
[![agentmods](https://agentmods.dev/badge/skills/guyulong/cn-agent-skills/cdn-replace.svg)](https://agentmods.dev/skills/guyulong/cn-agent-skills/cdn-replace)
Your own site
<a href="https://agentmods.dev/skills/guyulong/cn-agent-skills/cdn-replace"><img src="https://agentmods.dev/badge/skills/guyulong/cn-agent-skills/cdn-replace.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 741 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00028 $0.00741
Opus 5 $0.00014 $0.00370
Sonnet 5 $0.00006 $0.00148
Haiku 4.5 $0.00003 $0.00074

Measured 5d ago against content hash a4ebedf27f3b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cdn-replace scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cdn-replace/SKILL.md · 83 lines

What it actually says

国内 CDN 资源替换

使用场景

项目引用了 Google Fonts、Google CDN 等国内无法访问的资源时,替换为国内可用源。

重要提醒

替换 CDN 不是简单的字符串替换。 需要注意:

  1. 版本一致性:替换源的库版本必须与原版本一致,否则可能出现兼容性问题
  2. SRI 校验:如原链接有 integrity 属性,替换后必须更新 SRI hash
  3. 许可证:确认替换源分发的文件未违反原库许可证
  4. 可用性:第三方 CDN 随时可能下线或变更,需有备选方案
  5. 安全性:验证替换源未篡改文件内容

常见替换参考

以下地址仅供参考,使用前请验证版本号和可用性。

字体

原始 替换候选
fonts.googleapis.com fonts.loli.net / fonts.font.im

JavaScript 库

原始 替换候选
ajax.googleapis.com cdn.bootcdn.net / cdn.staticfile.net
cdn.jsdelivr.net cdn.bootcdn.net / cdn.staticfile.net
cdnjs.cloudflare.com cdn.bootcdn.net
unpkg.com cdn.bootcdn.net

示例

/* 替换前 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC');

/* 替换后 — 确认版本一致 */
@import url('https://fonts.loli.net/css2?family=Noto+Sans+SC');

替换后务必确认版本号、子集参数等完全一致。

自动替换脚本

# 查找项目中所有引用
grep -r "googleapis\|jsdelivr\|cloudflare\|unpkg" --include="*.html" --include="*.css" --include="*.js" .

更好的方案

方案 A:自建 npm 私有源

使用 Verdaccio 等工具搭建私有 npm registry,完全控制包的来源和版本。

方案 B:自建 CDN / 静态资源服务

将依赖的库文件下载到自己的服务器或对象存储(阿里云 OSS、腾讯云 COS 等),配合 CDN 使用。

方案 C:本地打包

通过 Webpack/Vite 等工具将依赖打包到项目中,不依赖外部 CDN。这是最可靠的方案。

注意事项

  • 替换后必须测试功能是否正常
  • 保持版本号锁定,不要依赖 CDN 的 latest 路径
  • 生产项目优先使用本地打包或自建服务
  • SRI(Subresource Integrity)能防止 CDN 篡改,建议开启
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 83 lines · 28 tokens per session scan A a4ebedf27f3b

Subscribe to this mod's changes

cdn-replace is a skill published in the GitHub repository guyulong/cn-agent-skills (2 stars, last pushed 2mo ago), licensed MIT. It adds 28 tokens to every session and 741 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.