Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Skill

CSecurity

Install, configure, or use ccswitch. Switches Claude Code between the user's Claude subscription and third-party models (OpenRouter, Groq) per project, mid-session, in both directions. Use when the user wants to run Claude Code on a cheaper or different model, mentions OpenRouter/Groq with Claude Code, asks to switch providers or save on usage, or hits the `diagnostics.previous_message_id` 400 error.

2 stars
0 votes
0 copies
1 views
Added 9/5/2026
ai-agentsgoshellbashdebuggingapi

Works with

claude codecliapi

Security Analysis

C71/100
criticalPipes output to a shell interpreter
mediumUses curl or wget to download content
criticalDownloads and executes remote scripts — classic supply chain attack

Pro shows the line behind each finding and how to fix it

Scanned 9/5/2026

$npx -y skills add unclecode/ccswitch --skill skill --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Skill?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Skill
[![Security: C — Skills Directory](https://www.skillsdirectory.com/api/skills/unclecode-skill/badge)](https://www.skillsdirectory.com/skills/unclecode-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: ccswitch
description: Install, configure, or use ccswitch. Switches Claude Code between the user's Claude subscription and third-party models (OpenRouter, Groq) per project, mid-session, in both directions. Use when the user wants to run Claude Code on a cheaper or different model, mentions OpenRouter/Groq with Claude Code, asks to switch providers or save on usage, or hits the `diagnostics.previous_message_id` 400 error.
---

# ccswitch

A CLI that switches a single project between the user's Claude subscription and any Anthropic-compatible provider, without breaking the running session.

## Install it

```bash
bun install -g @unclecode/ccswitch    # requires Bun: curl -fsSL https://bun.sh/install | bash
ccswitch install           # keys check, /switch command, auto-restart hook
```

Then make sure a provider key is exported in the user's shell profile, so Claude Code inherits it:

- OpenRouter: `export OPENROUTER_API_KEY=...`, keys at https://openrouter.ai/keys
- Groq: `export GROQ_API_KEY=...`, keys at https://console.groq.com/keys

Never print, echo, or write these keys anywhere. ccswitch reads them from the environment itself.

## Use it

```bash
ccswitch                                       # interactive picker
ccswitch use z-ai/glm-5.3-flash                # switch this project
ccswitch use groq:moonshotai/kimi-k2-instruct  # provider-prefixed
ccswitch back                                  # back to the Claude subscription
ccswitch back --clean                          # also remove the empty override keys
ccswitch status                                # what this project is using
ccswitch list / add / remove                   # manage favorite models
ccswitch fix [session-id] [--dry-run]          # repair an already-poisoned transcript
ccswitch heal                                  # restart this project's proxy if it stopped
```

Day to day the user should only need `/switch` inside Claude Code. The proxy starts on
demand and a SessionStart hook restarts it after a reboot, so there is no service to run.

**After switching to another provider, always tell the user to run `/model` and select that
model.** Otherwise the session keeps using its previous model at the new provider's price -
which can be far more expensive than intended.

Switching back needs no restart and no repair: keep working in the same session.

## What it changes

Only `<project>/.claude/settings.local.json` (the `env` block) plus ccswitch's own state in
`~/.ccswitch.json`. Other projects and sessions are unaffected. Every change is backed up to
`~/.ccswitch-backups/<project>/`. Claude credentials are never touched.

## Why it exists

Claude Code sends `diagnostics.previous_message_id` on each request; Anthropic requires it to
start with `msg_`. Third-party endpoints return their own id formats (OpenRouter: `gen-…`),
Claude Code persists them into the session transcript, and switching back then fails with a
permanent 400, surviving restarts, since the id is re-read from the transcript.

ccswitch runs a local proxy (127.0.0.1) that rewrites ids to `msg_` form before they are
written, so the problem cannot occur. `ccswitch fix` repairs transcripts damaged before
ccswitch was in use.

If the user reports that 400 error, `ccswitch fix` on that session id is the remedy.

## Troubleshooting

- **`<PROVIDER>_API_KEY is not set`**, the key must be exported in the shell that launched
  Claude Code, not only in the current one.
- **`proxy unavailable` warning**, Bun is missing or every port in range is taken. Check
  `~/.ccswitch.log`. Switching still works, but switching back will then need `ccswitch fix`.
- **Connection refused in a switched project**, the proxy is not running (e.g. after a
  reboot without the hook installed). Run `ccswitch heal`.
- **Model not found upstream**, verify the exact model id on the provider's models page; ids
  must match exactly (e.g. `z-ai/glm-5.3-flash`).
- **Tool calls misbehaving on a cheap model**, not all models handle Claude Code's tool
  calling well. Suggest a known-good one rather than debugging the model.

Attribution

unclecodeunclecode
View sourceSee grades on GitHubMore from unclecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →