| name | cloudflare-wrangler-typegen |
| description | Cloudflare Workers/Wrangler workflow for generating typed env bindings. NEVER manually edit worker configuration declaration files; always regenerate them via typegen. |
Cloudflare / Wrangler Typegen
Use this skill whenever you touch Cloudflare Workers test apps or packages that rely on generated worker env typings.
When to Use
Use this skill if any of the following are true:
- You add or rename
durable_objects bindings in wrangler.jsonc or wrangler.app.jsonc
- You add or rename service bindings/vars used in worker code
- You modify worker entrypoints (
src/worker.ts, workers/app.ts, DO classes)
- You add a new Workers app/test fixture
- TypeScript errors mention missing
Env properties or worker bindings
Hard Rule
NEVER manually create or edit worker-configuration.d.ts (or any generated worker env .d.ts) files.
These files must be regenerated by toolchain commands.
Required Workflow
-
Update source-of-truth config/code first:
wrangler.jsonc
wrangler.app.jsonc
- worker code (
src/worker.ts, workers/app.ts, DO bindings usage)
-
Run app typegen command from that app directory:
This should run React Router typegen and Wrangler/cf-typegen in this repo's scripts.
-
If needed, run explicit worker type generation command used by the app scripts:
-
Validate:
Notes
- If generated files change, commit those generated changes (do not hand-edit).
- If an app has custom typegen scripts, use that app's script instead of inventing new commands.
- If typegen is failing, fix the underlying binding mismatch rather than patching
.d.ts output.