update-claude

Install a shell function that safely updates Claude Code in nvm environments by avoiding ENOTEMPTY errors

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "update-claude" with this command: npx skills add amu815/update-claude-skill/amu815-update-claude-skill-update-claude

update-claude Skill

What this skill does

When invoked, install the update-claude shell function into the user's shell configuration file. This function safely updates Claude Code (@anthropic-ai/claude-code) in nvm environments by removing the old package directory before reinstalling, which avoids the common ENOTEMPTY error.

Instructions

  1. Detect the user's shell by checking $SHELL (bash or zsh).
  2. Determine the rc file path:
    • For zsh: ${ZDOTDIR:-$HOME}/.zshrc
    • For bash: $HOME/.bashrc
  3. Check if the update-claude function already exists in the rc file. If it does, inform the user and skip.
  4. Append the following function to the rc file:

# Claude Code updater - avoid ENOTEMPTY errors in nvm environments
update-claude() {
  echo "Current version: $(claude --version 2>/dev/null || echo 'unknown')"
  local pkg_dir="$(npm root -g)/@anthropic-ai/claude-code"
  echo "Package path: $pkg_dir"
  echo "Removing old version..."
  rm -rf "$pkg_dir"
  echo "Installing latest version..."
  npm install -g @anthropic-ai/claude-code@latest
  if [ $? -eq 0 ]; then
    echo "Update complete! Version: $(claude --version)"
  else
    echo "Installation failed. Check error logs."
    return 1
  fi
}
  1. Source the rc file to make the function immediately available.
  2. Confirm success to the user by showing which file was modified.

Usage after installation

The user can run update-claude in their terminal at any time to safely update Claude Code.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Seerr server manager

CLI for the Seerr media request management API. Search movies and TV shows, create and manage media requests, manage users, track issues, and administer a se...

Registry SourceRecently Updated
Coding

.Publish Temp

Install, configure, validate, and run the news-fetcher Python CLI for aggregating RSS/Atom and HTML news sources with deduplication, clustering, ranking, sou...

Registry SourceRecently Updated
Coding

Soul Sharing

Give AI agents persistent identity and shared memory across runtimes, devices, and sessions — Git-native, no database, no vendor lock-in.

Registry SourceRecently Updated
Coding

Code Searcher

A code-searching tool similar to ack, but faster. the silver searcher, c, ag, c, command-line-tool, pcre, search-in-text. Use when you need the silver search...

Registry SourceRecently Updated