codebam/hermes-skills/cloudflare-workers
Claude Code and agent skill by codebam/hermes-skills
- community
Checking that the SKILL.md file is still in the repository.
Develop/debug Cloudflare Workers; verify UI in browser.
Install
npx vskill@latest install codebam/hermes-skills/cloudflare-workersSKILL.md
The same SKILL.md was published earlier as codebam/hermes-skills/cloudflare-workers.
Cloudflare Workers (Hono) development
When to Use
Use when building, debugging, or reviewing any Hono / @cloudflare/workers project that runs under wrangler dev — especially ones with inlined HTML templates, a UI to interact with (paste/submit/copy), or that serve multiple domains from one worker. Triggers: a "fix doesn't take effect after build", wrong absolute URL returned, or copy button that silently does nothing.
How to build, debug, and—critically—verify Hono-based Cloudflare Workers before pushing. The user operates live workers on multiple domains and expects UI/workflow fixes proven in a browser, not just a passing tsc.
Verify in a real browser BEFORE pushing/deploying (mandatory)
Do NOT conclude a fix works from tsc / npm run build alone — a transpile pass proves nothing about runtime behaviour. Reproduce the bug and prove the fix against the actual served page:
- Reproduce on the live site first (inspect the served HTML/JS for the bug).
- Fix the source, then rebuild and re-serve via
npx wrangler dev --port <p>. - Drive a headless browser (browser_navigate/console/snapshot tools, or
Playwright) to: type → submit → read the returned URL → click every copy button → assert the success notification / class change → measure layout (e.g. input.right vs button.left for overlap).
- Only after the in-browser check passes, commit and push.
This machine already runs google-chrome (user's live browser) and a headless chromium with --remote-debugging-port=9222 for automation — browser tooling is available, so use it rather than guessing.
Build-system trap: inline-import silently inlines STALE HTML
The common Hono worker setup inlines HTML as strings:
esbuild's inline-import plugin resolves ./index.html relative to the compiled entry file (e.g. dist/index.js), so it reads dist/index.html, NOT src/index.html. If dist/ isn't regenerated with the current src/ HTML before esbuild runs, the deployed bundle keeps whatever stale HTML was last copied there — changes to src/*.html appear to "not take effect".
Fix the build script to copy the HTML into the same dir esbuild reads from, before both tsc and esbuild:
dist/ is usually gitignored; only src/ is the source of truth.
Multi-domain: build URLs dynamically from the request
If one worker serves several domains (e.g. p.example.com and paste.example.com) and returns absolute URLs, the reply must match the domain THE CLIENT USED.
Two independent layers break this:
- Hardcoded frontend fetch — the page JS calls
fetch('https://p.example.com')
unconditionally, so every paste URL comes back as that domain no matter which site you're on. Fix: POST/fetch same-origin (fetch('/')).
- Wrong origin on the server —
new URL(c.req.url).origincan be the wrong
host/scheme behind Cloudflare. Construct the origin from the request headers the edge actually sets:
Use it for every route that returns a URL (POST /, POST /:id, move, etc.). Quick curl confidence check for the server layer:
Copy-button / clipboard pitfalls
- Inline `onclick` needs a GLOBAL function.
<button onclick="copyToClipboard()">
resolves against window. If copyToClipboard is declared inside a document.addEventListener('DOMContentLoaded', function(){...}) closure, the handler throws ReferenceError: copyToClipboard is not defined — the classic "button does nothing" bug. Define inline-handler functions at global scope, or attach the listener via addEventListener inside the closure. Do not mix both.
- `navigator.clipboard.writeText` fails in real browsers when the tab is
unfocused or permission is denied (NotAllowedError). Provide a fallback to a hidden textarea + document.execCommand('copy'), and prefer it when !navigator.clipboard || !window.isSecureContext. Wrap the fallback so done() always runs.
wrangler dev caveats
wrangler devruns thebuild.commandfromwrangler.toml(`npm install &&
npm run build) on change, but it does not reliably rebuild HTML-only edits — after touching src/*.html`, restart the dev server to be sure it serves the current code rather than assuming the watcher caught it.
- Start the dev server in the background and poll its log / `curl -o /dev/null -w
"%{http_code}" until you see Ready on http://localhost:<port> and a 200`.
- Built endpoint behaviour (URL domains, headers) is best checked with
curl
first; frontend interactivity (clicks, clipboard, layout) with a browser.
References
references/pastebin-r2-debug.md— full worked case: dual-domain pastebin,
the stale-HTML cause, the inline-onclick ReferenceError, and the exact browser-verification sequence used.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/web-development/cloudflare-workers/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/codebam/hermes-skills/cloudflare-workers)