Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计提醒

cloudflare-full-stack-scaffoldcloudflare 全栈脚手架

Agent Skill

cloudflare-full-stack-scaffold 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

832

周安装

34

GitHub Stars

14

下载量

269
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cloudflare-full-stack-scaffold(cloudflare 全栈脚手架)
来源仓库:https://github.com/jackspace/claudeskillz
仓库路径:skills/cloudflare-full-stack-scaffold
安装命令:
npx skills add https://github.com/jackspace/claudeskillz --skill cloudflare-full-stack-scaffold
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jackspace/claudeskillz --skill cloudflare-full-stack-scaffold

简介

cloudflare-full-stack-scaffold 提供预配置的 React + Hono 全栈项目模板。

  • 内置 D1、KV、R2 等服务连接和 AI SDK 集成支持。
  • 可选 Clerk 认证、AI 聊天和 Vectorize 向量搜索功能。
  • 采用 Tailwind v4 和 shadcn/ui 的现代前端技术栈组合。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Cloudflare Full-Stack Scaffold

Complete, production-ready starter project for building full-stack applications on Cloudflare with React, Hono, AI SDK, and all Cloudflare services pre-configured.

When to Use This Skill

Use this skill when you need to:

  • Start a new full-stack Cloudflare project in minutes instead of hours
  • Build AI-powered applications with chat interfaces, RAG, or tool calling
  • Have core Cloudflare services ready (D1, KV, R2, Workers AI)
  • Opt-in to advanced features (Clerk Auth, AI Chat, Queues, Vectorize)
  • Use modern best practices (Tailwind v4, shadcn/ui, AI SDK, React 19)
  • Include planning docs and session handoff from the start
  • Choose your AI provider (Workers AI, OpenAI, Anthropic, Gemini)
  • Enable features only when needed with simple npm scripts
  • Avoid configuration errors and integration issues

What This Skill Provides

Complete Scaffold Project

A fully working application you can copy, customize, and deploy immediately:

# Copy the scaffold
cp -r scaffold/ my-new-app/
cd my-new-app/

# Install dependencies
npm install

# Initialize core services (D1, KV, R2)
./scripts/init-services.sh

# Create database tables
npm run d1:local

# Start developing
npm run dev

Result: Full-stack app running in ~5 minutes with:

  • ✅ Frontend and backend connected
  • ✅ Core Cloudflare services configured (D1, KV, R2, Workers AI)
  • ✅ AI SDK ready with multiple providers
  • ✅ Planning docs and session handoff protocol
  • ✅ Dark mode, theming, UI components
  • ✅ Optional features (1 script each to enable):

- Clerk Auth (npm run enable-auth) - AI Chat UI (npm run enable-ai-chat) - Queues (npm run enable-queues) - Vectorize (npm run enable-vectorize)

Scaffold Structure

scaffold/
├── package.json              # All dependencies (React, Hono, AI SDK, Clerk)
├── tsconfig.json            # TypeScript config
├── vite.config.ts           # Cloudflare Vite plugin
├── wrangler.jsonc           # All Cloudflare services configured
├── .dev.vars.example        # Environment variables template
├── .gitignore               # Standard ignores
├── README.md                # Project-specific readme
├── CLAUDE.md                # Project instructions for Claude
├── SCRATCHPAD.md            # Session handoff protocol
├── CHANGELOG.md             # Version history
├── schema.sql               # D1 database schema
│
├── docs/                    # Complete planning docs
│   ├── ARCHITECTURE.md
│   ├── DATABASE_SCHEMA.md
│   ├── API_ENDPOINTS.md
│   ├── IMPLEMENTATION_PHASES.md
│   ├── UI_COMPONENTS.md
│   └── TESTING.md
│
├── migrations/              # D1 migrations
│   └── 0001_initial.sql
│
├── src/                     # Frontend (React + Vite + Tailwind v4)
│   ├── main.tsx
│   ├── App.tsx
│   ├── index.css           # Tailwind v4 theming
│   ├── components/
│   │   ├── ui/             # shadcn/ui components
│   │   ├── ThemeProvider.tsx
│   │   ├── ProtectedRoute.tsx     # Auth (COMMENTED)
│   │   └── ChatInterface.tsx      # AI chat (COMMENTED)
│   ├── lib/
│   │   ├── utils.ts        # cn() utility
│   │   └── api-client.ts   # Fetch wrapper
│   └── pages/
│       ├── Home.tsx
│       ├── Dashboard.tsx
│       └── Chat.tsx        # AI chat page (COMMENTED)
│
└── backend/                 # Backend (Hono + Cloudflare)
    ├── src/
    │   └── index.ts        # Main Worker entry
    ├── middleware/
    │   ├── cors.ts
    │   └── auth.ts         # JWT (COMMENTED)
    ├── routes/
    │   ├── api.ts          # Basic API routes
    │   ├── d1.ts           # D1 examples
    │   ├── kv.ts           # KV examples
    │   ├── r2.ts           # R2 examples
    │   ├── ai.ts           # Workers AI (direct binding)
    │   ├── ai-sdk.ts       # AI SDK examples (multiple providers)
    │   ├── vectorize.ts    # Vectorize examples
    │   └── queues.ts       # Queues examples
    └── db/
        └── queries.ts      # D1 typed query helpers

