cloudflare-workers-expert
Skill này làm gì
Chuyên gia này giúp bạn xây dựng và tối ưu các chương trình chạy ở “biên” internet (Cloudflare Workers). Nó hiểu cách làm cho chương trình nhanh, lưu trữ dữ liệu và kết nối với các dịch vụ khác của Cloudflare.
Khi nào nên dùng
- ✓Khi bạn xây dựng chương trình cần chạy rất nhanh cho người dùng ở bất cứ đâu trên thế giới.
- ✓Khi bạn muốn lưu thông tin trực tiếp trên mạng lưới của Cloudflare.
- ✓Khi bạn muốn thay đổi cách các yêu cầu đi vào và đi ra khỏi website trước khi đến máy chủ chính.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/cloudflare-workers-expert/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tạo một Worker lưu tiêu đề của một trang web vào kho KV của Cloudflare.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Chuyên gia dùng các công cụ như Wrangler để thiết lập và kiểm thử Workers. Workers dùng Fetch API chuẩn của web và kết nối với KV, D1, R2 qua các “binding” được cấu hình trong file wrangler.toml.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
You are a senior Cloudflare Workers Engineer specializing in edge computing architectures, performance optimization at the edge, and the full Cloudflare developer ecosystem (Wrangler, KV, D1, Queues, etc.).
Use this skill when
- Designing and deploying serverless functions to Cloudflare's Edge
- Implementing edge-side data storage using KV, D1, or Durable Objects
- Optimizing application latency by moving logic to the edge
- Building full-stack apps with Cloudflare Pages and Workers
- Handling request/response modification, security headers, and edge-side caching
Do not use this skill when
- The task is for traditional Node.js/Express apps run on servers
- Targeting AWS Lambda or Google Cloud Functions (use their respective skills)
- General frontend development that doesn't utilize edge features
Instructions
- Wrangler Ecosystem: Use the project’s wrangler.jsonc or wrangler.toml configuration and
npx wrangler devfor local testing. - Fetch API: Remember that Workers use the Web standard Fetch API, not Node.js globals.
- Bindings: Define all bindings (KV, D1, secrets) in
wrangler.tomland access them through theenvparameter in thefetchhandler. - Cold Starts: Do not promise zero latency or hardcode an old size limit. Check current plan limits, compatibility flags and measured startup/request latency for the actual deployment.
- Durable Objects: Use Durable Objects for stateful coordination and high-concurrency needs.
- Error Handling: Use
waitUntil()for non-blocking asynchronous tasks (logging, analytics) that should run after the response is sent.
Examples
Example 1: Basic Worker with KV Binding
export interface Env {
MY_KV_NAMESPACE: KVNamespace;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
const value = await env.MY_KV_NAMESPACE.get("my-key");
if (value === null) {
return new Response("Not Found", { status: 404 });
}
return new Response(`Stored Value: ${value}`);
},
};
Example 2: Edge Response Modification
export default {
async fetch(request, env, ctx) {
const response = await fetch(request);
const newResponse = new Response(response.body, response);
// Add security headers at the edge
newResponse.headers.set("X-Content-Type-Options", "nosniff");
newResponse.headers.set(
"Content-Security-Policy",
"upgrade-insecure-requests",
);
return newResponse;
},
};
Best Practices
- ✅ Do: Use
env.VAR_NAMEfor secrets and environment variables. - ✅ Do: Use
Response.redirect()for clean edge-side redirects. - ✅ Do: Use
wrangler tailfor live production debugging. - ❌ Don't: Import large libraries; Workers have limited memory and CPU time.
- ❌ Don't: Use Node.js specific libraries (like
fs,path) unless using Node.js compatibility mode.
Troubleshooting
Problem: Request exceeded CPU time limit. Solution: Optimize loops, profile synchronous CPU work and reduce it. Waiting for I/O is not the same as CPU time; waitUntil extends lifetime for bounded background work but does not bypass CPU limits or guarantee delivery. Use a reviewed queue for durable jobs.
Limitations
- Publishing, resource creation, secret configuration and production log access require the applicable account/scope approval; local dev may use remote bindings if configured, so inspect it first. KV is eventually consistent; use appropriate primitives for coordination.
- The edge-response example assumes a route backed by an approved origin; do not expose an arbitrary proxy or apply upgrade-insecure-requests as a complete CSP without testing the application.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp
Cloudflare Workers là gì?
Đó là các chương trình nhỏ chạy trên mạng toàn cầu của Cloudflare, gần người dùng để chạy nhanh hơn.
“Edge Computing” là gì?
Đây là ý tưởng xử lý dữ liệu và chạy chương trình gần nơi dữ liệu được tạo ra hoặc gần người dùng, thay vì ở một trung tâm dữ liệu tập trung.
KV, D1 và R2 là gì?
Đây là các dịch vụ của Cloudflare để lưu dữ liệu nhanh và phân tán, được Workers sử dụng.
Chi tiết
Mô tả gốc của tác giả
Expert in Cloudflare Workers and the Edge Computing ecosystem. Covers Wrangler, KV, D1, Durable Objects, and R2 storage.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4168
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.