agentleFS
jcottamjcottam/agent-resources/skills/publishing/host/SKILL.md

host

Skill25 starsChanged 6 months agoMITView on GitHub

Upload files to Cloudflare R2 and return a shareable public URL. Supports any file type (HTML, images, PDFs, etc.) with automatic slug generation, clipboard copy, and hosting history tracking. Use when the user says "host", "host this", "host file", "publish", "publish this", "share this file", "upload to R2", "make this public", "get a shareable link", "deploy this file", "put this online", or any variation of wanting to make a file publicly accessible via URL.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. matthewdonsemail-lab/log★ 63same name

    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 repository13 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Check if wrangler is available:

    line 34
  2. Distinctive:

    If not installed, install it globally:

    line 40
  3. Very specific:

    If not authenticated, the user must run wrangler login interactively (opens a browser for OAuth).

    line 54
  4. Very specific:

    Look for ~/.publish.json. If it doesn't exist, run $SCRIPTS/setup.sh and walk the user through the prompts.

    line 58
  5. Very specific:

    If the file exists, read it and parse the bucket and publicBaseUrl values.

    line 67
  6. Distinctive:

    If the user specified a file path, use that.

    line 73
  7. Distinctive:

    If the user said "host this" without a path, check for:

    line 74
  8. Distinctive:

    Verify the file exists before proceeding.

    line 77
  9. Distinctive:

    User override: if the user provided a custom name, use it instead (sanitized).

    line 88
  10. Distinctive:

    Run the host script:

    line 93
  11. Distinctive:

    If the script exits non-zero, report the error to the user.

    line 110
  12. Distinctive:

    After a successful upload:

    line 118
  13. Very specific:

    Use $SCRIPTS/history.sh to interact with the local hosting history at ~/.publish-history.json.

    line 133
  14. Distinctive:

    When the user asks to see their hosting history, list recent uploads, or find a previously hosted file, use the appropriate history command.

    line 142

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Host

Upload any file to Cloudflare R2 and get back a shareable public URL.

SCRIPTS below refers to the scripts/ directory next to this file.

Prerequisites

  • Wrangler CLI — the Cloudflare developer CLI used for all R2 operations
  • Cloudflare account with an R2 bucket that has public access enabled (r2.dev subdomain or custom domain)
  • Wrangler authenticated via one of:
    • wrangler login (interactive OAuth — run once, token persists in ~/.wrangler)
    • CLOUDFLARE_API_TOKEN environment variable

Step 1 — Check prerequisites

Wrangler installation

Check if wrangler is available:

wrangler --version

If not installed, install it globally:

npm install -g wrangler

Wrangler authentication

Verify auth status:

wrangler whoami

If not authenticated, the user must run wrangler login interactively (opens a browser for OAuth). This is a one-time step.

Host configuration

Look for ~/.publish.json. If it doesn't exist, run $SCRIPTS/setup.sh and walk the user through the prompts. The setup script creates the config file with:

{
  "bucket": "my-bucket-name",
  "publicBaseUrl": "https://pub-xxx.r2.dev"
}

If the file exists, read it and parse the bucket and publicBaseUrl values. Both are required.

Step 2 — Identify the asset

Determine what file to host from context:

  1. If the user specified a file path, use that.
  2. If the user said "host this" without a path, check for:
    • A file the user is currently viewing or recently created
    • A .canvas.tsx output or generated HTML file from the current session
  3. Verify the file exists before proceeding. If ambiguous, ask the user to clarify.

Step 3 — Generate the key

Decide the R2 object key (the path within the bucket):

  • Default: derive a readable slug from the filename.
    • Strip extension, lowercase, replace spaces and special characters with hyphens
    • Append today's date: my-report-2026-05-15
    • Re-attach the original file extension
    • Example: Sales Report Q1.html becomes sales-report-q1-2026-05-15.html
  • User override: if the user provided a custom name, use it instead (sanitized).
  • Collision check: scan ~/.publish-history.json for the key. If it exists, ask the user whether to overwrite or append a suffix (-2, -3, etc.).

Step 4 — Upload

Run the host script:

$SCRIPTS/host.sh <file-path> [--key <custom-key>]

The script:

  1. Reads ~/.publish.json for bucket name and public URL base
  2. Detects the content type from the file extension
  3. Uploads via wrangler r2 object put <bucket>/<key> --file <path> --content-type <type> --remote
  4. Constructs the public URL: <publicBaseUrl>/<key>
  5. Copies the URL to the clipboard (pbcopy on macOS, xclip/xsel on Linux)
  6. Appends an entry to ~/.publish-history.json
  7. Outputs JSON with url, key, contentType, size, and publishedAt

Important: The --remote flag is required. Without it, Wrangler uploads to a local R2 simulator instead of the actual Cloudflare R2 bucket.

If the script exits non-zero, report the error to the user. Common issues:

  • Wrangler not installed: suggest npm install -g wrangler
  • Not authenticated: suggest running wrangler login
  • Bucket not found: confirm the bucket name in ~/.publish.json and that public access is enabled
  • File not found: re-check the file path

Step 5 — Report

After a successful upload:

  1. Print the public URL prominently.
  2. Confirm the URL was copied to the clipboard.
  3. Mention the entry was added to history.

Example output:

Hosted: https://pub-xxx.r2.dev/sales-report-q1-2026-05-15.html
Copied to clipboard.

History

Use $SCRIPTS/history.sh to interact with the local hosting history at ~/.publish-history.json.

CommandDescription
history.sh listShow the 10 most recent uploads
history.sh list --allShow all uploads
history.sh search <query>Filter entries by key or local path
history.sh pruneRemove entries whose R2 objects no longer exist

When the user asks to see their hosting history, list recent uploads, or find a previously hosted file, use the appropriate history command.

Custom domains

For setting up a custom domain instead of the default r2.dev URL, see references/custom-domain.md.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.