Helper Scripts

scripts/setup-project.sh:

  • Copies scaffold to new directory
  • Renames project in package.json
  • Initializes git repository
  • Runs npm install
  • Prompts to initialize services

scripts/init-services.sh:

  • Creates D1 database via wrangler
  • Creates KV namespace
  • Creates R2 bucket
  • Updates wrangler.jsonc with IDs
  • (Queues and Vectorize created when enabled)

scripts/enable-auth.sh:

  • Uncomments all Clerk auth patterns
  • Enables ProtectedRoute component
  • Enables auth middleware
  • Prompts for Clerk API keys
  • Updates.dev.vars

scripts/enable-ai-chat.sh:

  • Uncomments ChatInterface component
  • Uncomments Chat page
  • Enables AI SDK UI patterns
  • Adds chat route to App.tsx
  • Prompts for AI provider API keys

scripts/enable-queues.sh:

  • Uncomments Queues routes and bindings
  • Enables async message processing
  • Provides queue creation instructions
  • Updates backend and config files

scripts/enable-vectorize.sh:

  • Uncomments Vectorize routes and bindings
  • Enables vector search and RAG
  • Provides index creation instructions
  • Configures embedding dimensions

Reference Documentation

references/quick-start-guide.md:

  • 5-minute setup walkthrough
  • First deployment guide
  • Common customizations

references/service-configuration.md:

  • Details on each Cloudflare service
  • When to use each one
  • Configuration options

references/ai-sdk-guide.md:

  • AI SDK Core vs UI
  • Provider switching patterns
  • Streaming and tool calling
  • RAG implementation

references/customization-guide.md:

  • Removing unused services
  • Adding new routes/pages
  • Customizing theme
  • Project structure best practices

references/enabling-auth.md:

  • Clerk setup walkthrough
  • JWT template configuration
  • Testing auth flow

Key Integrations

1. AI SDK Integration (Three Approaches)

Direct Workers AI Binding (fastest):

// Already works, no API key needed
const result = await c.env.AI.run('@cf/meta/llama-3-8b-instruct', {
  messages: [{ role: 'user', content: 'Hello' }]
})

AI SDK with Workers AI (portable code, same infrastructure):

import { streamText } from 'ai'
import { createWorkersAI } from 'workers-ai-provider'

const workersai = createWorkersAI({ binding: c.env.AI })
const result = await streamText({
  model: workersai('@cf/meta/llama-3-8b-instruct'),
  messages: [{ role: 'user', content: 'Hello' }]
})

AI SDK with External Providers (OpenAI, Anthropic, Gemini):

import { openai } from '@ai-sdk/openai'
import { anthropic } from '@ai-sdk/anthropic'

// Switch providers in 1 line
const result = await streamText({
  model: openai('gpt-4o'),  // or anthropic('claude-sonnet-4-5')
  messages: [{ role: 'user', content: 'Hello' }]
})

AI SDK v5 UI - Chat Interface (COMMENTED, enable with script):

import { useChat } from '@ai-sdk/react'
import { DefaultChatTransport } from 'ai'
import { useState } from 'react'

