### Start self-hosted runner with --exec-path wrapper script Source: https://code.claude.com/docs/en/self-hosted-environments-configuration Point the runner at a wrapper script using --exec-path (or SELF_HOSTED_RUNNER_EXEC_PATH) when starting it. Replace as described in the quickstart's manual setup. ```bash claude self-hosted-runner --environment-secret-file /etc/claude/environment-secret --base-dir '' --exec-path /etc/claude/session-wrapper.sh ``` -------------------------------- ### Install ShellCheck with a Bash setup script Source: https://code.claude.com/docs/en/cloud-environments A setup script runs as root on Ubuntu 24.04 before Claude Code launches, so apt install works. This example installs ShellCheck, which isn't pre-installed. The script must exit zero and finish within roughly five minutes to be cached. ```bash #!/bin/bash apt update && apt install -y shellcheck ``` -------------------------------- ### Install a plugin with /plugin install in a Claude Code session Source: https://code.claude.com/docs/en/plugins/troubleshooting Type this at the Claude Code prompt to install a plugin from a marketplace. A successful install prints a summary starting with `✓ Installed .` ```text /plugin install @ ``` -------------------------------- ### Create project and install MCP SDK with zod Source: https://code.claude.com/docs/en/channels-reference Sets up a new webhook-channel directory and installs the MCP SDK plus zod, which the permission relay examples import directly. Uses Bun as the runtime. ```bash mkdir webhook-channel && cd webhook-channel bun add @modelcontextprotocol/sdk zod ``` -------------------------------- ### Install httpx with uv for Python HTTP tool examples Source: https://code.claude.com/docs/en/agent-sdk/custom-tools Python examples on this page that make HTTP requests use httpx. Add it with uv, the package manager used by this project. ```bash uv add httpx ``` -------------------------------- ### Install a plugin from the shell with claude plugin install Source: https://code.claude.com/docs/en/plugins/install Installs a plugin without starting a Claude Code session, for example from a setup script. Defaults to user scope; pass --scope project or --scope local to change it. Prints `Successfully installed plugin: formatter@your-org (scope: project)` on success. ```bash claude plugin install formatter@your-org --scope project ``` -------------------------------- ### Ask questions or plan a project Source: https://code.claude.com/docs/en/terminal-guide Use this prompt to have Claude explain things, help you learn, or plan out a project. If you don't have a project yet, Claude can help you start a new one. ```text I want to build a personal budget tracker. What would I need? ``` -------------------------------- ### Start self-hosted runner with --use-anthropic-git-proxy Source: https://code.claude.com/docs/en/self-hosted-environments-deploy Run this on the runner host to start the quickstart runner with the Anthropic git proxy enabled. Requires Claude Code v2.1.267 or later, Git 2.32 or later, and --capacity 1 (the default); the runner refuses to start otherwise. At startup it prints `Registering as opted in to Anthropic-managed git (--use-anthropic-git-proxy)`. ```shell claude self-hosted-runner --environment-secret-file '/etc/claude/environment-secret' --base-dir '' --use-anthropic-git-proxy ``` -------------------------------- ### Install the iMessage plugin Source: https://code.claude.com/docs/en/channels Start Claude Code by running `claude`, then enter this at its prompt to install the iMessage plugin. Choose the user scope option when asked so the plugin is available across all projects. ```text /plugin install imessage@claude-plugins-official ``` -------------------------------- ### Ask Claude to explain the folder structure Source: https://code.claude.com/docs/en/quickstart Example prompt to get an explanation of the project's folder structure. ```text explain the folder structure ``` -------------------------------- ### Run Setup and SessionStart hooks with --init-only Source: https://code.claude.com/docs/en/cli-reference Runs Setup and SessionStart hooks, then exits without starting a conversation. ```bash claude --init-only ``` -------------------------------- ### Start Claude Code in a project directory Source: https://code.claude.com/docs Replace `your-project` with the path to a project directory on your machine. Claude Code prompts you to log in on first use unless you approve the `ANTHROPIC_API_KEY` environment variable. ```bash cd your-project claude ``` -------------------------------- ### Generate a teammate ramp-up guide with /team-onboarding Source: https://code.claude.com/docs/en/whats-new/2026-w15 Generates a ramp-up guide from your local Claude Code usage. Run it in a project you know well and hand the output to a new teammate so they can replay your setup. ```text /team-onboarding ``` -------------------------------- ### Install claude-security plugin from the official Anthropic marketplace Source: https://code.claude.com/docs/en/claude-security Run this at the Claude Code prompt to install the plugin from the official Anthropic marketplace. The command opens the plugin's details, where you choose an installation scope to start the install. ```text /plugin install claude-security@claude-plugins-official ``` -------------------------------- ### Install killed on low-memory Linux: exit code 137 output Source: https://code.claude.com/docs/en/troubleshoot-install Example install script output when the OOM killer terminates the `claude install` step. The line number and process ID vary by release and run; installing needs roughly 512 MB of free memory. ```text Setting up Claude Code... bash: line 183: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"} Installation was killed before it could finish (exit code 137). This usually means the system ran out of memory. Claude Code needs roughly 512MB of free memory to install. Free up memory, then run this script again. ``` -------------------------------- ### Resulting monorepo layout after setup Source: https://code.claude.com/docs/en/large-codebases Shows the repository layout after setup, including root and per-package CLAUDE.md files, settings files, and skills. Starting Claude from packages/api/ loads the root and api CLAUDE.md files, skips packages/web/CLAUDE.md, and applies the configured access and deny rules. ```text monorepo/ CLAUDE.md .claude/settings.json # deny rules for worktree sessions packages/ api/ CLAUDE.md .claude/settings.json # worktree, additionalDirectories, deny rules .claude/skills/api-testing/SKILL.md web/ CLAUDE.md .claude/skills/component-patterns/SKILL.md shared/ CLAUDE.md ``` -------------------------------- ### Install curl and gnupg prerequisites for apt Source: https://code.claude.com/docs/en/setup Fresh Debian and Ubuntu installations may lack curl and gpg. Run this first if either command reports `command not found`. ```bash sudo apt install curl gnupg ``` -------------------------------- ### Start PostgreSQL with service postgresql start Source: https://code.claude.com/docs/en/cloud-environments PostgreSQL is pre-installed but not running by default. Ask Claude to run this command to start it in the cloud session. ```bash service postgresql start ``` -------------------------------- ### Start Redis with service redis-server start Source: https://code.claude.com/docs/en/cloud-environments Redis is pre-installed but not running by default. Ask Claude to run this command to start it in the cloud session. ```bash service redis-server start ``` -------------------------------- ### Install httpx with pip for Python HTTP tool examples Source: https://code.claude.com/docs/en/agent-sdk/custom-tools Python examples on this page that make HTTP requests use httpx. Add it with pip if your project uses pip as its package manager. ```bash pip install httpx ``` -------------------------------- ### Write a short CLAUDE.md with commands, conventions, and gotchas Source: https://code.claude.com/docs/en/best-practices A concise CLAUDE.md example that holds only what Claude can't infer from the code: exact test/typecheck commands, misleading patterns, and setup gotchas. Run /context in a session to confirm Claude loaded the file. ```markdown --- paths: - "src/api/**/*.ts" --- - Validate request bodies with the zod schemas in src/api/schemas/, don't hand-roll checks - Every new endpoint needs an entry in openapi.yaml, CI fails without it ``` -------------------------------- ### Install plugin with claude plugin install Source: https://code.claude.com/docs/en/plugins/create-marketplace Install id is the entry's name, an @, and the marketplace name. Prints `✔ Successfully installed plugin: my-first-plugin@my-marketplace (scope: user)`. ```bash claude plugin install my-first-plugin@my-marketplace ``` -------------------------------- ### Create a project folder for the Agent SDK quickstart Source: https://code.claude.com/docs/en/agent-sdk/quickstart Creates and enters a new directory for the quickstart. The SDK can run from any folder and by default has access to files in that directory and its subdirectories. ```bash mkdir my-agent cd my-agent ``` -------------------------------- ### Start self-hosted runner with --hold-idle-file and --max-hold-min Source: https://code.claude.com/docs/en/self-hosted-environments-deploy Start the runner with --hold-idle-file, --release-idle-session-min, and --max-hold-min to hold idle sessions while host processes run. Set --max-hold-min above --release-idle-session-min or nothing is held; without it the cap is one day. This example releases idle sessions after 30 minutes and holds at most 4 hours after going idle. ```bash claude self-hosted-runner \ --environment-secret-file /etc/claude/environment-secret \ --base-dir '' \ --release-idle-session-min 30 \ --hold-idle-file /var/lib/claude-hold/hold-idle \ --max-hold-min 240 ``` -------------------------------- ### Write project instructions example Source: https://code.claude.com/docs/en/claude-projects Example brief for Project settings > Memory > Project instructions, sent to each new thread (up to 16,000 characters). Covers the project goal, branching and PR conventions, self-check commands, missing-resource handling, and actions requiring approval. ```text This project holds p95 latency for the payments API under 200 ms: profiling, query and caching fixes, and the dependency upgrades that come with them, in the payments-api repository. - Branch from main and open one draft pull request per thread. - Before you call work done, run `make test` and `make lint` and paste the summary lines in your final message. - If you can't reach something you need, such as a repository, a secret, an API, or a connector, say exactly what's missing in your first message and stop. Don't substitute, mock, or guess. - Don't merge, force-push, or change CI configuration without asking me in the thread. ``` -------------------------------- ### Pipe, script, and automate with the claude CLI Source: https://code.claude.com/docs Claude Code is composable and follows the Unix philosophy. Pipe logs in, run it in CI, or chain it with other tools using these examples. ```bash # Analyze recent log output tail -200 app.log | claude -p "Slack me if you see any anomalies" # Automate translations in CI claude -p "translate new strings into French and raise a PR for review" # Bulk operations across files git diff main --name-only | claude -p "review these changed files for security issues" ``` -------------------------------- ### Create install directory and set ownership Source: https://code.claude.com/docs/en/troubleshoot-install If either directory isn't writable, create `~/.local/bin` and set your user as the owner of `~/.local`. ```bash sudo mkdir -p ~/.local/bin sudo chown -R $(whoami) ~/.local ``` -------------------------------- ### Set up marketplace directory and copy plugin Source: https://code.claude.com/docs/en/plugins/create-marketplace Creates the marketplace directory with a .claude-plugin/ folder and copies the plugin under plugins/. Run from the directory where my-marketplace/ should be created. ```bash mkdir -p my-marketplace/.claude-plugin my-marketplace/plugins cp -r my-first-plugin my-marketplace/plugins/ ``` -------------------------------- ### Install Claude Code with Homebrew cask Source: https://code.claude.com/docs/en/setup Installs the stable `claude-code` cask on macOS. Homebrew installations do not auto-update; run `brew upgrade claude-code` to get the latest features and security fixes. ```bash brew install --cask claude-code ``` -------------------------------- ### Install Claude Code with WinGet Source: https://code.claude.com/docs/en/setup Installs Claude Code on Windows via WinGet. WinGet installations do not auto-update; run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes. ```powershell winget install Anthropic.ClaudeCode ``` -------------------------------- ### Ask where the main entry point is Source: https://code.claude.com/docs/en/quickstart Example prompt to locate the project's main entry point. ```text where is the main entry point? ``` -------------------------------- ### Configure team shared settings in .claude/settings.json Source: https://code.claude.com/docs/en/settings-example Example .claude/settings.json defining permissions (allow npm scripts, ask before git push, deny env/secret reads), a PreToolUse Bash hook, plugin marketplace registration, sandbox filesystem/network rules, and plansDirectory. A plugin from an external source such as a GitHub repository still needs each person to install it once. ```jsonc { "permissions": { // Run npm scripts without asking "allow": [ "Bash(npm run *)" ], // Confirm before git push commands "ask": [ "Bash(git push *)" ], // Deny reads of env files and the secrets folder by the file tools and file-reading commands "deny": [ "Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)" ] }, // Before every Bash command, run a script in the repo that can block it "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/block-rm.sh" } ] } ] }, // Register the team's plugin marketplace on every clone "extraKnownMarketplaces": { "acme-tools": { "source": { "source": "github", "repo": "acme-corp/claude-plugins" } } }, // Enable one plugin from that marketplace; a plugin from an external source such as a GitHub repository still needs each person to install it once "enabledPlugins": { "code-formatter@acme-tools": true }, // Sandbox commands: writable build dir; npm and example.com pre-allowed "sandbox": { "enabled": true, "filesystem": { "allowWrite": [ "/tmp/build" ] }, "network": { "allowedDomains": [ "registry.npmjs.org", "*.example.com" ] } }, // Keep plan files inside the repo "plansDirectory": "./plans" } ``` -------------------------------- ### Install Claude Code on Windows CMD Source: https://code.claude.com/docs Use this in CMD, where your prompt shows `C:\` without the `PS`. If you see `The token '&&' is not a valid statement separator`, you are in PowerShell instead. ```batch curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd ``` -------------------------------- ### Add a SessionStart hook to .claude/settings.json to run install_pkgs.sh Source: https://code.claude.com/docs/en/cloud-environments Configure this in your repo's `.claude/settings.json` so Claude Code runs `scripts/install_pkgs.sh` on `startup` and `resume` events. `$CLAUDE_PROJECT_DIR` resolves to the repository root, so the script is found regardless of the session's working directory. ```json { "hooks": { "SessionStart": [ { "matcher": "startup|resume", "hooks": [ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR\"/scripts/install_pkgs.sh" } ] } ] } } ``` -------------------------------- ### Install a plugin with /plugin install Source: https://code.claude.com/docs/en/plugins/install Run in a Claude Code session to open the /plugin panel on the plugin's details so you can review it and choose a scope before installing. Substitute the plugin name and marketplace name for other plugins. ```text /plugin install commit-commands@claude-plugins-official ``` -------------------------------- ### Install Claude Code on Windows PowerShell Source: https://code.claude.com/docs Use this in PowerShell, where your prompt shows `PS C:\`. If you see `'irm' is not recognized as an internal or external command`, you are in CMD instead. ```powershell irm https://claude.ai/install.ps1 | iex ``` -------------------------------- ### Start lead with pre-approved permissions via --settings Source: https://code.claude.com/docs/en/agent-teams Use this shell command to start the lead with permissions.allow rules so that actions are pre-approved for the lead and each split-pane teammate for that session. This is needed because --allowedTools alone isn't passed to split-pane teammates. ```shell claude --settings '{"permissions":{"allow":["Bash(npm *)"]}}' ``` -------------------------------- ### Add a Marketplace and Install a Plugin from the Shell Source: https://code.claude.com/docs/en/plugins/publish Users add the marketplace once with a GitHub owner/repo shorthand, URL, or path, then install the plugin from it. Replace the source and names with your own. ```shell claude plugin marketplace add your-org/your-marketplace ``` ```shell claude plugin install deploy-helper@your-marketplace ``` -------------------------------- ### Install through a corporate proxy on macOS/Linux Source: https://code.claude.com/docs/en/troubleshoot-install Set HTTP_PROXY and HTTPS_PROXY to your proxy address, then run the installer through the proxy. Ask IT for the proxy URL if unknown. ```bash export HTTP_PROXY=http://proxy.example.com:8080 export HTTPS_PROXY=http://proxy.example.com:8080 curl -fsSL https://claude.ai/install.sh | bash ``` -------------------------------- ### Create commits with claude CLI Source: https://code.claude.com/docs Ask Claude Code to stage changes and write a descriptive commit message. Claude Code works directly with git for commits, branches, and pull requests. ```bash claude "commit my changes with a descriptive message" ``` -------------------------------- ### Run the build-mcp-server skill Source: https://code.claude.com/docs/en/mcp After installing the plugin, run this skill to have Claude ask about your use case and scaffold a remote HTTP or local stdio server. ```text /mcp-server-dev:build-mcp-server ``` -------------------------------- ### Run the checkpointing example with Python Source: https://code.claude.com/docs/en/agent-sdk/file-checkpointing Run the script from the same directory as your utility file. The agent adds doc comments, then prompts whether to rewind. ```bash python try_checkpointing.py ``` -------------------------------- ### Automate tedious tasks with claude CLI Source: https://code.claude.com/docs Run a one-shot prompt to write tests, run them, and fix failures for a module. Useful for automating work like untested code, lint errors, and merge conflicts. ```bash claude "write tests for the auth module, run them, and fix any failures" ``` -------------------------------- ### Start Ultraplan cloud planning with /ultraplan Source: https://code.claude.com/docs/en/whats-new/2026-w15 Kicks off plan mode in a Claude Code on the web session from your terminal; the plan can then be reviewed in the browser. As of v2.1.101 the first run auto-creates a default cloud environment, so no web setup step is needed. ```text /ultraplan migrate the auth service from sessions to JWTs ``` -------------------------------- ### Install a plugin from a marketplace in your shell Source: https://code.claude.com/docs/en/plugins/mods/overview Run in your shell to install the token-chart plugin from the your-org marketplace. If a session is open, run /reload-plugins in that session to load it. ```shell claude plugin install token-chart@your-org ``` -------------------------------- ### Install stable version on Windows PowerShell Source: https://code.claude.com/docs/en/setup Installs the stable release channel on Windows PowerShell by passing `stable` to the install script. ```powershell & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable ``` -------------------------------- ### Create a project from a description Source: https://code.claude.com/docs/en/terminal-guide Use this prompt to have Claude create a project from a plain-English description. If Claude asks for permission before creating or changing files, press Enter to choose Yes and approve. ```text make me a simple webpage that says hello world ``` -------------------------------- ### Install specific version 2.1.89 on Windows PowerShell Source: https://code.claude.com/docs/en/setup Installs a specific version number on Windows PowerShell by passing the version to the install script. ```powershell & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 2.1.89 ``` -------------------------------- ### Install Git LFS and initialize it Source: https://code.claude.com/docs/en/desktop Run this when a session reports "Git LFS is required by this repository but is not installed." Install Git LFS from git-lfs.com first, then run the command and restart the app. ```shell git lfs install ``` -------------------------------- ### Add a local stdio MCP server from an npx launch command with --env and -- Source: https://code.claude.com/docs/en/mcp Use when setup instructions give a launch command such as npx, uvx, or a binary. Put the whole command after -- so flags like -y go to the server, and pass environment variables with --env before the -- separator. ```bash claude mcp add example --env API_KEY=your-key -- npx -y @example/mcp-server ``` -------------------------------- ### Install stable version on macOS, Linux, WSL Source: https://code.claude.com/docs/en/setup Installs the stable release channel on macOS, Linux, and WSL by passing `stable` to the install script. ```bash curl -fsSL https://claude.ai/install.sh | bash -s stable ``` -------------------------------- ### Add personal preferences via setup script writing ~/.claude/CLAUDE.md Source: https://code.claude.com/docs/en/cloud-environments Use a setup script in an Anthropic-hosted environment to write ~/.claude/CLAUDE.md with preferences you don't want in a shared repo. Put the script on your own environment, not a shared one. Run /context in the next cloud session to confirm /root/.claude/CLAUDE.md appears under Memory files. ```bash #!/bin/bash mkdir -p ~/.claude cat > ~/.claude/CLAUDE.md <<'EOF' Use conventional commit messages. EOF ``` -------------------------------- ### Install a plugin with claude plugin install Source: https://code.claude.com/docs/en/plugins/cli-reference Base syntax for installing a plugin from one of your marketplaces; `i` is an alias for `install`. Most plugins install without a prompt, but command-source or `headersHelper` plugins first print the command and ask `Run this command now? [y/N]`. ```bash claude plugin install [options] ``` -------------------------------- ### Install specific version 2.1.89 on macOS, Linux, WSL Source: https://code.claude.com/docs/en/setup Installs a specific version number on macOS, Linux, and WSL by passing the version to the install script. ```bash curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89 ``` -------------------------------- ### EACCES error when starting a background session Source: https://code.claude.com/docs/en/errors Error shown when Claude Code cannot spawn its own binary to start the background service, typically during an npm reinstall. On npm installations Claude Code retries automatically for up to ten seconds, or up to two minutes while an npm install is visibly running. ```text Couldn't start the background service — spawn background service: EACCES: permission denied, posix_spawn '/usr/local/lib/node_modules/@anthropic-ai/claude-code/bin/claude' ``` -------------------------------- ### Create utils.py test file with math functions Source: https://code.claude.com/docs/en/agent-sdk/file-checkpointing Create this utility file before running the checkpointing example. The agent will add doc comments to it, and the script can rewind to restore the original. ```python def add(a, b): return a + b def subtract(a, b): return a - b def multiply(a, b): return a * b def divide(a, b): if b == 0: raise ValueError("Cannot divide by zero") return a / b ``` -------------------------------- ### Install the ralph-loop plugin with claude plugin install Source: https://code.claude.com/docs/en/plugins/anthropic-marketplaces The ralph-wiggum plugin is now ralph-loop and its commands start with /ralph-loop:. Run this in your shell if those commands aren't available. ```shell claude plugin install ralph-loop@claude-plugins-official ``` -------------------------------- ### Install stable version on Windows CMD Source: https://code.claude.com/docs/en/setup Installs the stable release channel on Windows CMD by passing `stable` to install.cmd. ```batch curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd stable && del install.cmd ``` -------------------------------- ### Install specific version 2.1.89 on Windows CMD Source: https://code.claude.com/docs/en/setup Installs a specific version number on Windows CMD by passing the version to install.cmd. ```batch curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 2.1.89 && del install.cmd ``` -------------------------------- ### Run the plugin's skill /my-first-plugin:hello Source: https://code.claude.com/docs/en/plugins/create Run this once Claude Code starts; Claude replies with a greeting. The command combines the plugin name and the skill's name. ```text /my-first-plugin:hello ``` -------------------------------- ### Create the skill directory Source: https://code.claude.com/docs/en/plugins/create Each skill is a directory under skills/ that contains a SKILL.md file. This creates the hello skill's directory. ```bash mkdir -p my-first-plugin/skills/hello ``` -------------------------------- ### Print installation diagnostics with claude doctor Source: https://code.claude.com/docs/en/cli-reference Prints read-only installation and settings diagnostics without starting a session, including install health, settings-file validation errors, and Remote Control eligibility. ```shell claude doctor ``` -------------------------------- ### Slack/Teams tip: Three things to try in your first 10 minutes Source: https://code.claude.com/docs/en/communications-kit Ready-to-paste message with three starter prompts for fixing flaky tests, orienting in unfamiliar code, and reviewing a working diff. Requires only `cd` into the repo and running `claude`. ```markdown 🚀 *Tip: Three things to try in your first 10 minutes* Installed Claude Code but not sure what to actually ask it? Start with the stuff that has been bugging you all week. - Fix something annoying: "the test in [file] is flaky, figure out why" - Get oriented in code you didn't write: "walk me through how [module] works" - Sanity-check before you push: "look at my working diff and tell me what looks risky" None of these need setup. Just `cd` into your repo and run `claude`. *Try it now:* pick the bug you have been avoiding and paste the error message in. 📖 Quickstart → https://code.claude.com/docs/en/quickstart ``` -------------------------------- ### Install ripgrep on Alpine with apk Source: https://code.claude.com/docs/en/troubleshooting Install ripgrep on Alpine; it is in Alpine's community repository, so if apk reports the package missing, see the Alpine Linux setup docs. ```bash apk add ripgrep ``` -------------------------------- ### Install a plugin by naming its marketplace with /plugin install Source: https://code.claude.com/docs/en/plugins/troubleshooting Use when `/plugin install ` reports the plugin is not found in any marketplace. Naming the marketplace makes Claude Code refresh it before looking up the plugin. ```text /plugin install @ ``` -------------------------------- ### Install Claude Code globally with npm Source: https://code.claude.com/docs/en/setup Installs Claude Code as a global npm package. Requires Node.js 22 or later; on older versions npm prints an EBADENGINE warning but the install completes. Do not use sudo, since an install that needs sudo cannot update itself automatically. ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Slack/Teams tip: Stop re-explaining your repo with /init and CLAUDE.md Source: https://code.claude.com/docs/en/communications-kit Ready-to-paste message describing running `/init` once per repo to generate a CLAUDE.md with build commands, architecture, and conventions. Recommends keeping the file under two screens. ```markdown 📁 *Tip: Stop re-explaining your repo every session* Telling Claude "we use pnpm, not npm" for the fifth time? There is a one-time fix. Run `/init` once per repo. Claude reads your project structure and writes a CLAUDE.md file with your build commands, architecture, and conventions. Every future session in that repo starts from this file automatically. Keep it under two screens. It is a cheat sheet, not documentation. *Try it now:* open your main repo, run `claude`, type `/init`. Thirty seconds, pays off every session after. 📖 CLAUDE.md and project memory → https://code.claude.com/docs/en/memory ``` -------------------------------- ### Upgrade Homebrew installation of Claude Code Source: https://code.claude.com/docs/en/setup Homebrew installations do not auto-update by default. Run the command matching the cask you installed; Homebrew keeps old versions on disk, so run brew cleanup periodically to reclaim space. ```shell brew upgrade claude-code ``` ```shell brew upgrade claude-code@latest ``` -------------------------------- ### Fix SSL/TLS error on Windows by setting TLS 1.2 and installing Source: https://code.claude.com/docs/en/terminal-guide Run this line first on older Windows 10 systems when you encounter an SSL/TLS error, then retry the install. It sets the security protocol to TLS 1.2 and runs the PowerShell install script. ```powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 irm https://claude.ai/install.ps1 | iex ``` -------------------------------- ### Open settings panel with /config Source: https://code.claude.com/docs/en/memory Type in your session to open the settings panel and confirm Project instructions isn't set to claude-md or managed-only. If the setting isn't shown at all, the session can't load AGENTS.md. ```text /config ``` -------------------------------- ### Run a throwaway Postgres container for local development Source: https://code.claude.com/docs/en/claude-apps-gateway-config Starts a disposable Postgres instance on port 5432 with trust authentication; point store.postgres_url at it for local development. ```shell docker run --rm -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres ``` -------------------------------- ### Verify installation with claude --version Source: https://code.claude.com/docs/en/setup Confirms Claude Code is working; a working installation prints a version number such as 2.1.211 (Claude Code). If it fails with command not found or another error, see the installation troubleshooting docs. ```bash claude --version ``` -------------------------------- ### Install required packages on Alpine with apk add Source: https://code.claude.com/docs/en/setup Installs bash, curl, libgcc, libstdc++, and ripgrep, which Claude Code needs on Alpine and other musl/uClibc-based distributions. Without bash and curl the install command fails with a not found error. ```bash apk add bash curl libgcc libstdc++ ripgrep ``` -------------------------------- ### Install a plugin with claude plugin marketplace add and claude plugin install Source: https://code.claude.com/docs/en/plugins/publish If you maintain a CLI or SDK, publish the plugin in a marketplace and have your installer or post-install message run or print these two commands for users. The first adds the marketplace source, the second installs the plugin by name. ```shell claude plugin marketplace add ``` ```shell claude plugin install @ ``` -------------------------------- ### Add Claude Code install directory to PATH in PowerShell Source: https://code.claude.com/docs/en/terminal-guide If 'claude is not recognized' and the install directory isn't in your PATH, run these commands to add it. Then close PowerShell, open a new window, and try `claude` again. ```powershell $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User') ``` -------------------------------- ### Find Git installation path using Get-Command in PowerShell Source: https://code.claude.com/docs/en/terminal-guide If your Git is installed somewhere else, run this command to find the path. Look for the `Git\bin` folder in the output and use it to set the CLAUDE_CODE_GIT_BASH_PATH variable. ```powershell Get-Command git | Select-Object Source ``` -------------------------------- ### Open a Claude Desktop SSH session from a claude://code/new link Source: https://code.claude.com/docs/en/desktop A `claude://code/new` link can name an SSH connection and prefill a prompt. This example targets user `dev` on `build.example.com`, port 2222, folder `/srv/payments`, with a prompt. Requires Claude Desktop v2.110.0 or later. ```text claude://code/new?ssh_host=dev%40build.example.com&ssh_port=2222&ssh_folder=/srv/payments&q=Investigate%20the%20failed%20deploy ``` -------------------------------- ### Install the Claude Security plugin from the official marketplace Source: https://code.claude.com/docs/en/whats-new/2026-w30 Install claude-security from the official Anthropic marketplace, then run /reload-plugins and start a scan with /claude-security. ```text > /plugin install claude-security@claude-plugins-official ``` -------------------------------- ### Build a vscode:// install-plugin URL Source: https://code.claude.com/docs/en/vs-code Use this URL format to send someone straight to installing a specific plugin in VS Code. Opening it launches or focuses VS Code, opens the Claude Code panel, and opens the Manage plugins dialog on that plugin's scope choice; nothing installs until a scope is picked. The URL takes a required `plugin` parameter and an optional `marketplace` parameter that defaults to `anthropics/claude-plugins-official`. ```text vscode://anthropic.claude-code/install-plugin?plugin=code-review&marketplace=anthropics/claude-plugins-official ``` -------------------------------- ### Uninstall a native installation on macOS, Linux, WSL Source: https://code.claude.com/docs/en/setup Removes the Claude Code binary and version files from the local install directory. Run in a shell on macOS, Linux, or WSL. ```bash rm -f ~/.local/bin/claude rm -rf ~/.local/share/claude ``` -------------------------------- ### Ask which technologies the project uses Source: https://code.claude.com/docs/en/quickstart Example prompt for a more specific question about the project's technology stack. ```text what technologies does this project use? ``` -------------------------------- ### Install Claude Code natively on Windows PowerShell Source: https://code.claude.com/docs/en/setup Run this in PowerShell to install Claude Code on Windows. If you see `The token '&&' is not a valid statement separator`, you are in PowerShell rather than CMD. ```powershell irm https://claude.ai/install.ps1 | iex ``` -------------------------------- ### Plugin directory layout for a skill under skills/ Source: https://code.claude.com/docs/en/plugins/components Place each skill in its own directory under skills/ with a SKILL.md file. The example shows the resulting plugin structure for a skill named review. ```text my-plugin/ ├── .claude-plugin/ │ └── plugin.json └── skills/ └── review/ └── SKILL.md ``` -------------------------------- ### Install Claude Code natively on macOS, Linux, or WSL Source: https://code.claude.com/docs/en/setup Run this command in a terminal to install Claude Code on macOS, Linux, or WSL. The installer shows no progress while downloading; after it finishes, open a new terminal and run `claude --version` to confirm. ```bash curl -fsSL https://claude.ai/install.sh | bash ``` -------------------------------- ### Install the Agent SDK with uv for Python Source: https://code.claude.com/docs/en/agent-sdk/quickstart Requires uv, which handles virtual environments automatically. Initializes a project and adds the claude-agent-sdk package. ```bash uv init uv add claude-agent-sdk ``` -------------------------------- ### Register the apt stable repository and install claude-code Source: https://code.claude.com/docs/en/setup Configures the `stable` channel and installs the package. To upgrade later, run `sudo apt update && sudo apt upgrade claude-code`. ```bash echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \ | sudo tee /etc/apt/sources.list.d/claude-code.list sudo apt update sudo apt install claude-code ``` -------------------------------- ### Install Claude Code natively on Windows CMD Source: https://code.claude.com/docs/en/setup Run this in CMD to install Claude Code on Windows. If you see `'irm' is not recognized as an internal or external command`, you are in CMD rather than PowerShell. ```batch curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd ``` -------------------------------- ### Register a /standup command and handle command.run Source: https://code.claude.com/docs/en/plugins/mods/api Register the command in session.start, then handle command.run filtered to 'standup'. e.args holds the text typed after the command name; the returned text prints in the transcript and Claude reads it. ```javascript on('session.start', async ($, e, next) => { // Add /standup to the command list, with the description the user sees there await $.command.register({ name: 'standup', description: 'Summarize what changed today', argumentHint: '[days]' }) return next(e) }) // The matcher limits the hook to /standup, so other commands don't reach it on('command.run', { command: 'standup' }, async ($, e) => { // e.args is the text typed after the command name, or an empty string return { text: 'Summary for the last ' + (e.args || '1') + ' day(s): ...' } }) ``` -------------------------------- ### Set CLAUDE_CODE_GIT_BASH_PATH environment variable in PowerShell Source: https://code.claude.com/docs/en/terminal-guide If Git is installed but Claude Code cannot find it, set this environment variable to point to the Git Bash executable. Then run `claude` again. ```powershell $env:CLAUDE_CODE_GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe" ``` -------------------------------- ### Add a git repository marketplace on any host Source: https://code.claude.com/docs/en/plugins/install Adds a marketplace from a full clone URL; append `#ref` to pin a branch or tag. Include the `https://` prefix or use the `git@host:path` SSH form, otherwise Claude Code reads it as GitHub `owner/repo` shorthand and rejects it. ```bash /plugin marketplace add https://gitlab.example.com/your-group/your-marketplace.git#v1.0.0 ``` -------------------------------- ### Install marketplace and plugin into a seed directory at build time Source: https://code.claude.com/docs/en/plugins/org Set CLAUDE_CODE_PLUGIN_CACHE_DIR to the seed path so the marketplace and plugins install there instead of ~/.claude/plugins. Run both commands at build time to pre-populate the seed. ```bash CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin marketplace add your-org/your-marketplace CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin install code-formatter@your-marketplace ``` -------------------------------- ### Configure the dnf stable repository and install claude-code Source: https://code.claude.com/docs/en/setup For Fedora and RHEL, this writes the repo file for the `stable` channel and installs the package. dnf prompts you to confirm the fingerprint `31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE` on first install. ```bash sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF' [claude-code] name=Claude Code baseurl=https://downloads.claude.ai/claude-code/rpm/stable enabled=1 gpgcheck=1 gpgkey=https://downloads.claude.ai/keys/claude-code.asc EOF sudo dnf install claude-code ``` -------------------------------- ### Scaffold a plugin with claude plugin init Source: https://code.claude.com/docs/en/plugins/create Run from your shell to create a starter plugin at ~/.claude/skills/my-tool/ containing .claude-plugin/plugin.json and a root SKILL.md. It prints a confirmation and auto-loads next session as my-tool@skills-dir; use /reload-plugins to load it immediately. ```shell claude plugin init my-tool ``` -------------------------------- ### Uninstall the global npm package Source: https://code.claude.com/docs/en/setup Removes the globally installed @anthropic-ai/claude-code npm package. ```bash npm uninstall -g @anthropic-ai/claude-code ``` -------------------------------- ### Install skill-creator plugin from the official marketplace Source: https://code.claude.com/docs/en/skills Run this at the Claude Code prompt to install the skill-creator plugin, which automates the baseline comparison loop for evaluating a skill. If the install fails, match the reported error message to the documented fixes. ```text /plugin install skill-creator@claude-plugins-official ``` -------------------------------- ### Configure the apk stable repository and install claude-code Source: https://code.claude.com/docs/en/setup For Alpine Linux, downloads the RSA public key, adds the `stable` repository, and installs the package. Verify the key with `sha256sum /etc/apk/keys/claude-code.rsa.pub`, which should report `395759c1f7449ef4cdef305a42e820f3c766d6090d142634ebdb049f113168b6`. ```sh wget -O /etc/apk/keys/claude-code.rsa.pub \ https://downloads.claude.ai/keys/claude-code.rsa.pub echo "https://downloads.claude.ai/claude-code/apk/stable" >> /etc/apk/repositories apk add claude-code ``` -------------------------------- ### npm ENOTEMPTY error output during update or reinstall Source: https://code.claude.com/docs/en/troubleshoot-install Example output when npm fails moving the old package directory aside while installing over an existing installation. The `npm error path` line names the directory npm couldn't move. ```text npm error code ENOTEMPTY npm error syscall rename npm error path /home/you/.nvm/versions/node/v22.13.1/lib/node_modules/@anthropic-ai/claude-code npm error dest /home/you/.nvm/versions/node/v22.13.1/lib/node_modules/@anthropic-ai/.claude-code-tVWAnUUt npm error errno -39 npm error ENOTEMPTY: directory not empty, rename '...' ``` -------------------------------- ### Run Setup hooks with --init Source: https://code.claude.com/docs/en/cli-reference Runs Setup hooks with the init matcher before the session. Print mode only. ```bash claude -p --init "query" ``` -------------------------------- ### Upgrade WinGet installation of Claude Code Source: https://code.claude.com/docs/en/setup WinGet installations do not auto-update by default. The upgrade may fail while Claude Code is running because Windows locks the executable, in which case Claude Code shows the manual command instead. ```shell winget upgrade Anthropic.ClaudeCode ``` -------------------------------- ### Create first-mod plugin directories with New-Item (PowerShell) Source: https://code.claude.com/docs/en/plugins/mods/create PowerShell equivalent of the directory setup, creating the .claude-plugin and hooks directories for the mod. ```powershell New-Item -ItemType Directory -Force first-mod\.claude-plugin, first-mod\hooks ``` -------------------------------- ### Configure a preview server in .claude/launch.json Source: https://code.claude.com/docs/en/desktop Defines a preview server configuration in .claude/launch.json at the root of the selected folder. Edit this file to customize the start command (e.g., yarn dev instead of npm run dev) or change the port; the file supports JSON with comments. ```json { "version": "0.0.1", "configurations": [ { "name": "my-app", "runtimeExecutable": "npm", "runtimeArgs": ["run", "dev"], "port": 3000 } ] } ``` -------------------------------- ### Fix 'command not found: claude' in Bash on Linux by adding ~/.local/bin to PATH Source: https://code.claude.com/docs/en/terminal-guide Run this if you see 'command not found: claude' after installing and your shell is Bash on Linux. It appends the installer's bin directory to PATH in ~/.bashrc and reloads the file. Then open a new terminal and try `claude` again. ```bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Fix 'command not found: claude' in Zsh by adding ~/.local/bin to PATH Source: https://code.claude.com/docs/en/terminal-guide Run this if you see 'command not found: claude' after installing and your shell is Zsh (the macOS default). It appends the installer's bin directory to PATH in ~/.zshrc and reloads the file. Then open a new terminal and try `claude` again. ```bash echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc ``` -------------------------------- ### Configure an npm plugin source with package, version, and registry Source: https://code.claude.com/docs/en/plugins/marketplace-reference Use an npm source to fetch a registry package with your npm client. Install scripts such as `preinstall` and `postinstall` never run and dependencies aren't installed during the fetch; `version` applies only when `package` has no appended version, and omitting it fetches `latest`. The `registry` URL must use https unless it is the user's own default npm registry. ```json { "name": "formatter", "source": { "source": "npm", "package": "@your-org/formatter", "version": "^2.0.0", "registry": "https://npm.example.com" } } ``` -------------------------------- ### Install the mcp-server-dev plugin Source: https://code.claude.com/docs/en/mcp Run this at the Claude Code prompt to install the official mcp-server-dev plugin. In the VS Code extension or desktop app, use the Install a plugin flow instead. ```text /plugin install mcp-server-dev@claude-plugins-official ``` -------------------------------- ### Uninstall the stable Homebrew cask claude-code Source: https://code.claude.com/docs/en/setup Removes the stable Homebrew cask. Use this if you installed the stable cask. ```bash brew uninstall --cask claude-code ``` -------------------------------- ### Install the Agent SDK for a new TypeScript project Source: https://code.claude.com/docs/en/agent-sdk/quickstart Initializes a new npm project, sets type=module so the agent script can use top-level await, and installs the SDK plus tsx to run TypeScript files directly. npm prints `added N packages` when the install succeeds. ```bash npm init -y npm pkg set type=module npm install @anthropic-ai/claude-agent-sdk npm install --save-dev tsx ``` -------------------------------- ### Create a new branch called feature/quickstart Source: https://code.claude.com/docs/en/quickstart Example of a more complex Git operation: creating a new branch. ```text create a new branch called feature/quickstart ``` -------------------------------- ### Uninstall the latest Homebrew cask claude-code@latest Source: https://code.claude.com/docs/en/setup Removes the latest Homebrew cask. Use this if you installed the latest cask. ```bash brew uninstall --cask claude-code@latest ``` -------------------------------- ### Update README with installation instructions Source: https://code.claude.com/docs/en/quickstart Prompt asking Claude to update the README with installation instructions. ```text update the README with installation instructions ```