用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ffsshhttiikk/opencode-agents-skills --skill cdn命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | cdn |
| description | Content delivery network optimization |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"developer, devops-engineer","category":"devops"} |
# Nginx CDN configuration
location /static/ {
# Cache for 1 year for versioned assets
expires 1y;
add_header Cache-Control "public, immutable";
# Enable CDN caching
proxy_cache_valid 200 60m;
proxy_cache_use_stale error timeout http_500;
# Set cache key
proxy_cache_key "$scheme$request_method$host$request_uri";
}
location /api/ {
# Don't cache API responses by default
proxy_cache_bypass $http_cache_control;
add_header Cache-Control "no-store";
}
| Provider | Strengths | Use Cases |
|---|---|---|
| CloudFlare | DDoS protection, Workers | Security-focused, edge compute |
| AWS CloudFront | AWS integration, Lambda@Edge | AWS ecosystems |
| Fastly | Real-time purging, VCL | Custom caching, streaming |
| Akamai | Global reach, enterprise | Large-scale, video |
| Google Cloud CDN | GCP integration | GCP ecosystems |
# CloudFront invalidation
aws cloudfront create-invalidation \
--distribution-id $DIST_ID \
--paths "/static/*" "/images/*"
# CloudFlare purge
curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE/purge_cache" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
--data '{"purge_everything": true}'
// Cloudflare Worker example
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
// A/B testing at the edge
const variant = Math.random() < 0.5 ? 'a' : 'b'
const response = await fetch(request)
// Add variant header
const newResponse = new Response(response.body, response)
newResponse.headers.set('X-Variant', variant)
return newResponse
}