
Four commands I'd be happy if you ran before handing over from Claude Code to humans (mostly for macOS)
This page has been translated by machine translation. View original
I've been increasingly using Claude Code for various tasks. It helps me write code, investigate AWS environments, and even acts as a companion for task progression and management.
Nevertheless, there are still plenty of times when I need to do work and checks by hand. Looking at GitHub PR/Issues in the browser, pasting notes in Slack, opening Finder to check a list of deliverables, and so on.
In those moments, there are several commands that make me "a bit" happy when I ask Claude Code to "do this next." I've actually built these into skills and slash commands that I use.
This time, I'd like to introduce commands I frequently request. Most are for macOS.
open : Opening URLs or folders in browser/Finder
open is a standard command in macOS. It opens files, folders, or URLs in their default applications.
For example, after having Claude Code create some deliverable, if I ask it to "open that folder," it will open Finder with open.
# Open URL in browser
open https://example.com
# Open folder in Finder
open ./output
# Open image in Preview
open ./diagram.png
Simple but versatile, I find it valuable for quickly transitioning from the terminal to browser or Finder. For instance, I've written it into a skill like "after creating a regular agenda, open the agenda page I always use with open."
pbcopy : Copy to clipboard
pbcopy is a standard command in macOS. It copies the content of standard input to the clipboard.
After having a Markdown file created, I ask to "copy it to clipboard," and then I can just paste it into Slack or an Issue.
# Copy file contents to clipboard
cat meeting-notes.md | pbcopy
For example, in my slash command for regular meeting preparation that I actually use, I combine pbcopy and open in the final step.
## Content check/Copy and browser launch
Check the generated content to verify it's output correctly.
If all looks good, please execute:
cat ./tmp/YYYY-MM-DD-meeting-prepare.md | pbcopy
open https://github.com/orgs/{org}/projects/{id}/views/{view_id}
It copies the deliverable to the clipboard while opening the destination page in the browser. It's subtly convenient to have everything set up so I just need to paste.
gh : Opening browser with GitHub CLI
gh (GitHub CLI) is a tool for operating GitHub from the command line. While widely used for PR creation and Issue management, in this blog's context, the "open in browser" subcommands and flags are particularly useful.
I frequently use the following:
# Open a specific file's GitHub page in browser
gh browse path/to/file.tf
# Open PR linked to current branch in browser
gh pr view --web
# Open Issue in browser
gh issue view 123 --web
The --web flag can be used with view in pr / issue / repo / run / release / gist. Here's a reference list:
| Command | Purpose |
|---|---|
gh browse |
Open repository in browser |
gh browse [filepath] |
Open specific file in browser |
gh pr view --web |
Open PR in browser |
gh pr create --web |
Open PR creation screen in browser |
gh issue view --web |
Open Issue in browser |
gh issue create --web |
Open Issue creation screen in browser |
gh repo view --web |
Open repository page in browser |
gh run view --web |
Open Actions execution results in browser |
gh release view --web |
Open release page in browser |
gh gist view --web |
Open Gist in browser |
※ For more precise GitHub operations, there's also GitHub MCP Server.
difit : View Git diffs locally in GitHub style
yoshiko-pg/difit (hereafter difit) is a CLI tool that launches a local web server and displays Git diffs in a GitHub "Files changed" style.
I use it to check diffs in a browser after having Claude Code work locally. Large changes that are difficult to see in terminal git diff are easier to view with difit. It's invaluable for checking diffs before git push.
# Display working changes
git diff | difit
# Display staged changes
git diff --staged | difit
# Display diff of specific commit
git diff HEAD~3 | difit
When using difit from Claude Code, I pass the git diff output via pipe. To help Claude Code understand this usage, I've defined it as a skill (SKILL.md).
---
name: difit
description: Check code differences in progress with difit (GitHub-style diff viewer).
disable-model-invocation: true
---
# difit - GitHub-style diff viewer
Display coding differences in browser using [difit](https://github.com/yoshiko-pg/difit).
## Prerequisites
- difit is installed
## Execution procedure
1. Construct `git diff` command according to arguments
2. Pass to difit via pipe, run in background
3. Read URL from output and display to user
## Argument patterns
- **No arguments** → Show working changes
git diff | difit
- **`staged`** → Show staged changes
git diff --staged | difit
- **Commit or branch specification** (e.g. `HEAD~3`, `main..feature`) → Show specified diff
git diff <specification> | difit
## Notes
- Pass `git diff` output via pipe (don't run difit directly)
- difit starts in background and browser opens automatically
Conclusion
I've introduced the "handoff" commands I regularly ask Claude Code to perform. While these are all simple commands, when built into skills or slash commands, they comfortably pass work to the human side at the end of tasks.
I hope this has been useful.
Side note: Asked Claude Code "Any others?"
While writing this blog, I asked Claude Code "Are there other useful commands?" It suggested several:
say- macOS command that reads text aloud
- I don't use it, but notification-type features might be better with Hooks
- Reference: Notify work completion with Claude Code Hooks - DevelopersIO
osascript- Command to execute AppleScript
- Seems widely applicable for macOS app operation and notifications
code- Open files in VS Code
- Useful for viewing syntax-highlighted code
qlmanage -p- Preview with Quick Look
- Honestly, the
opencommand seems sufficient for this