cj-cloudflare-worker
Skill1 starsChanged 32 days agoMITView on GitHub
Create or update a Cloudflare Worker inside an existing GitHub repository and deploy it to one or more custom domains. Use when Codex needs to add or revise `wrangler.jsonc`, wire GitHub Actions deployment on `main` or preview branches, configure custom domains or DNS-backed hostnames, request Cloudflare account credentials and GitHub secrets, or add optional Durable Objects with SQLite-backed storage for a public or private repo.
- Reads credentials
- Installs packages
In this repository19 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cj-abSkill
- cj-ambitionSkill
- cj-automateSkill
- cj-code-reviewSkill
- cj-dailySkill
- cj-meetingsSkill
- cj-notesSkill
- cj-nowSkill
- cj-owa-toolsSkill
- cj-thingsSkill
- cj-todoSkill
- cj-uxloopSkill
- cj-video-visionSkill
- cj-voice-dnaSkill
- repo-deepSkill
- repo-depsSkill
- repo-groomSkill
- repo-healthSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
33 rules. About 0 are common, 22 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈22
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 8
Create Workers in-place inside an existing repository.
- Distinctive: line 26
Read existing GitHub workflows before adding new ones.
- Distinctive: line 27
Prefer adapting the current project over introducing a parallel structure.
- Very specific: line 38
Add or update wrangler.jsonc.
- Very specific: line 39
Use ./assets/wrangler.custom-domain.jsonc for a normal Worker.
- Very specific: line 40
Use ./assets/wrangler.durable-object.jsonc when the Worker needs a Durable Object.
- Distinctive: line 41
Keep the repo's real entrypoint and build output paths.
- Distinctive: line 43
Use one route object per hostname.
- Very specific: line 44
Use custom_domain: true only for hostnames inside Cloudflare-managed zones.
- Distinctive: line 45
If the Worker should sit in front of an existing origin on only part of a hostname, use a route pattern instead of a custom domain.
- Very specific: line 46
Keep env.preview separate from production so preview deploys do not overwrite the primary Worker.
- Distinctive: line 48
Add the Worker runtime changes.
- Distinctive: line 50
If the app is mostly static, route the Worker to the built assets directory instead of replacing the build system.
- Distinctive: line 51
If a Durable Object is requested, use SQLite-backed Durable Objects for new classes by default.
- Distinctive: line 52
Add a migration entry whenever introducing a Durable Object class.
- Distinctive: line 53
Do not attempt to convert an already deployed KV-backed Durable Object to SQLite in place.
- Distinctive: line 55
Add GitHub Actions deployment.
- Very specific: line 57
Add ./assets/deploy-worker-preview.yml only when preview deploys are requested.
- Distinctive: line 58
Keep Node on GitHub Actions as the default runtime unless the repo clearly uses something else.
- Distinctive: line 61
Keep the preview workflow guard that skips pull requests from forks so secrets are not exposed.
- Distinctive: line 64
Ask for a Cloudflare API token with the minimum needed permissions for Workers and DNS changes.
- Very specific: line 65
Default local storage to a repo-local, gitignored .env file unless project conventions prefer .dev.vars.
- Very specific: line 66
Create or update .env.example using ./assets/cloudflare.env.example.
- Distinctive: line 68
Never commit live secrets.
- Distinctive: line 70
Verify without assuming deploy access.
- Very specific: line 72
Only run wrangler deploy when the user explicitly wants a live deploy or credentials are already provided.
- Distinctive: line 73
If a preview workflow is added, verify that the PR comment step updates an existing bot comment instead of spamming new comments.
- Distinctive: line 77
Prefer custom domains over legacy wildcard routes when the Worker should own the entire hostname.
- Very specific: line 78
Prefer workers.dev preview deployments unless the user explicitly asks for preview custom domains.
- Distinctive: line 79
If a hostname belongs to a zone not managed in the current Cloudflare account, stop short of claiming automatic DNS setup and explain the …
- Distinctive: line 80
If the repository already contains deploy workflows, extend them rather than adding a conflicting second pipeline.
- Very specific: line 81
If multiple hostnames are needed, keep them in one routes array unless there is a clear need for separate Workers.
- Distinctive: line 94
When finishing a task with this skill, report:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cj-cloudflare-worker
Create Workers in-place inside an existing repository. Preserve the repo's package manager, language, build system, and directory layout instead of replacing the project with a starter.
Retrieval First
Cloudflare configuration changes often. Retrieve current docs before making or reviewing production changes for:
- Wrangler configuration:
https://developers.cloudflare.com/workers/wrangler/configuration/ - Custom domains:
https://developers.cloudflare.com/workers/configuration/routing/custom-domains/ - Durable Object migrations:
https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/ - API token templates and permissions:
https://developers.cloudflare.com/fundamentals/api/reference/template/
Load ./references/checklist.md for the execution flow. Load ./references/patterns.md for file patterns and token guidance.
Workflow
- Inspect the repository first.
- Detect the package manager from the lockfile.
- Find the app entrypoint, build command, static output directory, and any existing Cloudflare files.
- Read existing GitHub workflows before adding new ones.
- Prefer adapting the current project over introducing a parallel structure.
- Resolve the minimum missing deployment inputs.
- Production Worker name.
- Preview Worker name or preview environment name.
mainscript path and optional static assets directory.- Production branch. Default to
main. - Hostnames to attach and which zones are managed in Cloudflare.
- Whether preview deploys should run on pull requests, a preview branch, or both.
- Whether Durable Objects are needed and what state they hold.
- Add or update
wrangler.jsonc.
- Use
./assets/wrangler.custom-domain.jsoncfor a normal Worker. - Use
./assets/wrangler.durable-object.jsoncwhen the Worker needs a Durable Object. - Keep the repo's real entrypoint and build output paths.
- Set
compatibility_dateto the current date unless the repo already pins an older baseline for compatibility reasons. - Use one route object per hostname.
- Use
custom_domain: trueonly for hostnames inside Cloudflare-managed zones. - If the Worker should sit in front of an existing origin on only part of a hostname, use a route pattern instead of a custom domain.
- Keep
env.previewseparate from production so preview deploys do not overwrite the primary Worker.
- Add the Worker runtime changes.
- Preserve the repository's JS or TS conventions.
- If the app is mostly static, route the Worker to the built assets directory instead of replacing the build system.
- If a Durable Object is requested, use SQLite-backed Durable Objects for new classes by default.
- Add a migration entry whenever introducing a Durable Object class.
- Do not attempt to convert an already deployed KV-backed Durable Object to SQLite in place.
- Add GitHub Actions deployment.
- Start from
./assets/deploy-worker.yml. - Add
./assets/deploy-worker-preview.ymlonly when preview deploys are requested. - Keep Node on GitHub Actions as the default runtime unless the repo clearly uses something else.
- Adapt install commands to the lockfile:
npm ci,pnpm install --frozen-lockfile,yarn install --frozen-lockfile, or the repo's existing install wrapper. - Reuse existing composite actions or shared setup steps when the repo already has them.
- Keep the preview workflow guard that skips pull requests from forks so secrets are not exposed.
- Request credentials and wire secrets.
- Ask for a Cloudflare API token with the minimum needed permissions for Workers and DNS changes.
- Default local storage to a repo-local, gitignored
.envfile unless project conventions prefer.dev.vars. - Create or update
.env.exampleusing./assets/cloudflare.env.example. - Mirror the same values in GitHub Actions secrets:
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_ID. - Never commit live secrets.
- Verify without assuming deploy access.
- Validate JSONC shape, workflow syntax, and package scripts locally.
- Only run
wrangler deploywhen the user explicitly wants a live deploy or credentials are already provided. - If a preview workflow is added, verify that the PR comment step updates an existing bot comment instead of spamming new comments.
Decision Rules
- Prefer custom domains over legacy wildcard routes when the Worker should own the entire hostname.
- Prefer
workers.devpreview deployments unless the user explicitly asks for preview custom domains. - If a hostname belongs to a zone not managed in the current Cloudflare account, stop short of claiming automatic DNS setup and explain the external DNS action needed.
- If the repository already contains deploy workflows, extend them rather than adding a conflicting second pipeline.
- If multiple hostnames are needed, keep them in one
routesarray unless there is a clear need for separate Workers. - For private repositories, bias toward GitHub Actions with repo secrets over local-only deployment steps.
Assets
./assets/wrangler.custom-domain.jsonc./assets/wrangler.durable-object.jsonc./assets/deploy-worker.yml./assets/deploy-worker-preview.yml./assets/cloudflare.env.example
Response Shape
When finishing a task with this skill, report:
- Files created or changed.
- Required GitHub secrets.
- Any unresolved hostname, zone, or credential assumptions.
- What was verified locally and what was not run.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

