Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/humanerd-drew/opencode-drewgentnpx agentmods add skills/humanerd-drew/opencode-drewgent/cf-worker-restructuringWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/cf-worker-restructuring)<a href="https://agentmods.dev/skills/humanerd-drew/opencode-drewgent/cf-worker-restructuring"><img src="https://agentmods.dev/badge/skills/humanerd-drew/opencode-drewgent/cf-worker-restructuring.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00040 | $0.07645 |
| Opus 5 | $0.00020 | $0.03823 |
| Sonnet 5 | $0.00008 | $0.01529 |
| Haiku 4.5 | $0.00004 | $0.00764 |
Grade C, and why
cf-worker-restructuring scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Downloads and executes remote codehighSupply chain
curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.
curl -s "http://localhost:8787/api/..." | python3 -c "import sys,json; d=json.load(sys.stdin); print('OK' if d.get('success') else d)" Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
**⚠️ Workflow rule: Root cause before workaround.** When an API call fails, prove the infrastructure works first (test with direct curl) before changing logic. The user corrected this: *"키는 정상인데 왜 에러인거지? 딥식을 먼저 쓰는게 해결책은 How it starts
The opening of the file, as written. The whole thing — 579 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CF Worker Restructuring
Overview
Cloudflare Workers monoliths (a single worker.ts handling all routes) inevitably grow beyond maintainability. This skill provides a repeatable process for restructuring them into controller-based architecture: a thin router dispatching to per-domain controller modules.
The process emphasizes verification at every step via live wrangler dev and understanding the full dependency graph before touching any code.
When to Use
worker.tsexceeds 400 lines with inline route handlers- Multiple API domains (auth, analysis, history, reports) coexist in one file
- Shared constants/data (천간/지지/오행) are duplicated across frontend and backend
- Dead files accumulate (
saju-data.js,ganji.js, orphanedsrc/api.ts) - Frontend computes data that the backend should pre-calculate
Do NOT use for:
- Simple routing changes (use
patchdirectly) - Adding new routes to an already-clean structure
- UI-only refactoring
Step 1 — Map Current State
Before any code changes, build a complete map:
# All routes in worker.ts
grep -n "url.pathname ===\|url.pathname.startsWith" worker.ts
# All controller exports (if splitting)
for f in src/controllers/*.ts; do
echo "$(basename $f): $(grep "^export async function" $f | sed 's/.*function //;s/(.*//' | tr '\n' ' ')"
done
# All env vars
grep -n "env\\." worker.ts | grep -o "env\\.[A-Z_]*" | sort -u
Key principle: Understand the full dependency graph before making any changes. The user will correct you if you miss something — capture those corrections.
⚠️ Workflow rule: Systematic inventory before fix. When something fails (e.g., a timeout, a missing dependency), do NOT propose a piecemeal workaround ("change the order so it uses X instead"). Instead, first find ALL components that share the same pattern, understand their purpose and intent, then design a unified fix. The user explicitly corrected this: "단편적인 해결 방안 말고, llm을 호출하는 애들을 찾아서 그 목적과 의도를 파악하고 해결 방안을 찾아야지."
What ships with it
4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3d ago First seen · 579 lines · 0 tokens per session scan C cf571d83e7bc
cf-worker-restructuring is a skill published in the GitHub repository humanerd-drew/opencode-drewgent (2 stars, last pushed 1mo ago), licensed MIT. It adds 40 tokens to every session and 7,645 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
stripe-projects
Provision SaaS services + sync creds via Stripe Projects.
azure-eventhub-dotnet
Azure Event Hubs SDK for .NET. Use for high-throughput event streaming: sending events (EventHubProducerClient, EventHubBufferedProducerClient), receiving events (EventProcessorClient with checkpointing), partition management, and real-time data ingestion. Triggers: "Event Hubs", "event streaming"…
azure-mgmt-botservice-dotnet
Azure Resource Manager SDK for Bot Service in .NET. Management plane operations for creating and managing Azure Bot resources, channels (Teams, DirectLine, Slack), and connection settings. Triggers: "Bot Service", "BotResource", "Azure Bot", "DirectLine channel", "Teams channel", "bot management .NET", "create bot".
workers-best-practices
Cloudflare Workers best practices for production applications. Use when writing, reviewing, or configuring Workers.
django-storages-s3
Use when configuring Django to store static and media files on AWS S3 with django-storages. Invoke when working with the STORAGES setting, S3 buckets, presigned URLs, CloudFront, or boto3-backed file storage in settings.py. Configures the Django 4.2+ STORAGES dict, public/private custom backends, presigned GET/POST…
wikipedia
Search and read Wikipedia via x wkp — MediaWiki API, no API key, zero install; query, extract, suggest, and DDG route in one module. Load for wiki, wikipedia, encyclopedia lookup, article summary.