agentleFS
jinhuang712jinhuang712/claude-code-clip/SKILL.md

clip

Skill0 starsChanged 4 months agoMITView on GitHub

把文件放进 macOS 剪贴板——默认放「文件本体」(⌘V 在 Finder / Lark / 邮件里直接粘出文件),也能放文件正文或绝对路径。同一份能力既是 Claude 命令也是终端 CLI(`clip`)。 触发:「/clip」「放到剪贴板」「复制到剪贴板」「拷进剪贴板」「clipboard」「拷贝这个文件」「把文件给我」「pbcopy」

  • Pipes a download into a shell

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

clip — 把文件放进 macOS 剪贴板

一句话:clip <path> 之后按 ⌘V,粘出来的是文件,不是一段文字。 自包含:一个 bash 前端 + 一个 AppleScript-ObjC 后端,都在 scripts/,零外部依赖。

用法

/clip <path> [path...]

三种模式,默认第一种:

模式命令⌘V 粘出什么
文件本体(默认)clip <path>一个文件,可双击打开、可当附件
文件正文clip -t <path>纯文本,等于把文件内容摊开
绝对路径clip -p <path>一行路径字符串

辅助:

命令作用
clip -t从 stdin 读(git diff | clip -t)
clip -s只看剪贴板现在装的是什么,不改动
clip -h帮助

多文件一次放:clip a.html b.md → ⌘V 粘出两个文件。

Claude 侧怎么执行

用户说 /clip <path> 或「把这个文件放到剪贴板」时:

拿到用户给的路径
  ├─ 相对路径 → 按当前工作目录解析(脚本自己会 abspath,不用手动拼)
  ├─ 只说「这个文件」没给路径 → 用本轮刚产出 / 刚讨论的那个文件
  └─ 同时有 .md 和 .html 两份且用户没指明 → 问一句要哪个,别猜
        ↓
调 scripts/clip(默认文件本体模式)
        ↓
把脚本输出的路径与剪贴板类型原样回给用户

判断模式:用户提到「发给别人 / 传附件 / 粘到 Finder」→ 默认文件本体;提到「粘进文档 / 群里发 / 要文字」→ 加 -t;提到「给我路径」→ 加 -p。

为什么不用 tell Finder to set the clipboard

那条 AppleScript 也能写进剪贴板,但写出来的东西部分 App 认不出,粘不出来。scripts/pbwrite.applescript 走 NSPasteboard + NSURL fileURLWithPath,写的是标准 file URL,兼容性明显更好。

验证方式:osascript -e 'clipboard info'

输出含义
«class furl», N装的是文件引用,对了
«class utf8», N装的是纯文本

已知限制

限制说明
只支持 macOS依赖 NSPasteboard / pbcopy
剪贴板只有一份换模式或换文件会覆盖上一次,没有"追加"
部分 App 只吃拖拽少数 Electron 客户端不读剪贴板里的文件引用;退路是 -p 拿路径,或直接从 Finder 拖

装载

./install.sh

装两处:

装到哪作用
~/.claude/skills/clip/ ← 本仓 symlinkClaude 侧。目录名 clip 才是注册 /clip 的那个名字,与仓库名 claude-code-clip 无关
~/.local/bin/clip ← scripts/clip symlink终端侧,该目录已在 PATH

symlink 装载,改源即时生效,无需重装。

别人一行装:

curl -fsSL https://jinhuang712.github.io/claude-code-clip/install.sh | bash

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.