function ChatInterface() {
  const [input, setInput] = useState('')
  const { messages, sendMessage, status } = useChat({
    transport: new DefaultChatTransport({
      api: '/api/ai-sdk/chat',
    }),
  })

  // Send message on Enter key
  const handleKeyDown = (e) => {
    if (e.key === 'Enter' && status === 'ready' && input.trim()) {
      sendMessage({ text: input })
      setInput('')
    }
  }

  // Render messages (v5 uses message.parts[])
  return (
    <div>
      {messages.map(m => (
        <div key={m.id}>
          {m.parts.map(part => {
            if (part.type === 'text') return <div>{part.text}</div>
          })}
        </div>
      ))}
      <input
        value={input}
        onChange={e => setInput(e.target.value)}
        onKeyDown={handleKeyDown}
        disabled={status !== 'ready'}
      />
    </div>
  )
}

2. Forms & Data Fetching (React Hook Form + Zod + TanStack Query)

Industry-Standard Libraries for Production Apps:

React Hook Form - Performant form state management:

import { useForm } from 'react-hook-form'
import { zodResolver } from '@hookform/resolvers/zod'

const form = useForm({
  resolver: zodResolver(userSchema), // Zod validation
})

<input {...register('name')} />
{errors.name && <span>{errors.name.message}</span>}

Zod v4 - TypeScript-first schema validation:

// Define schema once
const userSchema = z.object({
  name: z.string().min(2),
  email: z.string().email(),
  age: z.number().int().positive().optional(),
})

// Infer TypeScript type
type User = z.infer<typeof userSchema>

// Use in frontend (React Hook Form)
resolver: zodResolver(userSchema)

// Use in backend (same schema!)
const validated = userSchema.parse(requestBody)

TanStack Query v5 - Smart data fetching & caching:

// Fetch data with automatic caching
const { data, isLoading } = useQuery({
  queryKey: ['users'],
  queryFn: () => apiClient.get('/api/users'),
})

// Update data with mutations
const mutation = useMutation({
  mutationFn: (newUser) => apiClient.post('/api/users', newUser),
  onSuccess: () => {
    queryClient.invalidateQueries({ queryKey: ['users'] })
  },
})

Full-Stack Validation Pattern:

  • ✅ Define schema in shared/schemas/ (single source of truth)
  • ✅ Frontend validates instantly (React Hook Form + Zod)
  • ✅ Backend validates securely (same Zod schema)
  • ✅ TypeScript types inferred automatically
  • ✅ Update validation once, applies everywhere

Complete Working Examples:

  • Profile page with form: /profile route
  • Dashboard with queries: /dashboard route
  • Form component: src/components/UserProfileForm.tsx
  • Backend validation: backend/routes/forms.ts
  • Shared schemas: shared/schemas/userSchema.ts

See references/supporting-libraries-guide.md for comprehensive guide.

3. All Cloudflare Services Pre-Configured

Database (D1):

  • Schema file with example tables
  • Migrations directory
  • Typed query helpers
  • Example CRUD routes

Key-Value Storage (KV):

  • Get/put/delete examples
  • TTL patterns
  • Bulk operations

Object Storage (R2):

  • Upload/download examples
  • Presigned URLs
  • Streaming large files

AI Inference (Workers AI):

  • Text generation
  • Embeddings
  • Image generation (Stable Diffusion)

Vector Database (Vectorize):

  • Insert/query embeddings
  • RAG patterns
  • Similarity search

Message Queues:

  • Producer examples
  • Consumer patterns
  • Batch processing

3. Optional Clerk Authentication

All auth patterns included but COMMENTED - uncomment to enable:

./scripts/enable-auth.sh
# Prompts for Clerk keys, uncomments all patterns

What gets enabled:

  • Frontend: ProtectedRoute component, auth in api-client
  • Backend: JWT verification middleware
  • Protected API routes
  • Auth loading states
  • Session management

4. Planning Docs + Session Handoff Protocol

docs/ directory - Complete planning structure:

  • ARCHITECTURE.md: System design
  • DATABASE_SCHEMA.md: D1 schema docs
  • API_ENDPOINTS.md: All routes documented
  • IMPLEMENTATION_PHASES.md: Phased build approach
  • UI_COMPONENTS.md: Component hierarchy
  • TESTING.md: Test strategy

SCRATCHPAD.md - Session handoff protocol:

  • Current phase tracking
  • Progress checkpoints
  • Next actions
  • References to planning docs

Usage Guide

Quick Start (5 Minutes)

