Skip to content

Instantly share code, notes, and snippets.

@vlasky
Last active February 9, 2026 01:34
Show Gist options
  • Select an option

  • Save vlasky/2033c02cb729af93197e5dd21e63a039 to your computer and use it in GitHub Desktop.

Select an option

Save vlasky/2033c02cb729af93197e5dd21e63a039 to your computer and use it in GitHub Desktop.
Teach Claude Code or other agentic tools how to copy text to your local clipboard. Add this to CLAUDE.md or AGENTS.md.
# Clipboard

To copy text to the local clipboard, pipe data to the appropriate command.

## Local shells
- macOS: `echo "text" | pbcopy`
- Linux (X11): `echo "text" | xclip -selection clipboard`
- Windows: `echo "text" | clip`
- WSL2: `echo "text" | clip.exe`

## SSH / remote shells
When running over SSH, use OSC 52 to write to the local clipboard:

`echo "text" | printf '\e]52;c;%s\a' "$(base64 | tr -d '\n')"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment