_create-cloudflare-worker
Skill50 starsChanged 20 days agoApache-2.0View on GitHub
Internal helper invoked by /add-automation once Wrangler is installed and the project is a monorepo. Creates the apps/worker/ directory, scaffolds a Cloudflare Worker via wrangler init, optionally adds CRON triggers natively in wrangler.toml, implements scheduled+fetch handlers, and deploys. Returns the deployed worker URL. Not meant to be invoked directly by users.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- flavien-ia/hypervibe-craftword for word, first seen Oct 25, 2026
Other versions1 project uses a version of this.
Word for word · 1
- flavien-ia/hypervibe-craft★ 50100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository89 other files it gives its agents.
- accessibilitySkill
- add-2faSkill
- add-agent-dashboardSkill
- add-aiSkill
- add-analyticsSkill
- add-authSkill
- add-automationSkill
- add-backup-dbSkill
- add-collabSkill
- add-cronSkill
- add-dark-modeSkill
- add-dbSkill
- add-domainSkill
- add-emailSkill
- add-github-authSkill
- add-google-authSkill
- add-i18nSkill
- _add-keyringSkill
- add-mapSkill
- add-notification-centerSkill
- add-push-notificationSkill
- add-pwaSkill
- add-roleSkill
- add-routineSkill
- add-storageSkill
- add-stripeSkill
- add-testSkill
- bootstrapSkill
- _check-depsSkill
- cleanSkill
- _collect-secretSkill
- _convert-to-turborepoSkill
- _create-agentSkill
- _create-contact-pageSkill
- _create-render-workerSkill
- _create-routineSkill
- _create-workflowSkill
- delete-projectSkill
- _detect-project-rootSkill
- _dns-brevoSkill
- _dns-cloudflareSkill
- _dns-gandiSkill
- _dns-godaddy-manualSkill
- _dns-hostingerSkill
- _dns-infomaniak-manualSkill
- _dns-ionos-manualSkill
- _dns-lwsSkill
- _dns-namecheapSkill
- _dns-ovhSkill
- _dns-porkbunSkill
- _dns-resendSkill
- _dns-squarespace-manualSkill
- eco-auditSkill
- _ensure-aiSkill
- _ensure-vaultSkill
- _generate-secretSkill
- geoSkill
- _get-secretSkill
- gscSkill
- _hash-passwordSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Use plain, non-technical business language.
- Distinctive: line 24
When generating user-facing content for the scaffolded project (UI labels, emails, copy), write it in the user's language too.
- Very specific: line 34
If any of these are not true, refuse and tell the user to invoke /add-automation instead.
- Very specific: line 54
Read the project name from the root package.json:
- Distinctive: line 59
Read the Cloudflare account ID:
- Very specific: line 122
Make sure apps/worker/package.json has:
- Distinctive: line 142
If the deploy fails:
- Very specific: line 164
If NEEDS_CRON=yes, also tell the user:
≈ “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
⚠️ Before any call to wrangler (to be done BEFORE any other wrangler command in this skill)
eval "$(node "${CLAUDE_SKILL_DIR}/../../scripts/wrangler-env-init.mjs")"This line loads CLOUDFLARE_API_TOKEN from the User scope (Windows registry / shell rc on Mac/Linux) if it is not in process.env, and adds the pnpm bin to the PATH (for bash sessions where pnpm setup has not yet propagated). Without it, wrangler fails with "command not found" on Mac (Spotlight), or may use a different Cloudflare account than the one the user expects.
Create Cloudflare Worker - Internal helper
Communication
- Detect the user's language from the conversation (the user's own messages, anywhere in the session - not just this invocation: a bare slash command like
/bootstrapcarries no language signal by itself). If nothing in the conversation gives a signal, fall back to the OS locale (node -e "console.log(Intl.DateTimeFormat().resolvedOptions().locale)") before defaulting to English. ALWAYS reply in that language for every user-facing message: questions, progress, confirmations, summaries, errors - including any example text quoted in this skill, which is illustrative and must be translated, never sent verbatim. - Use plain, non-technical business language. Never expose internal script names (*.mjs) or jargon; describe actions in human terms.
- When generating user-facing content for the scaffolded project (UI labels, emails, copy), write it in the user's language too.
- Show progress as a short natural-language checklist (in-progress and done states).
You scaffold and deploy a Cloudflare Worker inside apps/worker/.
The caller (/add-automation) has already:
- Verified Wrangler is installed and authenticated (
_setup-wrangler) - Converted the project to a monorepo (
_convert-to-turborepo) - Decided whether the worker needs CRON triggers, and provided the cron expression if so
If any of these are not true, refuse and tell the user to invoke /add-automation instead.
The caller passes (or will tell you) two parameters:
NEEDS_CRON-yesornoCRON_EXPRESSION- a standard 5-field cron expression (only ifNEEDS_CRON=yes)
Step 1 - Scaffold the worker
mkdir -p apps/worker
cd apps/worker
pnpm dlx wrangler init . --yesThis creates a minimal Worker template with wrangler.toml, src/index.ts, and a package.json.
Step 2 - Configure wrangler.toml
Read the project name from the root package.json:
node -e "process.stdout.write(require('../../package.json').name)"Read the Cloudflare account ID:
wrangler whoami | grep -oE '[a-f0-9]{32}' | head -1Update apps/worker/wrangler.toml with:
name = "<project-name>-worker"
main = "src/index.ts"
compatibility_date = "<today's date in YYYY-MM-DD>"
account_id = "<account id>"If NEEDS_CRON=yes - add cron triggers
Append to wrangler.toml:
[triggers]
crons = ["<CRON_EXPRESSION>"]Step 3 - Implement the handlers
Replace apps/worker/src/index.ts with:
If NEEDS_CRON=yes (both fetch + scheduled handlers)
export interface Env {
// Add your environment variables here, e.g.:
// SOME_API_KEY: string;
}
export default {
async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext): Promise<void> {
// TODO: your scheduled task logic here
console.log("Cron triggered:", event.cron, "at", new Date().toISOString());
},
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
return new Response("Worker is running", { status: 200 });
},
};If NEEDS_CRON=no (just fetch handler)
export interface Env {
// Add your environment variables here
}
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
// TODO: handle incoming requests
return new Response("Worker is running", { status: 200 });
},
};Step 4 - Add scripts to apps/worker/package.json
Make sure apps/worker/package.json has:
{
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy",
"tail": "wrangler tail"
}
}Step 5 - Deploy
cd apps/worker
wrangler deployCapture the deployed URL from the output (looks like https://<project-name>-worker.<your-subdomain>.workers.dev).
If the deploy fails:
- Account ID error → re-run
wrangler whoamiand verify it's set inwrangler.toml - Already exists → that's fine, it's an update; the URL stays the same
- Quota exceeded → tell the user they may be near the 100k req/day free limit on another worker
Step 6 - Add the worker URL as an env var
So the Next.js app can call the worker via HTTP, invoke _push-env-vars with:
WORKER_URL=<worker URL from Step 5>
The helper writes to .env local AND pushes to Vercel (production/preview/development) in one operation.
Step 7 - Return to caller
Tell the user:
✅ Cloudflare Worker deployed.
URL:
<worker URL>Code:apps/worker/src/index.tsReal-time logs:pnpm --filter=worker tailLocal dev:pnpm --filter=worker dev
If NEEDS_CRON=yes, also tell the user:
The CRON is handled natively by Cloudflare via
[triggers]inwrangler.toml. Current schedule:<CRON_EXPRESSION>. To change it, editwrangler.tomland redeploy.
Return control to the calling skill (/add-automation). Pass back the worker URL so the orchestrator can include it in its final summary.
Resource manifest (always)
Every cloud resource this skill creates or adopts is recorded in the project resource manifest (.hypervibe/resources.json, versioned with the code) - it is what /save-project and /delete-project read first, instead of guessing resources by name. Run the recording right after the resource exists; it is idempotent, silent on success, and stores identifiers only (never secrets). Full reference: the _track-resource skill.
Record the worker right after the first successful deploy:
node "${CLAUDE_SKILL_DIR}/../../scripts/manifest/manifest.mjs" add --project-dir "<project-root>" \
--kind cf-worker --name "<worker-name>" --added-by <calling-skill>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.

