本文へ移動
cccskills
無料GitHub で公開日本語紹介

gateway-workers

GatewayのHTTPポリシーから呼び出されるCloudflare Workersを実装・デバッグ・レビューし、GatewayMiddlewareやリクエスト処理の継続方法を扱います。

原文原文の説明を見る

Build, debug, or review Cloudflare Workers invoked by the Forward action in Gateway HTTP policies, including the GatewayMiddleware entrypoint, Gateway types, context, and continuation.

fcakyon/claude-codex-settingsスター 1,192(GitHub 1,192 + cccskills 0)
連携ツールCloudflare

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • Gateway向けWorkerを実装したいとき
  • GatewayMiddlewareをレビューしたいとき
  • リクエストの継続処理をデバッグしたいとき
  • Gatewayポリシー経由で動作を検証したいとき

日本語での紹介

できること

GatewayのHTTPポリシーでForwardアクションから呼び出されるCloudflare Workerの実装、デバッグ、レビューを支援します。現在のForwardガイドとテンプレートを確認し、WorkerEntrypointを継承した名前付きGatewayMiddlewareクラスとhandle(request, context, next)の実装を扱います。Gatewayのリクエスト情報とWorkersの実行コンテキストやバインディングを区別し、next(request)で元の宛先へ処理を続けるか、合成レスポンスを返すかを整理します。型チェックや、Forwardポリシーを通した検証の観点も含みます。

こんなときに便利

Gatewayの許可済みHTTP通信に加工や合成レスポンスを加えるWorkerを作りたいとき、既存コードがGatewayの呼び出し契約に沿っているか確認したいときに役立ちます。IDやデバイス状態などのコンテキストを使う処理や、実際の通信経路での検証にも向いています。

使い方の例

  • 「GatewayのForwardポリシーで動くWorkerを実装して」
  • 「このGatewayMiddlewareの継続処理をレビューして」
  • 「Gateway経由でWorkerが呼び出されない原因を調べて」

注意点

HTTPS通信には復号が必要で、WebSocketはWorkerを経由せず、条件に一致するWorkers VPC通信は破棄されます。Workerの呼び出し失敗時は通信が遮断されます。next()は最大1回で、元の宛先に対してのみ継続します。ライセンスはApache-2.0です。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md4.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Gateway Workers

Read the current Forward guide before implementing a Worker. It defines how Gateway invokes Workers on permitted HTTP traffic. Retrieve the relevant page below rather than copying setup, API payloads, or limits into the project from memory.

Workflow

  1. Inspect the existing Worker and choose a Worker template for the required transformation, synthetic response, or background task.
  2. Export a named GatewayMiddleware class extending WorkerEntrypoint from cloudflare:workers. Implement handle(request, context, next) and return a Response. Gateway calls this method through RPC. A default fetch() handler alone does not implement the Forward contract.
  3. For TypeScript, follow the chosen template's current package installation and type-import instructions.
  4. Use the second argument for Gateway context. It describes the original request and stays unchanged when the Worker modifies the request. Keep it distinct from this.ctx (Workers execution context) and this.env (bindings).
  5. Continue the user's request with next(request) at most once, or return a synthetic response without calling it. next() always targets the original destination. Changes to the destination URL or host are ignored, and it cannot redirect, retry, or fan out. Use fetch() to send a request to a different destination. It creates an independent subrequest that does not inherit the user's Gateway policies or egress configuration.

Context

Use the published types and context reference for field names and availability. Treat a falsy identity (!identity) as anonymous and guard optional posture values. Call await context.identity() or await context.devicePosture() only when needed. Both getters can reject. Catch lookup failures separately from missing values and decide how to handle each when the Worker depends on them. Use Gateway-provided identity rather than client-supplied identity headers.

Gateway behavior

  • Only the first matching Forward policy invokes a Worker. Worker invocation does not confirm successful body inspection. Follow the Forward guide's inspection order.
  • Gateway inspects the final response, including synthetic responses. Modified request bytes are not inspected again before reaching the origin.
  • Review the Forward guide's limitations before choosing traffic: HTTPS requires decryption, WebSockets bypass the Worker, and matching Workers VPC traffic is dropped. Worker invocation failures fail closed.

Validation

Type-check against the installed Gateway types and test the named RPC entrypoint, including zero or one continuation call and the context values the Worker uses. Then test a permitted request through a scoped Gateway Forward policy. A direct request to a default fetch() handler does not validate the Gateway path. Follow the chosen template's test procedure and the Forward guide's troubleshooting steps.

Check the response and streaming rules: return a final status from 200 to 599, return no body for HEAD requests or statuses 204, 205, and 304, and stream bodies rather than buffering them.

Related skills

  • cloudflare-one: Gateway policy design, traffic paths, identity, TLS, and rollout.
  • workers-best-practices: streaming, bindings, generated environment types, background work, observability, and runtime tests.
  • CLI selection: choose the existing cf-cli or wrangler skill for project setup and deployment.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

adhd-output-style

無料概要あり

要点を先に示し、作業を短い番号付き手順に分けるなど、作業記憶に負担をかけにくい形式で応答を整え、説明も添えるスキルです。

  • 手順を短く区切って進めたいとき
  • 回答の要点を先に知りたいとき
  • 進捗を見失わず作業したいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

agent-browser

無料概要あり

Webサイトを開いて内容を読み、ボタン操作やフォーム入力、データ抽出、スクリーンショット撮影まで進めるブラウザー自動化の手順を案内します。

  • Webフォームに入力したいとき
  • ページから情報を抽出したいとき
  • 画面のスクリーンショットを撮りたいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

agents-sdk

無料概要あり

Cloudflare Agents SDKを使うアプリの開発、デバッグ、レビューを支援し、状態管理やチャット、バックグラウンド処理などの実装を確認するスキルです。

  • Agents SDKでアプリを作りたいとき
  • 既存のWorkersにSDKを追加したいとき
  • 状態管理やルーティングをデバッグしたいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

anthropic-frontend-design

無料概要あり

案件の内容に合わせて配色・文字・レイアウトを設計し、定型的に見えないWeb画面を組み立てるためのスキルです。

  • 新しいWeb画面の方向性を決めたいとき
  • 既存ページの見た目を見直したいとき
  • 配色や書体、レイアウトを選びたいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

azure-usage

無料概要あり

Azureのストレージ、Key Vault、Cosmos DB、AKSなどのリソースを照会・操作し、ログ分析のクエリにも使えるスキルです。

  • ストレージやBlobを一覧で確認したいとき
  • Key Vaultのシークレットを管理したいとき
  • Cosmos DBのデータを検索したいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

basin

無料概要あり

Cloudflare Basinでイベントを取り込み、R2のIcebergテーブルに保存し、カタログ管理やSQL分析を行うための作業を支援します。旧Data Platform系の名称で相談された場合も対象です。

  • イベントをR2に取り込みたいとき
  • Icebergテーブルのカタログを管理したいとき
  • R2の分析データをSQLで調べたいとき
fcakyon/claude-codex-settings1,1922026年10月27日 更新

fcakyon のスキルをすべて見る

このスキルの問題を報告する