# 1. Copy scaffold
cd /path/to/skills/cloudflare-full-stack-scaffold
cp -r scaffold/ ~/projects/my-new-app/
cd ~/projects/my-new-app/

# 2. Run setup
npm install

# 3. Initialize Cloudflare services
npx wrangler d1 create my-app-db
npx wrangler kv:namespace create my-app-kv
npx wrangler r2 bucket create my-app-bucket
npx wrangler vectorize create my-app-index --dimensions=1536
npx wrangler queues create my-app-queue

# 4. Update wrangler.jsonc with IDs from step 3

# 5. Create D1 tables
npx wrangler d1 execute my-app-db --local --file=schema.sql

# 6. Start dev server
npm run dev

Visit: http://localhost:5173

Enable Authentication (Optional)

./scripts/enable-auth.sh
# Prompts for Clerk publishable and secret keys
# Uncomments all auth patterns
# Updates .dev.vars

npm run dev

Enable AI Chat Interface (Optional)

./scripts/enable-ai-chat.sh
# Uncomments ChatInterface component
# Uncomments Chat page
# Prompts for OpenAI/Anthropic API keys (optional)

npm run dev

Visit: http://localhost:5173/chat

Deploy to Production

# Build
npm run build

# Deploy
npx wrangler deploy

# Migrate production database
npx wrangler d1 execute my-app-db --remote --file=schema.sql

# Set production secrets
npx wrangler secret put CLERK_SECRET_KEY
npx wrangler secret put OPENAI_API_KEY

Customization Patterns

Remove Unused Services

Don't need Vectorize?

  1. Delete backend/routes/vectorize.ts
  2. Remove vectorize binding from wrangler.jsonc
  3. Remove from vite.config.ts cloudflare plugin
  4. Remove route registration in backend/src/index.ts

Add New API Routes

// backend/routes/my-feature.ts
import { Hono } from 'hono'

export const myFeatureRoutes = new Hono()

myFeatureRoutes.get('/hello', (c) => {
  return c.json({ message: 'Hello from my feature!' })
})

// backend/src/index.ts
import { myFeatureRoutes } from './routes/my-feature'
app.route('/api/my-feature', myFeatureRoutes)

Switch AI Providers

// Change this line:
model: openai('gpt-4o'),

// To this:
model: anthropic('claude-sonnet-4-5'),

// Or this:
model: google('gemini-2.5-flash'),

// Or use Workers AI:
const workersai = createWorkersAI({ binding: c.env.AI })
model: workersai('@cf/meta/llama-3-8b-instruct'),

Customize Theme

All theming in src/index.css:

:root {
  --background: hsl(0 0% 100%);  /* Change colors here */
  --foreground: hsl(0 0% 3.9%);
  --primary: hsl(220 90% 56%);
  /* etc */
}

Architecture Highlights

Frontend-Backend Connection

Key Insight: The Vite plugin runs your Worker on the SAME port as Vite.

// ✅ CORRECT: Use relative URLs
fetch('/api/data')

// ❌ WRONG: Don't use absolute URLs
fetch('http://localhost:8787/api/data')

No proxy configuration needed!

Environment Variables

Frontend (.env):

VITE_CLERK_PUBLISHABLE_KEY=pk_test_xxx

Backend (.dev.vars):

CLERK_SECRET_KEY=sk_test_xxx
OPENAI_API_KEY=sk-xxx

CORS Configuration

Critical: CORS middleware must be applied BEFORE routes:

// ✅ CORRECT ORDER
app.use('/api/*', corsMiddleware)
app.post('/api/data', handler)

// ❌ WRONG - Will cause CORS errors
app.post('/api/data', handler)
app.use('/api/*', corsMiddleware)

Auth Pattern (When Enabled)

Frontend: Check isLoaded before making API calls:

const { isLoaded, isSignedIn } = useSession()

useEffect(() => {
  if (!isLoaded) return  // Wait for auth
  fetch('/api/protected').then(/* ... */)
}, [isLoaded])

Backend: JWT verification middleware:

import { jwtAuthMiddleware } from './middleware/auth'

app.use('/api/protected/*', jwtAuthMiddleware)

Dependencies Included

{
  "dependencies": {
    "react": "^19.2.0",
    "react-dom": "^19.2.0",
    "hono": "^4.10.2",
    "@cloudflare/vite-plugin": "^1.13.14",

    "ai": "^5.0.76",
    "@ai-sdk/openai": "^1.0.0",
    "@ai-sdk/anthropic": "^1.0.0",
    "@ai-sdk/google": "^1.0.0",
    "workers-ai-provider": "^2.0.0",
    "@ai-sdk/react": "^1.0.0",

    "@clerk/clerk-react": "^5.53.3",
    "@clerk/backend": "^2.19.0",

    "tailwindcss": "^4.1.14",
    "@tailwindcss/vite": "^4.1.14",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "tailwind-merge": "^2.5.4",

    "zod": "^3.24.1",
    "react-hook-form": "^7.54.2",
    "@hookform/resolvers": "^3.9.1",

    "@tanstack/react-query": "^5.62.11",

    "@radix-ui/react-slot": "^1.1.1",
    "@radix-ui/react-dropdown-menu": "^2.1.4"
  },
  "devDependencies": {
    "@types/react": "^19.0.0",
    "@types/react-dom": "^19.0.0",
    "typescript": "^5.7.2",
    "vite": "^7.1.11",
    "wrangler": "^4.0.0"
  }
}

Token Efficiency

ScenarioWithout ScaffoldWith ScaffoldSavings
Initial setup~18-22k tokens~3-5k tokens~80%
Service configuration~8-10k tokens0 tokens (done)100%
Frontend-backend connection~5-7k tokens0 tokens (done)100%
AI SDK setup~4-6k tokens0 tokens (done)100%
Auth integration~6-8k tokens~500 tokens~90%
Planning docs~3-5k tokens0 tokens (included)100%
Total~44-58k tokens~3-6k tokens~90%

Time Savings: 3-4 hours → 5-10 minutes (~95% faster)

Common Issues Prevented

IssueHow Scaffold Prevents It
Service binding errorsAll bindings pre-configured and tested
CORS errorsMiddleware in correct order
Auth race conditionsProper loading state patterns
Frontend-backend connectionVite plugin correctly configured
AI SDK setup confusionMultiple working examples
Missing planning docsComplete docs/ structure included
Environment variable mix-upsClear.dev.vars.example with comments
Missing migrationsmigrations/ directory with examples
Inconsistent file structureStandard, tested structure
Database type errorsTyped query helpers included
Theme configurationTailwind v4 theming pre-configured
Build errorsWorking build config (vite + wrangler)

Total Errors Prevented: 12+ common setup and integration errors

When NOT to Use This Scaffold

  • ❌ Building a static site (no backend needed)
  • ❌ Using Next.js, Remix, or other meta-framework
  • ❌ Need SSR (use framework-specific Cloudflare adapter)
  • ❌ Building backend-only API (no frontend needed)
  • ❌ Extremely simple single-page app

For these cases: Use minimal templates or official framework starters.

Production Evidence

Based on:

  • Cloudflare's official agents-starter template (AI SDK patterns)
  • cloudflare-full-stack-integration skill (tested frontend-backend patterns)
  • session-handoff-protocol skill (planning docs + SCRATCHPAD.md)
  • tailwind-v4-shadcn skill (UI component patterns)
  • Multiple production Jezweb projects

Package versions verified: 2025-10-23

Works with:

  • Cloudflare Workers (production environment)
  • Wrangler 4.0+
  • Node.js 18+
  • npm/pnpm/yarn

Quick Reference

Setup new project:

cp -r scaffold/ my-app/
cd my-app/
npm install
# Follow quick-start-guide.md

Enable auth:

./scripts/enable-auth.sh

Enable AI chat:

./scripts/enable-ai-chat.sh

Deploy:

npm run build
npx wrangler deploy

Key Files:

  • wrangler.jsonc - Service configuration
  • vite.config.ts - Build configuration
  • .dev.vars.example - Environment variables template
  • docs/ARCHITECTURE.md - System design
  • SCRATCHPAD.md - Session handoff protocol

Remember: This scaffold is a starting point, not a constraint. Customize everything to match your needs. The value is in having a working foundation with all the integration patterns already figured out, saving hours of setup and debugging time.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.03%
按下载量换算73

windsurf

21.47%
按下载量换算58

OpenCode

17.34%
按下载量换算47

Codex

12.68%
按下载量换算34

Antigravity

6.81%
按下载量换算18

Gemini CLI

3.06%
按下载量换算8

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills