# Clipboard

> Auto-copy code, commands, and shareable content to system clipboard. Proactively copies paste-worthy output; manually invoke with /copy.

- Skill: `monkeyleet/clipboard` (Agent Skill)
- Install (CLI): `npx skillmds@latest add monkeyleet/clipboard`
- Raw SKILL.md: https://api.skillmd.com/api/skills/monkeyleet/clipboard/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: MonkeyLeeT (https://skillmd.com/u/monkeyleet)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/monkeyleet/clipboard

---


# Clipboard

Auto-copy to system clipboard, either proactively or via `/copy`.

## Auto-copy (no prompt needed)

Copy automatically when output is clearly paste-worthy:
- Commit messages, PR descriptions
- Code snippets user asked to "write" or "generate"
- Shell commands, curl, SQL queries (not executed)
- Config files, templates, dotfiles
- Critique/feedback meant for sharing

Append `(Copied to clipboard)` when auto-copying.

## Don't auto-copy

- Explanations, tutorials, answers
- Code already written to files
- Conversation, options, suggestions

## Manual: /copy

- `/copy` - copy last response
- `/copy <text>` - copy specific text

## Rich text copy (for reports, analysis, structured content)

Plain text with markdown syntax (e.g. `*bold*`, `` ``` ``) does NOT render when pasted into rich text editors — Slack, Notion, Google Docs, email, Linear, etc. only parse markdown when *typed*, not pasted.

**Solution**: Set HTML on the clipboard. Rich text editors read `public.html` and render it natively.

### macOS: osascript JXA

```javascript
osascript -l JavaScript -e '
ObjC.import("AppKit");
var pb = $.NSPasteboard.generalPasteboard;
pb.clearContents;
var html = "<b>Title</b><br><pre>code block</pre>";
pb.setStringForType($(html), "public.html");
pb.setStringForType($("plain text fallback"), "public.utf8-plain-text");
'
```

Sets both HTML (for rich editors) and plain text (for terminals/plain editors) on the clipboard.

### HTML conversion rules

| GFM | HTML |
|-----|------|
| `## Header` | `<b>Header</b>` |
| `**bold**` | `<b>bold</b>` |
| `_italic_` | `<i>italic</i>` |
| `` `code` `` | `<code>code</code>` |
| ` ``` ` blocks | `<pre>...</pre>` |
| `- item` / `• item` | `• item<br>` (or `<ul><li>`) |
| Pipe tables | `<pre>` with manually aligned columns |
| `[text](url)` | `<a href="url">text</a>` |
| `---` | `<br>` |
| Newlines | `<br>` |
| `<` in content | `&lt;` (escape for HTML) |

### When to use rich vs plain

- **Rich (HTML)**: Reports, analysis, tables, anything with formatting meant for sharing
- **Plain (`pbcopy`)**: Code snippets, shell commands, URLs, raw text

## Platform commands

- macOS plain text: `pbcopy` / `pbpaste`
- macOS rich text: `osascript -l JavaScript` (NSPasteboard, see above)
- Linux: `xclip -selection clipboard`
- WSL: `clip.exe`

## Examples

```
User: Give me a curl to test the webhook
→ Plain text, use pbcopy

(Copied to clipboard)
```

```
User: /copy (after a markdown report with tables and bold)
→ Rich text, convert to HTML, use osascript JXA

(Copied to clipboard)
```

