Skip to content
Back to skills

Claude Version

FSecurity

Manage Claude Code CLI versions across official installer and npm global installs.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 20, 2026
ai-agentsbashnode

Works with

  • claude code
  • cli

Security analysis

F27/100
  • criticalPipes output to a shell interpreter
  • mediumUses curl or wget to download content
  • highPerforms destructive filesystem operations
  • criticalDownloads and executes remote scripts — classic supply chain attack
  • mediumInstalls packages at runtime which could introduce malicious dependencies

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

Scanned November 20, 2026

npx -y skills add chnlich/charlie-bot --skill claude-version --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Claude Version?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Claude Version
[![Security: F — Skills Directory](https://www.skillsdirectory.com/api/skills/chnlich-claude-version/badge)](https://www.skillsdirectory.com/skills/chnlich-claude-version)

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

Download with Pro
SKILL.md
---
name: claude-version
description: Manage Claude Code CLI versions across official installer and npm global installs.
version: 1.0.0
---

# Claude CLI Version Management

Manage Claude Code CLI versions — install, switch, rollback, list.

## Two install methods

| Method | How it works | Version switch |
|--------|-------------|----------------|
| **Official installer** (`curl -fsSL https://claude.ai/install.sh \| sh`) | Standalone binary at `~/.local/share/claude/versions/<ver>`, symlinked from `~/.local/bin/claude` | Re-point the symlink |
| **npm global** (`npm i -g @anthropic-ai/claude-code`) | Lives in the active Node prefix (`$(npm prefix -g)/bin/claude`) | `npm i -g @anthropic-ai/claude-code@<ver>` |

Detect which method is in use:

```bash
which claude        # ~/.local/bin/claude → official installer
                    # ~/.nvm/.../bin/claude → npm global
file $(readlink -f $(which claude))   # ELF = binary install, script/symlink = npm
```

## Official installer method

### Layout

| Path | Purpose |
|------|---------|
| `~/.local/bin/claude` | Symlink → active version |
| `~/.local/share/claude/versions/<ver>` | Binary (≥ ~2.1.80) or wrapper script |
| `~/.local/share/claude/versions/<ver>-node/` | Unpacked npm package (for older Node-based versions) |

### List / check

```bash
ls ~/.local/share/claude/versions/       # installed versions
readlink ~/.local/bin/claude             # active version
claude --version
```

### Switch to an installed version

```bash
ln -sf ~/.local/share/claude/versions/<VERSION> ~/.local/bin/claude
```

### Install a specific older version (< ~2.1.80, Node-based)

Requires Node ≥ 18.

```bash
# 1. Download & extract
npm pack @anthropic-ai/claude-code@<VERSION> --pack-destination /tmp/
mkdir -p ~/.local/share/claude/versions/<VERSION>-node
tar xzf /tmp/anthropic-ai-claude-code-<VERSION>.tgz -C /tmp
cp -r /tmp/package/* ~/.local/share/claude/versions/<VERSION>-node/

# 2. Create wrapper script
cat > ~/.local/share/claude/versions/<VERSION> << 'EOF'
#!/bin/bash
exec "$HOME/.nvm/versions/node/$(ls "$HOME/.nvm/versions/node" | sort -V | tail -1)/bin/node" \
     "$HOME/.local/share/claude/versions/<VERSION>-node/cli.js" "$@"
EOF
chmod +x ~/.local/share/claude/versions/<VERSION>

# 3. Activate
ln -sf ~/.local/share/claude/versions/<VERSION> ~/.local/bin/claude
claude --version
```

### Cleanup

Each binary release is ~220 MB. Remove old ones with:

```bash
rm ~/.local/share/claude/versions/<OLD>
rm -rf ~/.local/share/claude/versions/<OLD>-node   # if Node-based
```

## npm global method

### Switch version

```bash
npm i -g @anthropic-ai/claude-code@<VERSION>
claude --version
```

### Rollback

Same command with the older version number.

### List available versions

```bash
npm view @anthropic-ai/claude-code versions --json | tail -20
```

## Notes

- Switching versions does NOT affect the currently running Claude session — only new invocations.
- The two methods can coexist but `$PATH` order determines which `claude` binary wins.

Attribution

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

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.