Agent skill

Cloudflare Zero Trust Access

by secondsky in secondsky/claude-skills

Cloudflare Zero Trust Access authentication for Workers. An agent skill from secondsky/claude-skills.

MITAuto-check: notesBackend & APIs

Install Cloudflare Zero Trust Access

skills CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-zero-trust-access -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills cloudflare-zero-trust-access --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/cloudflare-zero-trust-access/skills/cloudflare-zero-trust-access .claude/skills/cloudflare-zero-trust-access && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-zero-trust-access
GitHub stars
227
Token cost
~2.6k tokens
SKILL.md length
748 words
Files
18 (incl. scripts, references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

Cloudflare Zero Trust Access authentication for Workers. An agent skill from secondsky/claude-skills.

  • Encountering preflight blocking
  • SKILL.md covers Overview, When to Use This Skill, Integration Patterns and Common Errors Prevented, plus 7 more sections
  • Runs TypeScript and Shell scripts from its folder; reaches team.cloudflareaccess.com and worker.workers.dev
  • Cache race conditions

What it does

Cloudflare Zero Trust Access is an agent skill from secondsky/claude-skills. Cloudflare Zero Trust Access authentication for Workers. Use for JWT validation, service tokens, CORS, or encountering preflight blocking, cache race conditions, missing JWT headers.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 20 other files, including scripts and reference files (for example `references/access-policy-setup.md`, `references/common-errors.md` and `references/jwt-payload-structure.md`).

It sits in Backend & APIs, covering Authentication and Async programming. It works with Cloudflare and Hono. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Encountering preflight blocking
  • Cache race conditions
  • Missing JWT headers

Example prompts

  • “/cloudflare-zero-trust-access”

Requirements

  • Node.js
  • A Bash shell
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (TypeScript and Shell), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • team.cloudflareaccess.com
    • worker.workers.dev

    Also links to:

    • developers.cloudflare.com
    • github.com
    • hono.dev
    • one.dash.cloudflare.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Zero Trust Access loads about 2.6k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 53 tokens; SKILL.md has 748 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 748 words, ~2,565 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-zero-trust-access/SKILL.md (or your agent's skills folder). This skill also uses 17 other files; get the full folder from GitHub.
name
cloudflare-zero-trust-access
description
Cloudflare Zero Trust Access authentication for Workers. Use for JWT validation, service tokens, CORS, or encountering preflight blocking, cache race conditions, missing JWT headers.
allowed-tools
Read, Write, Edit, Bash
license
MIT
metadata.version
1.0.0
metadata.category
authentication
metadata.framework
hono
metadata.platform
cloudflare-workers
metadata.errors_prevented
8
metadata.token_savings
58%
metadata.time_savings
2.5 hours
metadata.production_tested
true
metadata.last_verified
2025-10-28

Cloudflare Zero Trust Access Skill

Integrate Cloudflare Zero Trust Access authentication with Cloudflare Workers applications using proven patterns and templates.


Overview

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:

  • No auth infrastructure to maintain
  • Integrates with identity providers (Azure AD, Google, Okta, GitHub)
  • Service tokens for machine-to-machine auth
  • Built-in MFA and session management
  • Comprehensive audit logs

When to Use This Skill

Trigger this skill when tasks involve:

  • Authentication: Protecting Worker routes, securing admin dashboards, API authentication
  • Access Control: Role-based access (RBAC), group-based permissions, geographic restrictions
  • Service Auth: Backend services calling Worker APIs, CI/CD pipelines, cron jobs
  • Multi-Tenant: SaaS apps with organization-level authentication
  • CORS + Auth: Single-page applications calling protected APIs

Keywords to Trigger: cloudflare access, zero trust, access authentication, JWT validation, service tokens, cloudflare auth, hono access, workers authentication, protect worker routes, admin authentication


Integration Patterns

📖 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:

  • Building with Hono framework
  • Need quick, production-ready setup
  • Want automatic JWT validation and key caching

Template: templates/hono-basic-setup.ts

Setup:

typescript
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):

jsonc
{
  "vars": {
    "ACCESS_TEAM_DOMAIN": "your-team.cloudflareaccess.com",
    "ACCESS_AUD": "your-app-aud-tag"
  }
}

Benefits:

  • ✅ Automatic JWT validation
  • ✅ Public key caching (1-hour TTL)
  • ✅ Type-safe with TypeScript
  • ✅ Production-tested and maintained

Pattern 2: Manual JWT Validation

When to Use: Not using Hono, need custom validation logic

Template: templates/jwt-validation-manual.ts (~100 lines, uses Web Crypto API)


Pattern 3: Service Token Authentication

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


Pattern 4: CORS + Access

When to Use: SPA (React/Vue/Angular) calling protected API

⚠️ CRITICAL: CORS middleware MUST come BEFORE Access middleware!

typescript
// ✅ 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


Pattern 5: Multi-Tenant

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


Common Errors Prevented

This skill prevents 8 documented errors. Full details: references/common-errors.md

Error #1: CORS Preflight Blocked (45 min saved)

Problem: OPTIONS requests return 401, breaking CORS

Solution: CORS middleware BEFORE Access middleware

typescript
// ✅ Correct
app.use('*', cors())
app.use('/api/*', cloudflareAccess({ domain: '...' }))

Error #2: Missing JWT Header (30 min saved)

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

Error #3: Invalid Team Name (15 min saved)

Problem: Hardcoded or wrong team name causes "Invalid issuer"

Solution: Use environment variables

typescript
// ✅ Correct
cloudflareAccess({ domain: (c) => c.env.ACCESS_TEAM_DOMAIN })

// ❌ Wrong
cloudflareAccess({ domain: 'my-team.cloudflareaccess.com' })

Show full SKILL.md (307 more words)Show less
Errors #4-8 (Quick Reference)
#ErrorSolution
4Key cache raceUse @hono/cloudflare-access (auto-caches)
5Wrong service token headersUse CF-Access-Client-Id/Secret (not Authorization)
6Token expiration (401 after 1 hr)Handle gracefully, redirect to login
7Overlapping policiesUse most specific paths
8Dev/prod mismatchUse environment-specific configs

📄 Full error details: references/common-errors.md (~2.5 hours saved per implementation)


Templates

TemplatePurpose
hono-basic-setup.tsStandard Hono + Access integration
jwt-validation-manual.tsManual JWT verification with Web Crypto
service-token-auth.tsService token patterns
cors-access.tsCORS + Access (correct ordering)
multi-tenant.tsMulti-tenant architecture
wrangler.jsoncComplete Wrangler configuration
.env.exampleEnvironment variable template
types.tsTypeScript definitions

Scripts

ScriptUsage
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 Cases

Use CaseTemplateKey Point
Admin Dashboardhono-basic-setup.tsEmail domain policy
API Authenticationhono-basic-setup.tsMixed user/service policy
SPA + APIcors-access.tsCORS before Access!
CI/CD Pipelineservice-token-auth.tsService token in secrets
Multi-Tenant SaaSmulti-tenant.tsD1 tenant config

📄 Detailed use cases: references/use-cases.md


When to Load References

Reference FileLoad When...
references/quick-start.mdStep-by-step setup for new users, first-time integration
references/common-errors.mdDebugging auth issues, prevention patterns (includes all 8 errors)
references/jwt-payload-structure.mdAccessing JWT claims, user vs service token
references/service-tokens-guide.mdSetting up machine-to-machine auth
references/access-policy-setup.mdDashboard configuration, policy creation
references/use-cases.mdDetailed implementation for specific scenarios
references/value-proposition.mdToken efficiency metrics, workflow guidance, production validation

Package Versions

PackageVersion
@hono/cloudflare-access0.3.1
hono4.12.12
@cloudflare/workers-types4.20260408.0

Verified: 2025-12-14 | Token Savings: ~58% | Production Tested: ✅


When NOT to Use

This skill is for Cloudflare Workers with Cloudflare Access. Do not use for:

  • ❌ Cloudflare Pages (use @cloudflare/pages-plugin-cloudflare-access instead)
  • ❌ Non-Cloudflare platforms
  • ❌ Custom JWT auth (not Access)
  • ❌ Auth.js or other auth libraries
  • ❌ Self-hosted authentication

For those, use appropriate skills or libraries.


Additional Resources

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: ✅

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 17 other files (scripts, references) in plugins/cloudflare-zero-trust-access/skills/cloudflare-zero-trust-access of secondsky/claude-skills.

  • SKILL.md
  • references/access-policy-setup.md
  • references/common-errors.md
  • references/jwt-payload-structure.md
  • references/quick-start.md
  • references/service-tokens-guide.md
  • references/use-cases.md
  • references/value-proposition.md
  • scripts/create-service-token.sh
  • scripts/test-access-jwt.sh
  • templates/.env.example
  • templates/cors-access.ts
  • templates/hono-basic-setup.ts
  • templates/jwt-validation-manual.ts
  • templates/multi-tenant.ts
  • templates/service-token-auth.ts
  • templates/types.ts
  • templates/wrangler.jsonc

Open the folder on GitHubat commit 8837836

Compare with similar skills

Cloudflare Zero Trust Access next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Zero Trust Access compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Zero Trust Access this skillsecondsky/claude-skills227—~2.6kAutomated safety check: NotesMIT
Gemini Live API Devgoogle-gemini/gemini-skills4.3k—~4.6kAutomated safety check: PassApache-2.0
Apikerhodgef/apiker127—~1.4kAutomated safety check: PassMIT
Cloudflare WorkersEpicenterHQ/epicenter4.8k—~576Automated safety check: PassCustom licence
HonoEpicenterHQ/epicenter4.8k—~513Automated safety check: PassCustom licence
Better Autheinverne/dotfiles121—~4kAutomated safety check: NotesMIT

Similar skills

  • Gemini Live API Dev

    google-gemini/gemini-skills

    Official

    A skill your agent uses when building real-time, bidirectional streaming applications with the Gemini Live API, or migrating legacy Live models (2.0/2.5/3.1) to Gemini 3.8 Live.

    4.3k GitHub stars~4.6k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Apiker

    hodgef/apiker

    Develop, review, and extend the Apiker library — a framework for building serverless REST APIs on Cloudflare Workers + Durable Objects.

    127 GitHub stars~1.4k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Cloudflare Workers

    EpicenterHQ/epicenter

    Cloudflare Workers patterns for Worker runtime APIs, Durable Objects, KV, R2, D1, Queues, WebSockets, streaming responses, bindings, wrangler configuration, and deployment limits.

    4.8k GitHub stars~576 tokensUpdated today
    Backend & APIsAuto-check passed
  • Hono

    EpicenterHQ/epicenter

    Hono patterns for TypeScript API routes, middleware, request and response typing, streaming, WebSockets, and Cloudflare Workers deployment.

    4.8k GitHub stars~513 tokensUpdated today
    Backend & APIsAuto-check passed
  • Better Auth

    einverne/dotfiles

    Guide for implementing Better Auth - a framework-agnostic authentication and authorization framework for TypeScript.

    121 GitHub stars~4k tokensUpdated 29 days ago
    Backend & APIsAuto-check: notes
  • OAuth

    hashgraph-online/awesome-codex-plugins

    A skill your agent uses when a val needs to require login with a Val Town account — gating routes behind authentication, identifying the current user, building user-specific dashboards.

    1.2k GitHub stars~1.1k tokensUpdated today
    Backend & APIsAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Works with

Categories

Questions about Cloudflare Zero Trust Access

What does Cloudflare Zero Trust Access do?

Cloudflare Zero Trust Access authentication for Workers. An agent skill from secondsky/claude-skills. Cloudflare Zero Trust Access is an agent skill from secondsky/claude-skills. Cloudflare Zero Trust Access authentication for Workers.

When should I use Cloudflare Zero Trust Access?

Cloudflare Zero Trust Access fits situations like: encountering preflight blocking; cache race conditions; missing JWT headers.

How do I install Cloudflare Zero Trust Access in Claude Code?

Run `npx skills add secondsky/claude-skills --skill cloudflare-zero-trust-access -a claude-code`. Or copy the skill folder (plugins/cloudflare-zero-trust-access/skills/cloudflare-zero-trust-access in secondsky/claude-skills) into .claude/skills/cloudflare-zero-trust-access in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Zero Trust Access in Codex?

Run `npx skills add secondsky/claude-skills --skill cloudflare-zero-trust-access -a codex`. Or copy the skill folder (plugins/cloudflare-zero-trust-access/skills/cloudflare-zero-trust-access in secondsky/claude-skills) into .agents/skills/cloudflare-zero-trust-access in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Zero Trust Access in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill cloudflare-zero-trust-access -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-zero-trust-access, .gemini/skills/cloudflare-zero-trust-access, .github/skills/cloudflare-zero-trust-access and .opencode/skills/cloudflare-zero-trust-access in your project.

What does Cloudflare Zero Trust Access need to run?

Going by SKILL.md and its folder, Cloudflare Zero Trust Access needs TypeScript and a shell for the scripts in its folder. Our summary lists: Node.js; A Bash shell. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash.

Does Cloudflare Zero Trust Access access the network?

SKILL.md names 6 domains. In commands or code: team.cloudflareaccess.com and worker.workers.dev; the agent is likely to contact these when it follows the instructions. As links in the text: developers.cloudflare.com, github.com, hono.dev and one.dash.cloudflare.com. This is read from the text; nothing was executed.

Is Cloudflare Zero Trust Access safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Cloudflare Zero Trust Access use?

Cloudflare Zero Trust Access is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Zero Trust Access use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 17k tokens, read only when the agent opens those files.

What are the alternatives to Cloudflare Zero Trust Access?

Skills that share tags, products or a category with Cloudflare Zero Trust Access: Gemini Live API Dev (google-gemini/gemini-skills, 4.3k stars), Apiker (hodgef/apiker, 127 stars), Cloudflare Workers (EpicenterHQ/epicenter, 4.8k stars) and Hono (EpicenterHQ/epicenter, 4.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Zero Trust Access?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.