david-li0406/meta-skill-evloving/cloudflare-workers-development

Claude Code and agent skill by david-li0406/meta-skill-evloving

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Comprehensive Cloudflare Workers development guidance for building serverless functions with TypeScript, Hono, and Workers Runtime API

Install

npx vskill@latest install david-li0406/meta-skill-evloving/cloudflare-workers-development

SKILL.md

The same SKILL.md was published earlier as david-li0406/meta-skill-evloving/cloudflare-workers-development.

What I Cover

  • Setting up Cloudflare Workers with TypeScript and Wrangler configuration
  • Building REST APIs using Hono framework with middleware (CORS, authentication)
  • Creating OpenAPI-documented endpoints with chanfana and Zod validation
  • Managing environment variables and runtime bindings
  • Implementing authentication patterns (JWT tokens, OTP login)
  • Integrating with external APIs (client factories, error handling)
  • Deploying Workers with Wrangler CLI and observability features

Common Patterns

Hono App Setup with Middleware
typescript
const app = new Hono<{ Bindings: Env }>();
app.use("*", cors({
origin: ["http://localhost:5173", "https://tobbe3108.github.io"],
allowMethods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
allowHeaders: ["Content-Type", "Authorization"],
credentials: true,
}));
Global Authentication Middleware
typescript
app.use("/api/*", async (c, next) => {
const path = c.req.path;
if (path === "/api/login" || path === "/api/menu") {
await next();
return;
}
const token = c.req.header("Authorization");
if (!token?.startsWith("Bearer")) {
return c.text("Missing or invalid Authorization header", 401);
}
await next();
});
Chanfana OpenAPI Route Classes
typescript
export class Login extends OpenAPIRoute {
schema = {
tags: ["Auth"],
summary: "Login with one-time password (OTP)",
request: {
body: contentJson(z.object({
otp: z.string().describe("One-time password (OTP) received via email"),
})),
},
responses: {
"200": contentJson(z.object({
token: Str({ example: "eyJhbGciOi..." }).describe("JWT authentication token"),
})),
},
};
async handle(c: AppContext) {
const data = await this.getValidatedData<typeof this.schema>();
const client = createGoPayClient(c);
const response = await client.login(data.body.otp);
return { token: response.authentication.token };
}
}
Client Factory Pattern
typescript
export const createGoPayClient = (context: AppContext): GoPayClient => {
const apiUrl = context.env.GOPAY_API_URL;
const token = context.req.header("Authorization")?.replace("Bearer", "").trim();
if (context.env.USE_LOCAL_MOCK_CLIENTS === true) {
return new GoPayClientMock(apiUrl, token);
}
return new GoPayClient(apiUrl, token);
};

Best Practices

  • Type Safety: Use TypeScript interfaces for request/response types and environment bindings
  • Security: Implement proper CORS policies and validate all inputs with Zod schemas
  • Authentication: Use Bearer token authentication for protected routes, exclude public endpoints
  • Configuration: Store API URLs and feature flags in environment variables via wrangler.jsonc
  • API Documentation: Define comprehensive OpenAPI schemas with examples and error responses
  • Error Handling: Return appropriate HTTP status codes and structured error responses
  • Testing: Use mock clients during development to avoid external API dependencies
  • Performance: Set appropriate cache headers and use observability for monitoring
  • Deployment: Use Wrangler for local development and production deployment with compatibility dates

Related Skills

  • sveltekit-development: For frontend integration with Workers APIs
  • frontend-developer: For building client applications that consume Worker endpoints
  • deployment-specialist: For advanced deployment strategies and CI/CD with Cloudflare
  • backend-developer: For general API design and server-side development patterns</content>

<parameter name="filePath">D:\Git\GoPayShortcuts\.opencode\skill\cloudflare-workers-development\SKILL.md

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/david-li0406/meta-skill-evloving/cloudflare-workers-development/badge)](https://verified-skill.com/skills/david-li0406/meta-skill-evloving/cloudflare-workers-development)

Something wrong with this skill or its page? Tell us.