Four Terminal Commands I'd Like You to Run Before Handing Off From Claude Code to Humans (Mostly for macOS)

Four Terminal Commands I'd Like You to Run Before Handing Off From Claude Code to Humans (Mostly for macOS)

2026.02.17

This page has been translated by machine translation. View original

I've been using Claude Code for many tasks much more frequently. It helps me write code, investigate AWS environments, and assists with task progression and management.

Nevertheless, there are still times when I need to work and check things manually. This might include viewing GitHub PRs/Issues in the browser, pasting notes in Slack, or opening Finder to check a list of deliverables.

During these times, there are several commands that make me "a bit" happy when I ask Claude Code to "do this too." I've actually incorporated these into skills and slash commands myself.

Today, I'll introduce commands I frequently use. Most of these are for macOS.

open : Open URLs or folders in browser/Finder

open is a standard macOS command. It lets you open files, folders, and URLs with their default applications.

For example, after having Claude Code create some deliverable, if you ask it to "open that folder," it will open Finder using the open command.

open command usage examples
# Open URL in browser
open https://example.com

# Open folder in Finder
open ./output

# Open image in Preview
open ./diagram.png

It's simple but versatile, and I find it very useful for quickly transitioning from terminal to browser or Finder. For instance, I've written a skill that "after creating a regular agenda, uses open to open the agenda page I always use."

pbcopy : Copy to clipboard

pbcopy is a standard macOS command. It lets you copy standard input content to the clipboard.

After having Claude Code create a Markdown file, I'll ask it to "copy to clipboard," then I can simply paste it into Slack or an Issue.

pbcopy usage example
# Copy file contents to clipboard
cat meeting-notes.md | pbcopy

For example, in my slash command for regular meeting preparation, I combine pbcopy and open in the final step.

Slash command excerpt (final step)
## Content verification/copy and browser launch

Look at the generated content and check if it's outputting correctly.

If there are no problems, please execute the following:

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 that it prepares everything so I just need to paste.

gh : Open browser with GitHub CLI

gh (GitHub CLI) is a tool for operating GitHub from the command line. While widely used for various GitHub operations like creating PRs and managing issues, in this blog's context, the "open in browser" subcommands and flags are particularly useful.

I frequently use the following:

gh CLI usage examples
# 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 for pr / issue / repo / run / release / gist. Here's a reference list:

Command Purpose
gh browse Open repository in browser
gh browse [file path] 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 : Check Git diff in GitHub style locally

yoshiko-pg/difit (hereafter difit) is a CLI tool that launches a local web server and displays Git differences in a GitHub "Files changed" style.

I use it to check differences in the browser after having Claude Code work locally. Large changes that are difficult to see with terminal's git diff are easy to view with difit. It's invaluable for checking differences before git push.

difit usage examples
# Display working changes
git diff | difit

# Display staged changes
git diff --staged | difit

# Display differences of a 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).

~/.claude/skills/difit/SKILL.md
---
name: difit
description: Check code differences in working 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 must be 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** → Display working changes

git diff | difit

- **`staged`** → Display staged changes

git diff --staged | difit

- **Commit or branch specification** (e.g., `HEAD~3`, `main..feature`) → Display specified differences

git diff <specification> | difit

## Notes

- Pass `git diff` output via pipe (don't run difit directly)
- difit launches in background, browser opens automatically

Conclusion

I've introduced "handover" type commands I usually ask Claude Code to perform. While these are all simple commands, incorporating them into skills and slash commands allows Claude Code to smoothly transfer to the human side at the end of tasks, making them comfortable to use.

I hope this has been helpful.

Side note: I asked Claude Code "What else is there?"

While writing this blog, I asked Claude Code "What other useful commands are there?" It suggested several:

  • say
  • osascript
    • Command to execute AppleScript
    • Seems widely applicable for macOS app operations and displaying notifications
  • code
    • Opens files in VS Code
    • Could be useful for viewing syntax-highlighted code
  • qlmanage -p
    • Preview with Quick Look
    • Honestly, the open command could probably substitute for this

References

Share this article

FacebookHatena blogX

Related articles