claude-code-clip
CLAUDE.md0 starsChanged 4 months agoMITView on GitHub
One capability with two front doors: /clip <path> in Claude Code and clip <path> in a terminal. Both run the same scripts/clip. - SKILL.md — the skill definition (frontmatter + how Claude should drive the script). Installed at ~/.claude/skills/clip/; the directory name clip is what registers the bare /clip, independent of this repo's name. - scripts/clip — bash front end. Parses modes, absolutises paths, reports what landed on the clipboard. - scripts/pbwrite.applescript — AppleScript-ObjC back end. Writes file URLs via…
- Pipes a download into a shell
In this repositoryOne other file it gives its agents.
- clipSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Don't replace that loop with a bare dirname.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md 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.
Files
claude-code-clip — dev notes
One capability with two front doors: /clip <path> in Claude Code and
clip <path> in a terminal. Both run the same scripts/clip.
Layout
SKILL.md— the skill definition (frontmatter + how Claude should drive the script). Installed at~/.claude/skills/clip/; the directory nameclipis what registers the bare/clip, independent of this repo's name.scripts/clip— bash front end. Parses modes, absolutises paths, reports what landed on the clipboard.scripts/pbwrite.applescript— AppleScript-ObjC back end. Writes file URLs viaNSPasteboard. Called only in the default (file) mode;-t/-pgo throughpbcopy.install.sh— local dev install: symlinks this repo →~/.claude/skills/clipandscripts/clip→~/.local/bin/clip. Edit the source, it takes effect immediately.docs/— GitHub Pages source (repo Settings → Pages → source/docs).install.shis thecurl … | bashinstaller (copies files from rawmain, no symlinks);.nojekyllso the installer is served byte-for-byte.
Two traps, both already hit
Symlink self-location. scripts/clip is normally invoked through
~/.local/bin/clip, a symlink. dirname "${BASH_SOURCE[0]}" then resolves to
the bin directory, so the script can't find pbwrite.applescript sitting next
to its real self. The script walks the symlink chain before computing HERE.
Don't replace that loop with a bare dirname.
die inside command substitution. abspath calls die, which exit 1s —
but inside $( ) that only kills the subshell. The caller must catch the status
(p="$(abspath "$a")" || exit 1); otherwise an empty string joins the path array
and osascript dies with object cannot be nil. Any new helper that validates
input needs the same treatment.
Why NSPasteboard, not Finder
tell app "Finder" to set the clipboard to (POSIX file "…") writes something to
the clipboard, but several apps don't recognise it and ⌘V does nothing.
NSPasteboard + NSURL fileURLWithPath writes a standard file URL, which
pastes reliably. Verify with osascript -e 'clipboard info' — «class furl»
means a file reference is on the clipboard, «class utf8» means text.
Standalone skill, not a plugin
No .claude-plugin/ manifest, on purpose. A plugin's command is always
namespaced (/clip:clip) and nothing removes the prefix, so the bare /clip
only exists for a standalone skill under ~/.claude/skills/. The evidence for
that claim was gathered in
claude-code-queue — see its
CLAUDE.md. Don't add a manifest back.
Conventions
- One concern per commit; the message says why (which failure mode it fixes).
- Touching
scripts/clipmeans re-running the smoke set by hand: all three modes, multi-file, stdin,-s, and a nonexistent path (must exit 1 with one error line, not two).
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
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.

