Skip to content

fcakyon/claude-codex-settings / plugins/cloudflare-skills/skills/cloudflare-deploy

cloudflare-deploy

Verified

Discover and choose Cloudflare products for apps, APIs, AI agents, storage, networking, and security. Use for architecture and product selection, including when the user describes a need without naming a Cloudflare product; then find the relevant skill or documentation.

FileKindSize
SKILL.mdskill md26.7 KB
references/ai-gateway/README.mdmarkdown1.9 KB
references/ai-gateway/configuration.mdmarkdown2.2 KB
references/ai-gateway/dynamic-routing.mdmarkdown1.9 KB
references/ai-gateway/features.mdmarkdown2.6 KB
references/ai-gateway/sdk-integration.mdmarkdown2.2 KB
references/ai-gateway/troubleshooting.mdmarkdown2.5 KB
references/ai-search/README.mdmarkdown1.8 KB
references/ai-search/api.mdmarkdown1.3 KB
references/ai-search/configuration.mdmarkdown1.8 KB
references/ai-search/gotchas.mdmarkdown1.6 KB
references/ai-search/patterns.mdmarkdown1.7 KB
references/bindings/README.mdmarkdown1.3 KB
references/bindings/api.mdmarkdown2.4 KB
references/bindings/configuration.mdmarkdown2.5 KB
references/bindings/gotchas.mdmarkdown3.0 KB
references/bindings/patterns.mdmarkdown2.4 KB
references/browser-rendering/README.mdmarkdown1.2 KB
references/browser-rendering/api.mdmarkdown1.2 KB
references/browser-rendering/configuration.mdmarkdown1.3 KB
references/browser-rendering/gotchas.mdmarkdown1.9 KB
references/browser-rendering/patterns.mdmarkdown1.5 KB
references/c3/README.mdmarkdown3.6 KB
references/c3/api.mdmarkdown2.2 KB
references/c3/configuration.mdmarkdown1.6 KB
references/c3/gotchas.mdmarkdown2.3 KB
references/c3/patterns.mdmarkdown2.1 KB
references/containers/README.mdmarkdown1.9 KB
references/containers/api.mdmarkdown1.6 KB
references/containers/configuration.mdmarkdown1.8 KB
references/containers/gotchas.mdmarkdown2.4 KB
references/containers/patterns.mdmarkdown2.5 KB
references/cron-triggers/README.mdmarkdown1.5 KB
references/cron-triggers/api.mdmarkdown1.7 KB
references/cron-triggers/configuration.mdmarkdown1.7 KB
references/cron-triggers/gotchas.mdmarkdown2.3 KB
references/cron-triggers/patterns.mdmarkdown2.0 KB
references/d1/README.mdmarkdown1.4 KB
references/d1/api.mdmarkdown1.9 KB
references/d1/configuration.mdmarkdown1.9 KB
references/d1/gotchas.mdmarkdown2.2 KB
references/d1/patterns.mdmarkdown2.2 KB
references/hyperdrive/README.mdmarkdown2.1 KB
references/hyperdrive/api.mdmarkdown3.1 KB
references/hyperdrive/configuration.mdmarkdown3.2 KB
references/hyperdrive/gotchas.mdmarkdown3.4 KB
references/hyperdrive/patterns.mdmarkdown2.7 KB
references/images/README.mdmarkdown983 B
references/images/api.mdmarkdown1.6 KB
references/images/configuration.mdmarkdown2.1 KB
references/images/gotchas.mdmarkdown2.2 KB
references/images/patterns.mdmarkdown1.8 KB
references/kv/README.mdmarkdown1.5 KB
references/kv/api.mdmarkdown1.8 KB
references/kv/configuration.mdmarkdown1.7 KB
references/kv/gotchas.mdmarkdown2.4 KB
references/kv/patterns.mdmarkdown2.9 KB
references/miniflare/README.mdmarkdown1.6 KB
references/miniflare/api.mdmarkdown1.8 KB
references/miniflare/configuration.mdmarkdown2.1 KB
references/miniflare/gotchas.mdmarkdown2.3 KB
references/miniflare/patterns.mdmarkdown2.2 KB
references/observability/README.mdmarkdown2.5 KB
references/observability/api.mdmarkdown2.2 KB
references/observability/configuration.mdmarkdown2.5 KB
references/observability/gotchas.mdmarkdown3.7 KB
references/observability/patterns.mdmarkdown3.0 KB
references/pages-functions/README.mdmarkdown1.3 KB
references/pages-functions/api.mdmarkdown1.1 KB
references/pages-functions/configuration.mdmarkdown1.3 KB
references/pages-functions/gotchas.mdmarkdown1.6 KB
references/pages-functions/patterns.mdmarkdown1.4 KB
references/pages/README.mdmarkdown1.5 KB
references/pages/api.mdmarkdown1.1 KB
references/pages/configuration.mdmarkdown1.5 KB
references/pages/gotchas.mdmarkdown1.7 KB
references/pages/patterns.mdmarkdown1.2 KB
references/queues/README.mdmarkdown1.8 KB
references/queues/api.mdmarkdown1.8 KB
references/queues/configuration.mdmarkdown2.3 KB
references/queues/gotchas.mdmarkdown2.8 KB
references/queues/patterns.mdmarkdown2.6 KB
references/r2/README.mdmarkdown1.7 KB
references/r2/api.mdmarkdown1.7 KB
references/r2/configuration.mdmarkdown2.2 KB
references/r2/gotchas.mdmarkdown3.3 KB
references/r2/patterns.mdmarkdown2.2 KB
references/secrets-store/README.mdmarkdown1.8 KB
references/secrets-store/api.mdmarkdown1.9 KB
references/secrets-store/configuration.mdmarkdown2.4 KB
references/secrets-store/gotchas.mdmarkdown2.8 KB
references/secrets-store/patterns.mdmarkdown3.0 KB
references/skill-feedback.mdmarkdown2.7 KB
references/smart-placement/README.mdmarkdown5.0 KB
references/smart-placement/api.mdmarkdown5.4 KB
references/smart-placement/configuration.mdmarkdown6.0 KB
references/smart-placement/gotchas.mdmarkdown5.5 KB
references/smart-placement/patterns.mdmarkdown5.6 KB
references/static-assets/README.mdmarkdown1.7 KB
references/static-assets/api.mdmarkdown1.7 KB
references/static-assets/configuration.mdmarkdown2.1 KB
references/static-assets/gotchas.mdmarkdown2.7 KB
references/static-assets/patterns.mdmarkdown2.2 KB
references/stream/README.mdmarkdown1.8 KB
references/stream/api-live.mdmarkdown2.1 KB
references/stream/api.mdmarkdown2.4 KB
references/stream/configuration.mdmarkdown2.0 KB
references/stream/gotchas.mdmarkdown2.3 KB
references/stream/patterns.mdmarkdown2.3 KB
references/tail-workers/README.mdmarkdown1.4 KB
references/tail-workers/api.mdmarkdown1.4 KB
references/tail-workers/configuration.mdmarkdown1.4 KB
references/tail-workers/gotchas.mdmarkdown1.6 KB
references/tail-workers/patterns.mdmarkdown1.5 KB
references/tunnel/README.mdmarkdown1.5 KB
references/tunnel/api.mdmarkdown1.3 KB
references/tunnel/configuration.mdmarkdown1.3 KB
references/tunnel/gotchas.mdmarkdown1.5 KB
references/tunnel/networking.mdmarkdown1.5 KB
references/tunnel/patterns.mdmarkdown1.5 KB
references/vectorize/README.mdmarkdown2.1 KB
references/vectorize/api.mdmarkdown2.1 KB
references/vectorize/configuration.mdmarkdown2.1 KB
references/vectorize/gotchas.mdmarkdown2.4 KB
references/vectorize/patterns.mdmarkdown2.6 KB
references/waf/README.mdmarkdown1.6 KB
references/waf/api.mdmarkdown2.0 KB
references/waf/configuration.mdmarkdown1.9 KB
references/waf/gotchas.mdmarkdown2.3 KB
references/waf/patterns.mdmarkdown1.9 KB
references/workers-ai/README.mdmarkdown1.8 KB
references/workers-ai/api.mdmarkdown1.3 KB
references/workers-ai/configuration.mdmarkdown1.6 KB
references/workers-ai/gotchas.mdmarkdown1.9 KB
references/workers-ai/patterns.mdmarkdown1.7 KB
references/workflows/README.mdmarkdown1.8 KB
references/workflows/api.mdmarkdown1.8 KB
references/workflows/configuration.mdmarkdown2.0 KB
references/workflows/gotchas.mdmarkdown2.8 KB
references/workflows/patterns.mdmarkdown2.7 KB

