open-file
Open File
Open a local file or directory on macOS using open. Supports specifying an app, URL scheme deep linking, and error recovery.
Usage
/open-file <path> [app]
- If no path is provided, infer from conversation context (e.g., a file just created or discussed).
- If an app is mentioned (e.g., "in Obsidian"), use
open -aor the app's URL scheme.
Workflow
-
Resolve the path. Make it absolute. If relative, resolve against cwd.
-
Verify the target exists:
[ -e '<path>' ] && echo "EXISTS" || echo "NOT_FOUND"If not found, tell the user and stop.
-
Open:
With a specific app:
open -a '<App Name>' '<path>'With the default app:
open '<path>' -
Handle
procNotFounderror. Ifopenfails because the app isn't running:open -a '<App Name>' && sleep 3 && open -a '<App Name>' '<path>'Launch the app first, wait for it to initialize, then retry.
-
Confirm to the user that the file was opened.
URL Scheme Deep Linking
Use URL schemes when the user wants to jump to a specific item within an app, not just open a file.
| App | Command |
|---|---|
| Obsidian | open -a "Obsidian" && sleep 3 && open 'obsidian://open?vault=<vault>&file=<url-encoded-path>' |
| VS Code | code '<path>' or open 'vscode://file/<absolute-path>' |
URL-encode path components — especially emoji, CJK characters, and spaces.
Notes
- Always single-quote paths to handle spaces and special characters
open '<directory>'opens in Finderopen -aboth launches the app (if needed) and opens the file in one step — the two-step launch-then-open is only needed for URL scheme calls where the app must be running first
More from verneagent/tiny-skills
inscribe
Capture rules, conventions, or code style guidelines into documentation files. Use when the user says "inscribe", "learn", "remember this rule", "add convention", or wants to persist coding guidelines.
4lark-share
Share a knowledge insight or message with a team via Lark group chat webhook. Use when the user says "share", "lark-share", or wants to send a formatted message to a Lark group.
4multi-gh
Fix and standardize GitHub multi-account workflows with gh account switching, SSH host aliases, and safe remote setup. Use when creating repos, pushing code, or diagnosing GitHub auth mismatches across multiple identities.
2retro
Retrospective on mistakes or new conventions — analyze patterns, find root causes, and propose deterministic prevention (static checks > lint > tests > runtime > review > docs). Use when the user says "retro", "反省", "复盘", "怎么防", "how to prevent", or wants to enforce a new convention.
2wksp
Open a new iTerm2 tab with Claude in a worktree or folder, optionally entering handoff mode.
1netmap
Show all network interfaces, LAN neighbors, and Tailscale peers on the current machine. Use when the user asks about network status, neighbors, connected devices, or Tailscale peers.
1