Cloudflare Zero Trust Access authentication for Workers. Use for JWT validation, service tokens, CORS, or encountering preflight blocking, cache race conditions, missing JWT headers.
npx skills add https://github.com/secondsky/claude-skills --skill cloudflare-zero-trust-access
Integrate Cloudflare Zero Trust Access authentication with Cloudflare Workers applications using proven patterns and templates.
This skill provides complete integration patterns for Cloudflare Access, enabling application-level authentication for Workers without managing your own auth infrastructure.
What is Cloudflare Access?
Cloudflare Access is Zero Trust authentication that sits in front of your application, validating users before they reach your Worker. After authentication, Access issues JWT tokens that your Worker validates.
Key Benefits:
Trigger this skill when tasks involve:
Keywords to Trigger:
cloudflare access, zero trust, access authentication, JWT validation, service tokens, cloudflare auth, hono access, workers authentication, protect worker routes, admin authentication
📖 New to Cloudflare Access? Load references/quick-start.md for step-by-step setup instructions (15-20 minutes).
Use @hono/cloudflare-access for one-line Access integration.
When to Use:
Template: templates/hono-basic-setup.ts
Setup:
import { Hono } from 'hono'
import { cloudflareAccess } from '@hono/cloudflare-access'
const app = new Hono<{ Bindings: Env }>()
// Public routes
app.get('/', (c) => c.text('Public page'))
// Protected routes
app.use(
'/admin/*',
cloudflareAccess({
domain: (c) => c.env.ACCESS_TEAM_DOMAIN,
})
)
app.get('/admin/dashboard', (c) => {
const { email } = c.get('accessPayload')
return c.text(`Welcome, ${email}!`)
})
Configuration (wrangler.jsonc):
{
"vars": {
"ACCESS_TEAM_DOMAIN": "your-team.cloudflareaccess.com",
"ACCESS_AUD": "your-app-aud-tag"
}
}
Benefits:
When to Use: Not using Hono, need custom validation logic
Template: templates/jwt-validation-manual.ts (~100 lines, uses Web Crypto API)
When to Use: CI/CD pipelines, backend services, cron jobs (no interactive login)
Client: Send CF-Access-Client-Id + CF-Access-Client-Secret headers
Server: Same middleware handles both - detect via !payload.email && payload.common_name
📄 Full guide: references/service-tokens-guide.md
When to Use: SPA (React/Vue/Angular) calling protected API
⚠️ CRITICAL: CORS middleware MUST come BEFORE Access middleware!
// ✅ CORRECT ORDER
app.use('*', cors({ origin: 'https://app.example.com', credentials: true }))
app.use('/api/*', cloudflareAccess({ domain: (c) => c.env.ACCESS_TEAM_DOMAIN }))
Why: OPTIONS preflight has no auth headers → Access blocks with 401
📄 Full pattern: templates/cors-access.ts
When to Use: SaaS with per-org authentication, white-label apps
Architecture: Tenant config in D1/KV → Dynamic middleware per request
📄 Full pattern: templates/multi-tenant.ts and references/use-cases.md
This skill prevents 8 documented errors. Full details: references/common-errors.md
Problem: OPTIONS requests return 401, breaking CORS
Solution: CORS middleware BEFORE Access middleware
// ✅ Correct
app.use('*', cors())
app.use('/api/*', cloudflareAccess({ domain: '...' }))
Problem: Request not going through Access, no JWT header
Solution: Access Worker through Access URL, not direct *.workers.dev
✅ https://team.cloudflareaccess.com/...
❌ https://worker.workers.dev
Problem: Hardcoded or wrong team name causes "Invalid issuer"
Solution: Use environment variables
// ✅ Correct
cloudflareAccess({ domain: (c) => c.env.ACCESS_TEAM_DOMAIN })
// ❌ Wrong
cloudflareAccess({ domain: 'my-team.cloudflareaccess.com' })
| # | Error | Solution |
|---|-------|----------|
| 4 | Key cache race | Use @hono/cloudflare-access (auto-caches) |
| 5 | Wrong service token headers | Use CF-Access-Client-Id/Secret (not Authorization) |
| 6 | Token expiration (401 after 1 hr) | Handle gracefully, redirect to login |
| 7 | Overlapping policies | Use most specific paths |
| 8 | Dev/prod mismatch | Use environment-specific configs |
📄 Full error details: references/common-errors.md (~2.5 hours saved per implementation)
| Template | Purpose |
|----------|---------|
| hono-basic-setup.ts | Standard Hono + Access integration |
| jwt-validation-manual.ts | Manual JWT verification with Web Crypto |
| service-token-auth.ts | Service token patterns |
| cors-access.ts | CORS + Access (correct ordering) |
| multi-tenant.ts | Multi-tenant architecture |
| wrangler.jsonc | Complete Wrangler configuration |
| .env.example | Environment variable template |
| types.ts | TypeScript definitions |
| Script | Usage |
|--------|-------|
| test-access-jwt.sh | ./test-access-jwt.sh <jwt-token> - Decode and validate JWT |
| create-service-token.sh | ./create-service-token.sh [name] - Service token setup guide |
| Use Case | Template | Key Point |
|----------|----------|-----------|
| Admin Dashboard | hono-basic-setup.ts | Email domain policy |
| API Authentication | hono-basic-setup.ts | Mixed user/service policy |
| SPA + API | cors-access.ts | CORS before Access! |
| CI/CD Pipeline | service-token-auth.ts | Service token in secrets |
| Multi-Tenant SaaS | multi-tenant.ts | D1 tenant config |
📄 Detailed use cases: references/use-cases.md
| Reference File | Load When... |
|----------------|--------------|
| references/quick-start.md | Step-by-step setup for new users, first-time integration |
| references/common-errors.md | Debugging auth issues, prevention patterns (includes all 8 errors) |
| references/jwt-payload-structure.md | Accessing JWT claims, user vs service token |
| references/service-tokens-guide.md | Setting up machine-to-machine auth |
| references/access-policy-setup.md | Dashboard configuration, policy creation |
| references/use-cases.md | Detailed implementation for specific scenarios |
| references/value-proposition.md | Token efficiency metrics, workflow guidance, production validation |
| Package | Version |
|---------|---------|
| @hono/cloudflare-access | 0.3.1 |
| hono | 4.10.7 |
| @cloudflare/workers-types | 4.20251126.0 |
Verified: 2025-12-14 | Token Savings: ~58% | Production Tested: ✅
This skill is for Cloudflare Workers with Cloudflare Access. Do not use for:
@cloudflare/pages-plugin-cloudflare-access instead)For those, use appropriate skills or libraries.
Cloudflare Documentation:
Packages:
Dashboard:
Skill Version: 1.0.0
Last Updated: 2025-10-28
Errors Prevented: 8
Token Savings: 58%
Time Savings: 2.5 hours
Production Tested: ✅
Assess Kubernetes workloads and cluster configuration for AKS Automatic compatibility. Identifies incompatibilities, generates fixes, and guides migration from AKS Standard to AKS Automatic. WHEN: migrate to AKS Automatic, check AKS Automatic readiness, validate manifests for Automatic, assess cluster for Automatic compatibility, fix deployment for Automatic compatibility, identify AKS Automatic migration blockers, is my cluster ready for AKS Automatic.
Discovers available Azure OpenAI model capacity across regions and projects. Analyzes quota limits, compares availability, and recommends optimal deployment locations based on capacity requirements. USE FOR: find capacity, check quota, where can I deploy, capacity discovery, best region for capacity, multi-project capacity search, quota analysis, model availability, region comparison, check TPM availability. DO NOT USE FOR: actual deployment (hand off to preset or customize after discovery), quota increase requests (direct user to Azure Portal), listing existing deployments.
Interactive guided deployment flow for Azure OpenAI models with full customization control. Step-by-step selection of model version, SKU (GlobalStandard/Standard/ProvisionedManaged), capacity, RAI policy (content filter), and advanced options (dynamic quota, priority processing, spillover). USE FOR: custom deployment, customize model deployment, choose version, select SKU, set capacity, configure content filter, RAI policy, deployment options, detailed deployment, advanced deployment, PTU deployment, provisioned throughput. DO NOT USE FOR: quick deployment to optimal region (use preset).
Unified Azure OpenAI model deployment skill with intelligent intent-based routing. Handles quick preset deployments, fully customized deployments (version/SKU/capacity/RAI policy), and capacity discovery across regions and projects. USE FOR: deploy model, deploy gpt, create deployment, model deployment, deploy openai model, set up model, provision model, find capacity, check model availability, where can I deploy, best region for model, capacity analysis. DO NOT USE FOR: listing existing deployments (use foundry_models_deployments_list MCP tool), deleting deployments, agent creation (use agent/create), project creation (use project/create).
Intelligently deploys Azure OpenAI models to optimal regions by analyzing capacity across all available regions. Automatically checks current region first and shows alternatives if needed. USE FOR: quick deployment, optimal region, best region, automatic region selection, fast setup, multi-region capacity check, high availability deployment, deploy to best location. DO NOT USE FOR: custom SKU selection (use customize), specific version selection (use customize), custom capacity configuration (use customize), PTU deployments (use customize).
This skill should be used when working with LaminDB, an open-source data framework for biology that makes data queryable, traceable, reproducible, and FAIR. Use when managing biological datasets (scRNA-seq, spatial, flow cytometry, etc.), tracking computational workflows, curating and validating data with biological ontologies, building data lakehouses, or ensuring data lineage and reproducibility in biological research. Covers data management, annotation, ontologies (genes, cell types, diseases, tissues), schema validation, integrations with workflow managers (Nextflow, Snakemake) and MLOps platforms (W&B, MLflow), and deployment strategies.
Latch platform for bioinformatics workflows. Build pipelines with Latch SDK, @workflow/@task decorators, deploy serverless workflows, LatchFile/LatchDir, Nextflow/Snakemake integration.
Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.
Take secondsky/cloudflare-zero-trust-access from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.