references/smart-placement/patterns.md

View on GitHub
# Smart Placement Patterns

## Backend Worker with Database Access

```typescript
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const user = await env.DATABASE.prepare('SELECT * FROM users WHERE id = ?').bind(userId).first();
    const orders = await env.DATABASE.prepare('SELECT * FROM orders WHERE user_id = ?').bind(userId).all();
    return Response.json({ user, orders });
  }
};
```

```jsonc
{ "placement": { "mode": "smart" }, "d1_databases": [{ "binding": "DATABASE", "database_id": "xxx" }] }
```

## Frontend + Backend Split (Service Bindings)

**Frontend:** Runs at edge for fast user response
**Backend:** Smart Placement runs close to database

```typescript
// Frontend Worker - routes requests to backend
interface Env {
  BACKEND: Fetcher;  // Service Binding to backend Worker
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    if (new URL(request.url).pathname.startsWith('/api/')) {
      return env.BACKEND.fetch(request);  // Forward to backend
    }
    return new Response('Frontend content');
  }
};

// Backend Worker - database operations
interface BackendEnv {
  DATABASE: D1Database;
}

export default {
  async fetch(request: Request, env: BackendEnv): Promise<Response> {
    const data = await env.DATABASE.prepare('SELECT * FROM table').all();
    return Response.json(data);
  }
};
```

**CRITICAL:** Use fetch-based Service Bindings (shown above). If using RPC with `WorkerEntrypoint`, Smart Placement will NOT optimize those method calls - only `fetch` handlers are affected.

**RPC vs Fetch - CRITICAL:** Smart Placement ONLY works with fetch-based bindings, NOT RPC.

```typescript
// ❌ RPC - Smart Placement has NO EFFECT on backend RPC methods
export class BackendRPC extends WorkerEntrypoint {
  async getData() {
    // ALWAYS runs at edge, Smart Placement ignored
    return await this.env.DATABASE.prepare('SELECT * FROM table').all();
  }
}

// ✅ Fetch - Smart Placement WORKS
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    // Runs close to DATABASE when Smart Placement enabled
    const data = await env.DATABASE.prepare('SELECT * FROM table').all();
    return Response.json(data);
  }
};
```

## External API Integration

```typescript
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const apiUrl = 'https://api.partner.com';
    const headers = { 'Authorization': `Bearer ${env.API_KEY}` };
    
    const [profile, transactions] = await Promise.all([
      fetch(`${apiUrl}/profile`, { headers }),
      fetch(`${apiUrl}/transactions`, { headers })
    ]);
    
    return Response.json({ 
      profile: await profile.json(), 
      transactions: await transactions.json()
    });
  }
};
```

## SSR / API Gateway Pattern

```typescript
// Frontend (edge) - auth/routing close to user
export default {
  async fetch(request: Request, env: Env) {
    if (!request.headers.get('Authorization')) {
      return new Response('Unauthorized', { status: 401 });
    }
    const data = await env.BACKEND.fetch(request);
    return new Response(renderPage(await data.json()), { 
      headers: { 'Content-Type': 'text/html' } 
    });
  }
};

// Backend (Smart Placement) - DB operations close to data
export default {
  async fetch(request: Request, env: Env) {
    const data = await env.DATABASE.prepare('SELECT * FROM pages WHERE id = ?').bind(pageId).first();
    return Response.json(data);
  }
};
```

## Durable Objects with Smart Placement

**Key principle:** Smart Placement does NOT control WHERE Durable Objects run. DOs always run in their designated region (based on jurisdiction or smart location hints).

**What Smart Placement DOES affect:** The location of the coordinator Worker's `fetch` handler that makes calls to multiple DOs.

**Pattern:** Enable Smart Placement on coordinator Worker that aggregates data from multiple DOs:

```typescript
// Worker with Smart Placement - aggregates data from multiple DOs
export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const userId = new URL(request.url).searchParams.get('user');
    
    // Get DO stubs
    const userDO = env.USER_DO.get(env.USER_DO.idFromName(userId));
    const analyticsID = env.ANALYTICS_DO.idFromName(`analytics-${userId}`);
    const analyticsDO = env.ANALYTICS_DO.get(analyticsID);
    
    // Fetch from multiple DOs
    const [userData, analyticsData] = await Promise.all([
      userDO.fetch(new Request('https://do/profile')),
      analyticsDO.fetch(new Request('https://do/stats'))
    ]);
    
    return Response.json({
      user: await userData.json(),
      analytics: await analyticsData.json()
    });
  }
};
```

```jsonc
// wrangler.jsonc
{
  "placement": { "mode": "smart" },
  "durable_objects": {
    "bindings": [
      { "name": "USER_DO", "class_name": "UserDO" },
      { "name": "ANALYTICS_DO", "class_name": "AnalyticsDO" }
    ]
  }
}
```

**When this helps:** 
- Worker's `fetch` handler runs closer to DO regions, reducing network latency for multiple DO calls
- Most beneficial when DOs are geographically concentrated or in specific jurisdictions
- Helps when coordinator makes many sequential or parallel DO calls

**When this DOESN'T help:**
- DOs are globally distributed (no single optimal Worker location)
- Worker only calls a single DO
- DO calls are infrequent or cached

## Best Practices

- Split full-stack apps: frontend at edge, backend with Smart Placement
- Use fetch-based Service Bindings (not RPC)
- Enable for backend logic: APIs, data aggregation, DB operations
- Don't enable for: static content, edge logic, RPC methods, Pages with `run_worker_first`
- Wait 15+ min for analysis, verify `placement_status = SUCCESS`
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall