Skip to content

Instantly share code, notes, and snippets.

@mobob
Created June 3, 2026 01:11
Show Gist options
  • Select an option

  • Save mobob/581bd27b06956db0b145ec62d2cccff9 to your computer and use it in GitHub Desktop.

Select an option

Save mobob/581bd27b06956db0b145ec62d2cccff9 to your computer and use it in GitHub Desktop.
Claude Code skill: open-in-zed — open a directory in a brand-new Zed window via zed -n
name open-in-zed
description Open a directory in a brand-new Zed window. No argument opens the current worktree (pwd). An argument is treated as a path, or as a bare worktree name resolved under ~/Developer/paloma/wt/. Use when the user says "open in zed", "open this in a new zed window", or "zed <worktree-name>".

open-in-zed

Open a directory in a new Zed window using zed -n (forces a fresh workspace, never reuses or tabs into an existing window).

Resolve the target

  1. No argument → target is $PWD (the worktree you're currently in).
  2. Argument contains a / or starts with ~/. → treat it as a path. Expand ~ and resolve to an absolute path.
  3. Bare argument (no slash), e.g. laughing-mestorf-5e2cd2 → it's a worktree name. Resolve it:
    match=$(ls -d ~/Developer/paloma/wt/*/"$ARG" 2>/dev/null | head -1)
    If $match is non-empty, that's the target. If not, fall back to treating the argument as a literal path.

If the resolved target doesn't exist as a directory, stop and tell the user — don't launch Zed on a missing path.

Launch

zed -n "$TARGET"

That's it. Confirm what you opened (the resolved absolute path), nothing more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment