Agent skill

Cloudflare Composition Root

by dmmulroy in dmmulroy/skills

Composition roots for Hono and Cloudflare. An agent skill from dmmulroy/skills.

MITAuto-check passedDevelopment

Install Cloudflare Composition Root

skills CLI
$ npx skills add dmmulroy/skills --skill cloudflare-composition-root -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dmmulroy/skills cloudflare-composition-root --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dmmulroy/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cloudflare-composition-root .claude/skills/cloudflare-composition-root && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cloudflare-composition-root
GitHub stars
429
Token cost
~2.1k tokens
SKILL.md length
1,011 words
Files
2
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Composition roots for Hono and Cloudflare. An agent skill from dmmulroy/skills.

  • Works in 5 steps: Map the boundary → Design application-owned dependencies → Build or refactor → …
  • Adding a binding-backed service
  • SKILL.md covers Ownership, 1. Map the boundary, 2. Design application-owned… and 3. Build or refactor, plus 2 more sections
  • Calls rg

What it does

Cloudflare Composition Root is an agent skill from dmmulroy/skills. Composition roots for Hono and Cloudflare. Use when adding a binding-backed service or refactoring raw runtime dependencies out of inner code.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `EXAMPLES.md`).

It sits in Development, covering Refactoring. It works with Cloudflare and Hono. The licence is MIT.

When your agent uses it

  • Adding a binding-backed service
  • Refactoring raw runtime dependencies out of inner code

Example prompts

  • “/cloudflare-composition-root”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Map the boundary
  2. Design application-owned dependencies
  3. Build or refactor
  4. Compose every runtime surface
  5. Verify the seam

What it can do on your machine

Read from SKILL.md and the folder at commit 8603380. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • rg

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Cloudflare Composition Root loads about 2.1k tokens when it runs. Until then it costs about 43 tokens; SKILL.md has 1,011 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~43
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dmmulroy/skills at commit 8603380, republished under its MIT licence (© dmmulroy). 1,011 words, ~2,141 tokens.

Download SKILL.mdSave it as .claude/skills/cloudflare-composition-root/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
cloudflare-composition-root
description
Composition roots for Hono and Cloudflare. Use when adding a binding-backed service or refactoring raw runtime dependencies out of inner code.

Cloudflare Composition Root

Use a composition root: each runtime entrypoint turns raw Cloudflare capabilities into application-owned dependencies, assembles services, and invokes them. Inner code receives ports, never Env, raw bindings, framework service locators, or binding names.

text
Cloudflare entrypoint
  → tracer + parsed configuration
  → binding adapters
  → exact service dependencies
  → application service
  → protocol projection

Apply ../coding-standards/SKILL.md for TypeScript contracts, parsing, errors, side effects, and tests. When implementation shape is unclear, consult EXAMPLES.md for Hono, WorkerEntrypoint, adapter, and refactor templates.

Ownership

  • Entrypoint adapter: parses the external request/event, establishes invocation context, constructs dependencies, invokes a service, and projects its result.
  • Binding adapter: implements an application-owned port using KV, R2, D1, Durable Objects, Queues, service bindings, Workflows, or another external capability.
  • Application service: owns one use case's sequencing, fallback, retry, and best-effort policy.
  • Domain module: owns pure values and invariants.
  • Port: names exactly the capability a consumer needs; it does not mirror a Cloudflare API.

Raw platform values may exist only in composition roots and binding adapters. A binding adapter accepts the smallest platform capability, not all of Env.

1. Map the boundary

Inspect repository instructions and the affected:

  • Hono app factories, middleware order, route registration, and context types;
  • Worker, WorkerEntrypoint, Durable Object, Workflow, queue, and scheduled entrypoints;
  • Env declarations and every use of the relevant binding;
  • tracer creation, correlation, error reporting, and detached-work ownership;
  • existing services, adapters, ports, tests, and architecture checks.

Trace each affected behavior from entrypoint to side effect and caller-visible result. For refactors, record current error, retry, fallback, serialization, and tracing behavior before moving it.

Completion criterion: Every affected entrypoint, binding consumer, behavior, lifecycle, side effect, failure policy, and existing test seam is accounted for.

2. Design application-owned dependencies

Define contracts from consumer needs:

ts
/** Persistence capability required by document application services. */
export interface DocumentStore {
  /** Find one document by its domain ID. */
  find(id: DocumentId): Promise<Document | null>;
  /** Persist one valid document. */
  save(document: Document): Promise<void>;
}

/** Exact dependencies of the publish-document use case. */
export type PublishDocumentDependencies = Readonly<{
  documents: DocumentStore;
  clock: Clock;
  tracer: Tracer;
}>;

Rules:

  • Use domain inputs and parsed outputs, not raw keys, strings, request objects, or binding options.
  • Expose only operations required by real callers.
  • Keep each service's dependency object exact; never create a shared mega-bag or rename Env to Dependencies.
  • Put platform serialization, keyspaces, pagination tokens, TTLs, metadata, and output parsing in the binding adapter.
  • Let the application service own policy. The adapter translates failures precisely enough for the service to distinguish recoverable conditions from corruption and defects.
  • Inject Tracer into services and adapters that create spans; do not add it to every method signature.
  • Add an application-owned factory only when scope is genuinely dynamic after composition, such as account-bound construction after authentication. The factory must not expose Env or raw bindings.

Choose lifetimes explicitly:

  • Reuse immutable adapters and services when their bindings and tracer are safe across concurrent invocations.
  • Construct per invocation when they retain request-scoped runtime objects or mutable invocation state.
  • Hand detached work to an explicit owner such as a narrow background-task port; do not leak ExecutionContext inward.

Completion criterion: Every inner signature uses application/domain types; each operation and factory has a current caller; and dependency, tracer, and side-effect lifetimes have explicit owners.

3. Build or refactor

New service branch
  1. Implement the application service against its ports without importing Hono or Cloudflare runtime types.
  2. Implement one binding adapter per external role. Give technology-specific implementations explicit names, such as WorkersKvDocumentStore.
  3. Keep protocol concerns in the HTTP, RPC, queue, Workflow, or scheduled adapter.
  4. Compose the service at every entrypoint that serves the use case.
Show full SKILL.md (486 more words)Show less
Existing code branch
  1. Preserve caller-visible behavior with tests at the current public seam where evidence is missing.
  2. Define the port at the direct consumer from the operations it already uses.
  3. Put the existing raw binding behind an adapter before changing policy.
  4. Replace the direct consumer's raw dependency with the port.
  5. Move adapter construction outward one layer at a time. Intermediate layers may pass the typed port, never both the port and raw binding as a permanent design.
  6. Split mixed modules: policy moves to the application service; platform mechanics move to the adapter; protocol mapping stays at the entrypoint.
  7. Remove obsolete Env parameters, factories, generic wrappers, duplicated parsers/key builders, and compatibility overloads after their final callers move.

Do not broaden the refactor to unrelated bindings merely for symmetry.

Completion criterion: New code is fully composed on every serving surface, or every migrated raw binding reaches only its adapter; behavior and policy changes are either absent or explicitly requested and tested.

4. Compose every runtime surface

At each composition root, in order:

  1. Parse configuration and entrypoint props.
  2. Create or obtain the tracer.
  3. Establish correlation before invoking traced work.
  4. Wrap raw bindings in adapters, injecting the tracer where needed.
  5. Assemble exact service dependencies.
  6. Invoke the service through a thin protocol adapter.
  7. Map results and safe errors to the external contract.

For Hono:

  • Prefer createApp(dependencies) and route/middleware factories that close over exact dependencies.
  • Inject the tracer used by root tracing middleware instead of creating unrelated tracers deeper in the app.
  • If dependencies are invocation-scoped, have the entrypoint supply a narrow request-composition function that closes over raw bindings; invoke it from the earliest owning middleware after correlation is established.
  • Store only exact typed capabilities in Hono variables. Neither composition middleware nor route modules reach through context.env for raw bindings.

For WorkerEntrypoint, Durable Objects, Workflows, queues, and scheduled handlers, treat each runtime constructor or handler as its own composition root. Do not assume one surface's dependency graph or lifecycle fits another.

Completion criterion: Every serving surface establishes tracing and constructs the complete dependency graph; no inner module acquires runtime resources or reads a binding name.

5. Verify the seam

Verify through production seams:

  • application-service behavior with small recording fakes implementing real ports;
  • binding-adapter serialization, parsing, and failures against the representative local Cloudflare runtime;
  • entrypoint composition and external result/error projection;
  • span names, correlation, safe attributes, and detached-work ownership;
  • type checking, focused tests, architecture checks, and repository-required validation.

Search for leakage using the project's binding names and runtime types, for example:

bash
rg 'Env|KVNamespace|R2Bucket|D1Database|DurableObjectNamespace|ExecutionContext' src

Classify every match: composition root, binding adapter, unavoidable framework declaration, or violation. Also search for direct context.env and binding-name access in route, service, domain, and capability modules.

Completion criterion: Every raw platform reference is classified and permitted; every changed port, adapter, service, entrypoint, failure path, and lifecycle has evidence; and no application module imports or receives Cloudflare runtime types.

© dmmulroy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in cloudflare-composition-root of dmmulroy/skills.

  • SKILL.md
  • EXAMPLES.md

Open the folder on GitHubat commit 8603380

Compare with similar skills

Cloudflare Composition Root next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Cloudflare Composition Root compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Cloudflare Composition Root this skilldmmulroy/skills429—~2.1kAutomated safety check: PassMIT
Develop Microfeedmicrofeed/microfeed4.1k—~2.1kAutomated safety check: PassAGPL-3.0
Vite Flare Starterjezweb/claude-skills1.1k—~2.6kAutomated safety check: PassMIT
Typescript Idiomsirahardianto/awesome-agv157—~6.1kAutomated safety check: PassMIT
Cloudflare WorkersEpicenterHQ/epicenter4.8k—~576Automated safety check: PassCustom licence
HonoEpicenterHQ/epicenter4.8k—~513Automated safety check: PassCustom licence

Similar skills

  • Develop Microfeed

    microfeed/microfeed

    Develop and contribute changes to the microfeed repository safely from branch creation through validation, commit, push, and draft pull request.

    4.1k GitHub stars~2.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Vite Flare Starter

    jezweb/claude-skills

    Scaffold a full-stack Cloudflare app from the vite-flare-starter template — React 19 + Hono + D1+Drizzle + better-auth + Tailwind v4+shadcn/ui + TanStack Query + R2 + Workers AI.

    1.1k GitHub stars~2.6k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Typescript Idioms

    irahardianto/awesome-agv

    TypeScript strict typing: type narrowing, discriminated unions, Zod runtime validation, generic utility types, and Vitest testing.

    157 GitHub stars~6.1k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Cloudflare Workers

    EpicenterHQ/epicenter

    Cloudflare Workers patterns for Worker runtime APIs, Durable Objects, KV, R2, D1, Queues, WebSockets, streaming responses, bindings, wrangler configuration, and deployment limits.

    4.8k GitHub stars~576 tokensUpdated today
    Backend & APIsAuto-check passed
  • Hono

    EpicenterHQ/epicenter

    Hono patterns for TypeScript API routes, middleware, request and response typing, streaming, WebSockets, and Cloudflare Workers deployment.

    4.8k GitHub stars~513 tokensUpdated today
    Backend & APIsAuto-check passed
  • Sentry Cloudflare SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Cloudflare Workers and Pages. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~5.3k tokensUpdated today
    Productivity & AutomationAuto-check passed

More from dmmulroy/skills

  • Effect Service Design

    dmmulroy/skills

    Design Effect services. An agent skill from dmmulroy/skills.

    429 GitHub stars~1.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Herdr

    dmmulroy/skills

    Control Herdr, a terminl multiplexer for coding agents. An agent skill from dmmulroy/skills.

    429 GitHub stars~2.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Coding Standards

    dmmulroy/skills

    Correct-by-construction TypeScript standards. An agent skill from dmmulroy/skills.

    429 GitHub stars~8.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Prelude

    dmmulroy/skills

    Prelude bootstrapping for TypeScript. An agent skill from dmmulroy/skills.

    429 GitHub stars~1.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Tech Spec

    dmmulroy/skills

    Write a typed call-stack architecture handoff. An agent skill from dmmulroy/skills.

    429 GitHub stars~2.1k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Categories

Questions about Cloudflare Composition Root

What does Cloudflare Composition Root do?

Composition roots for Hono and Cloudflare. An agent skill from dmmulroy/skills. Cloudflare Composition Root is an agent skill from dmmulroy/skills. Composition roots for Hono and Cloudflare.

When should I use Cloudflare Composition Root?

Cloudflare Composition Root fits situations like: adding a binding-backed service; refactoring raw runtime dependencies out of inner code.

How do I install Cloudflare Composition Root in Claude Code?

Run `npx skills add dmmulroy/skills --skill cloudflare-composition-root -a claude-code`. Or copy the skill folder (cloudflare-composition-root in dmmulroy/skills) into .claude/skills/cloudflare-composition-root in your project. Claude Code loads it when a task matches its description.

How do I install Cloudflare Composition Root in Codex?

Run `npx skills add dmmulroy/skills --skill cloudflare-composition-root -a codex`. Or copy the skill folder (cloudflare-composition-root in dmmulroy/skills) into .agents/skills/cloudflare-composition-root in your project. Codex loads it when a task matches its description.

Can I use Cloudflare Composition Root in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dmmulroy/skills --skill cloudflare-composition-root -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cloudflare-composition-root, .gemini/skills/cloudflare-composition-root, .github/skills/cloudflare-composition-root and .opencode/skills/cloudflare-composition-root in your project.

What does Cloudflare Composition Root need to run?

Going by SKILL.md and its folder, Cloudflare Composition Root needs the command-line tools its instructions call (rg).

Does Cloudflare Composition Root access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Cloudflare Composition Root safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Cloudflare Composition Root use?

Cloudflare Composition Root is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Cloudflare Composition Root use?

About 2.1k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Cloudflare Composition Root?

Skills that share tags, products or a category with Cloudflare Composition Root: Develop Microfeed (microfeed/microfeed, 4.1k stars), Vite Flare Starter (jezweb/claude-skills, 1.1k stars), Typescript Idioms (irahardianto/awesome-agv, 157 stars) and Cloudflare Workers (EpicenterHQ/epicenter, 4.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Cloudflare Composition Root?

dmmulroy (a GitHub user) maintains it in dmmulroy/skills, which has 429 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on July 23, 2026.

Source: dmmulroy/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.