clipboard-fallback

clipboard-fallback is a skill for Claude Code from sailingnaturali/claude-skills. It costs 103 tokens per session (1,236 once invoked), scanned A, original, MIT.

A guide for implementing copy-to-clipboard in web apps that may run over plain HTTP. It explains why the modern browser Clipboard API works on HTTPS and localhost but can be unavailable on a LAN address.

In plain words
What is it for?
Use it to detect secure and insecure browser contexts, choose a fallback copy method, and debug clipboard failures on LAN, embedded, or other non-HTTPS interfaces.
Why use it?
It addresses the common case where a copy button works during local development but appears to do nothing on a device or server reached through HTTP.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the clipboard-fallback plugin — 1 skill shipped together

Good fit Use it to detect secure and insecure browser contexts, choose a fallback copy method, and debug clipboard failures on LAN, embedded, or other non-HTTPS interfaces.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sailingnaturali/claude-skills/clipboard-fallback
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sailingnaturali/claude-skills --skill clipboard-fallback
Clone the repo
git clone --depth 1 https://github.com/sailingnaturali/claude-skills

Made for: Claude Code.

Or install clipboard-fallback, the plugin that ships this one along with the rest of its 1 skill.

Wrote 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.

agentmods badge for clipboard-fallback

README.md
[![agentmods](https://agentmods.dev/badge/skills/sailingnaturali/claude-skills/clipboard-fallback/github.svg)](https://agentmods.dev/skills/sailingnaturali/claude-skills/clipboard-fallback)
Your own site
<a href="https://agentmods.dev/skills/sailingnaturali/claude-skills/clipboard-fallback"><img src="https://agentmods.dev/badge/skills/sailingnaturali/claude-skills/clipboard-fallback/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clipboard-fallback

Your own site · 80×15
<a href="https://agentmods.dev/skills/sailingnaturali/claude-skills/clipboard-fallback"><img src="https://agentmods.dev/badge/skills/sailingnaturali/claude-skills/clipboard-fallback.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 103 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,236 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00103 $0.01236
Opus 5.5 $0.00041 $0.00494
Sonnet 5.5 $0.00021 $0.00247
Haiku 4.5 $0.00010 $0.00124

Measured 2mo ago against content hash 95eb8206d003, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

clipboard-fallback scanned grade A with 0 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 2mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

clipboard-fallback/skills/clipboard-fallback/SKILL.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Copy to clipboard on plain-HTTP origins

The bug report is always the same: "the copy button does nothing on the device, but it works on my machine." Both observations are correct — and that's the trap. The async Clipboard API (navigator.clipboard) is exposed only in secure contexts: https://, plus localhost / 127.0.0.1 as a development carve-out. A UI served from http://<lan-ip> — how boat servers, routers, printers, and most embedded devices are actually reached — is not a secure context:

Origin (same server, same browser) isSecureContext typeof navigator.clipboard execCommand('copy')
http://127.0.0.1:4650 true object true
http://192.168.0.122:4650 false undefined true

So navigator.clipboard.writeText(...) on the LAN origin throws TypeError: Cannot read properties of undefined (reading 'writeText') — usually swallowed by a catch or an unhandled promise, which is why the button "does nothing". The legacy document.execCommand('copy') on a selected element still works in insecure contexts (verified on Chromium above; it is deprecated and best-effort, so treat its boolean return as the truth) — but it is the only copy path a plain-HTTP origin has.

The recipe

async function copyText(text) {
  if (window.isSecureContext && navigator.clipboard) {
    try {
      await navigator.clipboard.writeText(text)
      return true
    } catch {
      // permission denied / focus lost — fall through to the legacy path
    }
  }
  const ta = document.createElement('textarea')
  ta.value = text
  ta.setAttribute('readonly', '')
  ta.style.position = 'fixed'
  ta.style.opacity = '0'
  document.body.appendChild(ta)
  ta.focus()
  ta.select()
  ta.setSelectionRange(0, text.length) // iOS Safari wants an explicit range
  let ok = false
  try {
    ok = document.execCommand('copy')
  } catch {
    // ok stays false
  }
  document.body.removeChild(ta)
  return ok
}

Read the full file on GitHub · 93 lines

Changes

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.

  1. 2mo ago First seen · 93 lines · 103 tokens per session scan A 95eb8206d003

Subscribe to this mod's changes

clipboard-fallback is a skill published in the GitHub repository sailingnaturali/claude-skills (3 stars, last pushed 4d ago), licensed MIT. It adds 103 tokens to every session and 1,236 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.

Related

clipboard-fallback compared with skills from other repositories

clipboard-fallback next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
clipboard-fallbacksailingnaturali/claude-skillsSkill34d agoMITA103Claude Code
systematic-debuggingopen-metadata/OpenMetadataSkill16ktodayApache-2.0A37Claude Code
log-error-digestzebbern/claude-code-guideSkill4.7ktodayMITA71Claude Code, Codex
observability-audit-sessionsIBM/mcp-context-forgeSkill4.9ktodayApache-2.0A64Claude Code, Codex
cwv-optimizeradobe/skillsSkill342todayApache-2.0A112Claude Code
ci-fixersipyourdrink-ltd/bernsteinSkill1.2ktodayApache-2.0A15Claude Code, Codex
diagnosing-missing-recordingsPostHog/posthogSkill41ktodaynoneA76Claude Code, Codex