name: github-browse description: Open a GitHub issue or PR in browser and optionally manage subscriptions. Use when navigating to GitHub resources from the terminal. argument-hint: [issue-or-pr-number] [sub|un] disable-model-invocation: true
Open a GitHub issue or pull request in the browser using gh issue view --web or gh pr view --web.
Optionally subscribe or unsubscribe from notifications for the issue/PR.
Requirements:
- If user provides $1 (issue or PR number), use that value
- Otherwise, extract the most recently discussed issue or PR number from the conversation context
- Determine the appropriate repository using one of:
- Current git repository (if in a git repo):
git remote get-url origin - If the issue/PR was discussed with a full org/repo reference, use that
- Default to
anthropics/claude-codeif the context suggests Claude Code issues
- Current git repository (if in a git repo):
- Use
gh issue view <number> -R <org/repo> --webfor issues - Use
gh pr view <number> -R <org/repo> --webfor PRs - If unclear whether it's an issue or PR, try issue first (gh will auto-detect)
Subscription management (optional):
- If $2 is "sub", subscribe to notifications for this issue/PR
- If $2 is "un", unsubscribe from notifications for this issue/PR
- If $2 is blank/not provided, do not perform any subscription action
- Subscription requires the
notificationsscope in your gh token- If not present, run:
gh auth refresh -h github.com -s notifications
- If not present, run:
- Uses GraphQL API to get the issue/PR ID and update subscription state
Implementation approach:
- Extract issue/PR number from $1 or conversation context
- Determine the repository (current repo, or from context, or claude-code default)
- Execute:
gh issue view <number> -R <org/repo> --web - If $2 is "sub" or "un": a. Query GraphQL to get the issue/PR's subscribableId b. Execute updateSubscription mutation with appropriate state (SUBSCRIBED for "sub", UNSUBSCRIBED for "un") c. Handle both issues and PRs (query should check both types)
- The
ghCLI will automatically open the URL in the default browser
Examples:
/github:browse 8677- Opens issue #8677 in the current/contextual repo/github:browse 8677 sub- Opens issue #8677 and subscribes to notifications/github:browse 8677 un- Opens issue #8677 and unsubscribes from notifications/github:browse- Extracts and opens the most recently discussed issue/PR number
Note: The gh CLI intelligently handles both issues and PRs with the same command when using gh issue view, so we can use that for both types.