switch-to

switch-to is a command for Claude Code from vladolaru/claude-code-plugins. It costs 28 tokens per session (3,213 once invoked), scanned A, original, MIT.

A guided command for safely moving a Git repository to another branch or pull request.

In plain words
What is it for?
Use it to switch branches or check out a pull request, including changes from forked repositories, then see useful context about where you landed.
Why use it?
It protects uncommitted work and checks remote branches and repository state, reducing the chance of switching to the wrong place or losing local changes.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution. Also seen: names the AskUserQuestion tool.

Good fit Use it to switch branches or check out a pull request, including changes from forked repositories, then see useful context about where you landed.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/vladolaru/claude-code-plugins/switch-to
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/vladolaru/claude-code-plugins

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for switch-to

README.md
[![agentmods](https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/switch-to/github.svg)](https://agentmods.dev/commands/vladolaru/claude-code-plugins/switch-to)
Your own site
<a href="https://agentmods.dev/commands/vladolaru/claude-code-plugins/switch-to"><img src="https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/switch-to/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for switch-to

Your own site · 80×15
<a href="https://agentmods.dev/commands/vladolaru/claude-code-plugins/switch-to"><img src="https://agentmods.dev/badge/commands/vladolaru/claude-code-plugins/switch-to.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,213 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.03213
Opus 5.5 $0.00011 $0.01285
Sonnet 5.5 $0.00006 $0.00643
Haiku 4.5 $0.00003 $0.00321

Measured 8d ago against content hash 96f716e3a143, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

switch-to scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/pirategoat-tools/commands/switch-to.md · 248 lines

How it starts

The opening of the file, as written. The whole thing — 248 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a branch switcher. Your mission: safely switch the current repo to a target branch (by name, PR number, or PR URL), handling dirty working trees, remote synchronization, and fork remotes along the way.

RULE 0: Preserve uncommitted work. Check for dirty state and get user consent before any branch switch.

Execution consent: checkout and pull can run PR code through hooks, including tracked hooks under core.hooksPath. Who can change that code decides whether to ask, before any mutation in the PR flow:

  • A same-repository PR (isCrossRepository false) proceeds. Its branch lives in the base repository, so only people with write access can change it, the same people whose hooks already run whenever the user pulls the default branch.
  • A fork PR by the user proceeds. Compare the author with the user's login on the PR's host ($GH_CMD api user --hostname <PR_HOST> --jq .login; gh api does not take the host from the git remote and defaults to github.com); a failed lookup means STOP.
  • Any other fork PR needs consent: use existing explicit authorization for it, or ask whether its hooks may run on this machine. Denied or unanswered means STOP. Do not disable hooks to bypass denial.

Values are data: put every value that reaches a shell command from PR metadata, an argument, or the repository (branch names, remote names, file paths, package names) in single quotes, as the blocks below do, writing an embedded single quote as '\''. Git allows $, ;, ( and backticks in branch and remote names, and a fork PR's author picks its branch and file names, so an unquoted value can run commands.

RULE 1: Always show meaningful post-switch context. The user should know where they landed.

Expected failures: Git and GitHub CLI commands may fail for normal reasons (network issues, auth prompts, branch not found). When a command fails, report the error clearly to the user and STOP with actionable guidance. Do not apologize or retry blindly.

Step 1: Parse Arguments

Parse arguments: $ARGUMENTS

  • If empty: STOP. Tell the user: "Usage: /switch-to <branch_name | PR_number | PR_URL>"
  • If argument contains /pull/ (a GitHub PR URL): set PR_REF to the URL and go to Step 2A (PR flow)
  • If argument is a bare number, with or without a leading # (3817, #3817): set PR_REF to the number without the # and go to Step 2A (PR flow). A bare number is always a PR number, never a branch name.
  • Otherwise: treat as a branch name, go to Step 2B (Branch flow)

Store CURRENT_BRANCH:

git branch --show-current

Early exit: For the branch flow (not PR), if CURRENT_BRANCH equals TARGET_BRANCH, tell the user "Already on <branch>" and skip to Step 5 (remote sync check). For PR flow, always proceed — the user wants PR context even if already on the branch.

Read the full file on GitHub · 248 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago Changed · -3 lines · +6 tokens per session 96f716e3a143
  2. 1mo ago First seen · 251 lines · 22 tokens per session scan A 6eff1fd03aa1

Subscribe to this mod's changes

switch-to is a command published in the GitHub repository vladolaru/claude-code-plugins (8 stars, last pushed 4d ago), licensed MIT. It adds 28 tokens to every session and 3,213 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.