![]() |
VOOZH | about |
Get leet @ Anthropic's Claude Code with this cheatsheet, including config, CLI commands, advanced features, and best practices for faster dev + test.
by Shipyard Team on Apr 24, 2026
Claude Code is Anthropic’s agentic coding tool that lives in your terminal and for now is SOTA for coding. This cheatsheet should give you everything you need to install, config, and use Claude Code for now…
If you’re brand new to Claude Code, check out this guide.
Once you have a Claude Pro or Max subscription (or are paying for API access), you can start using Claude Code from your terminal or the web.
(Our advice: opt for the subscription if you’re using it consistently and at a reasonable rate. It’s worth getting API tokens if you don’t want to deal with token refresh windows).
Install globally:
npm install -g @anthropic-ai/claude-code
Prereqs: Node.js 18 or newer
Diagnose issues:
claude doctor
Set up your Anthropic API key before launching CC.
Get your key: Get an API key from the Anthropic Console.
Set your key: Set the ANTHROPIC_API_KEY env var:
export ANTHROPIC_API_KEY="YOUR_ANTHROPIC_API_KEY"
Alternatively, if you have a Pro or Max plan, you’ll have the option to auth via your browser.
Add this to your shell profile (e.g., ~/.bashrc, ~/.zshrc) to persist across sessions.
Interactive mode (REPL): Start a conversational coding session.
claude
REPL with initial prompt: Start with a specific question.
claude "explain this project"
Print mode: Query once and exit (great for scripting).
claude -p "explain this function"
Piping content: Process piped input.
cat logs.txt | claude -p "explain these errors"
Continue recent conversation:
claude -c
Resume specific session:
claude -r "session-id" "continue working on this feature"
Claude Code is also available as an extension for VS Code and JetBrains IDEs. Once installed, you get a Claude Code panel inside your editor.
You’re able to write (or generate) files to configure CC’s basic behaviors.
Claude Code plans all grant you access to the three latest Claude models: Sonnet 4.6, Haiku 4.5, and Opus 4.6. Quick overview:
To change your model to one of these three, use the /model slash command.
To use a different Claude model, you can specify the model string with a flag:
claude --model claude-haiku-4-5-20251001
Claude Code uses hierarchical settings stored in JSON files:
~/.claude/settings.json (applies to all projects).claude/settings.json (shared with team, checked into git).claude/settings.local.json (personal, ignored by git)Example settings.json:
{
"model": "claude-sonnet-4-6",
"maxTokens": 4096,
"permissions": {
"allowedTools": ["Read", "Write", "Bash(git *)"],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Write(./production.config.*)"
]
},
"hooks": {
"PostToolUse": [
{
"matcher": "Write(*.py)",
"hooks": [
{
"type": "command",
"command": "python -m black $file"
}
]
}
]
}
}
Use CLAUDE.md files to give context and instructions to Claude. They save time + tokens, and are super helpful for info you’d otherwise include in your prompts. These are loaded hierarchically:
~/.claude/CLAUDE.md (applies to all projects)./CLAUDE.md (project-wide context)Example CLAUDE.md:
# Project context
## Coding standards
- Use TypeScript for all new code
- Follow existing ESLint configuration
- Write tests for all new functions using Jest
- Use functional components with hooks in React
## Architecture
- Frontend: Next.js with TypeScript
- Backend: Node.js with Express
- Database: PostgreSQL with Prisma
- State: Zustand for client state
## File organization
- Components in `src/components/`
- Utilities in `src/utils/`
- Tests alongside source files with `.test.ts` extension
You can use the following shell commands outside a Claude session.
| Command | Description | Example |
|---|---|---|
claude |
Start interactive REPL | claude |
claude "query" |
Start REPL with initial prompt | claude "explain this project" |
claude -p "query" |
Query via print mode, then exit | claude -p "review this code" |
claude -c |
Continue most recent conversation | claude -c |
claude -c -p "query" |
Continue in print mode | claude -c -p "run the tests" |
claude -r "id" "query" |
Resume session by ID | claude -r "abc123" "finish the PR" |
claude update |
Update to latest version | claude update |
claude mcp |
Configure MCP servers | claude mcp add server-name |
| Flag | Description | Example |
|---|---|---|
--add-dir |
Add additional working directories | claude --add-dir ../apps ../lib |
--allowedTools |
Allow specific tools without prompting | claude --allowedTools "Write" "Bash(git *)" |
--disallowedTools |
Block specific tools | claude --disallowedTools "Bash(rm *)" |
--model |
Use specific Claude model | claude --model claude-opus-4-6 |
--max-turns |
Limit conversation turns | claude -p --max-turns 3 "query" |
--output-format |
Set output format (text/json/stream-json) | claude -p --output-format json "query" |
--input-format |
Set input format | claude -p --input-format stream-json |
--verbose |
Enable verbose logging | claude --verbose |
--continue |
Continue most recent conversation | claude --continue |
--resume |
Resume specific session | claude --resume abc123 |
--dangerously-skip-permissions |
Skip all permission prompts (proceed with caution) | claude --dangerously-skip-permissions |
You can use these slash commands during a Claude Code session.
| Command | Description |
|---|---|
/help |
Show all commands + custom slash commands |
/config |
Configure Claude Code settings interactively |
/model |
Switch model for the current session |
/allowed-tools |
Configure tool permissions interactively |
/hooks |
Configure hooks |
/mcp |
Manage MCP servers |
/agents |
Manage subagents (create, edit, list) |
/fast |
Toggle fast output mode |
/compact |
Manually compress conversation context |
/clear |
Clear conversation history |
/doctor |
Diagnose CC-related issues |
/ide |
Connect to IDE extension |
/vim |
Enable vim-style editing mode |
/terminal-setup |
Install terminal shortcuts (Shift+Enter for iTerm2/VS Code) |
/install-github-app |
Set up GitHub Actions integration |
Note: The /help command shows all available slash commands, including your custom commands from .claude/commands/ and ~/.claude/commands/ directories, as well as any commands you have from connected MCP servers.
You can reference files or directories in your prompts. (If you don’t have an exact filename/location, CC can grep for it).
Single file:
> Review this component for accessibility issues. @./src/components/Button.tsx
Directory (recursive):
> Add comprehensive error handling to all API routes. @./src/api/
Multiple files:
> Compare these two implementations. @./src/old.js @./src/new.js
Glob patterns:
> Review all test files for completeness. @./src/**/*.test.ts
You can run shell commands directly in a Claude session. Use the ! to bypass Claude’s conversational mode, which will use more tokens to get the same result:
Single command:
> !npm test
Shell mode toggle:
> !
# Now in shell mode. type ! again to exit
We appreciate how customizable CC is, and it’s quite easy to extend it with a few features like custom commands, hooks, MCP, and stored prompts.
You can create your own CC slash commands. This is a good “shortcut” for pulling up a common prompt. Again, the more context the better (but also keep these abstract so they can be widely applied). Define them in Markdown files:
Project commands (.claude/commands/):
# Create a project-specific command
mkdir -p .claude/commands
echo "Analyze this code for performance issues and suggest optimizations:" > .claude/commands/optimize.md
Personal commands (~/.claude/commands/):
# Create a personal command for all projects
mkdir -p ~/.claude/commands
echo "Review this code for security vulnerabilities:" > ~/.claude/commands/security.md
Commands with arguments:
# Create parameterized command
echo 'Fix issue #$ARGUMENTS following our coding standards' > .claude/commands/fix-issue.md
# Use that command in a Claude session
> /fix-issue 123
Advanced command with context:
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
description: Create a git commit with context
---
## Context
- Current status: !`git status`
- Current diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
Create a meaningful commit message based on the changes above.
Hooks run shell commands automatically after specific prompts/events:
Example: Auto-format Python files
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write(*.py)",
"hooks": [
{
"type": "command",
"command": "python -m black \"$file\""
}
]
}
]
}
}
Hook events:
PreToolUse: Before tool execution (can block)PostToolUse: After tool executionUserPromptSubmit: Before processing user inputNotification: When Claude sends a notificationStop: When a session endsYou can extend what Claude Code can do by adding MCP servers:
Add MCP server:
claude mcp add my-server -e API_KEY=123 -- /path/to/server arg1 arg2
(Check your MCP tool’s docs to get the right syntax here.)
By default, MCP servers are added at project scope. Use --scope to control where the config is saved:
--scope project: shared with team, checked into git — .claude/settings.json (default)--scope local: personal, not shared — .claude/settings.local.json--scope global: applies to all projects — ~/.claude/settings.jsonCommon MCP use cases:
Skills are markdown-based guides that teach Claude Code how to handle specific tasks. Unlike slash commands, skills are invoked via natural language, so Claude decides when to use them.
Create a skill:
# add a blank skill to your project
mkdir -p .claude/skills/new-skill
Within that directory, create a SKILL.md file:
---
name: add-numbers
description: Add numbers from natural language input
---
# Add Numbers Skill
When the user asks you to add, sum, or total numbers:
1. Extract all numeric values from the prompt
2. Calculate the sum using `add.py`
3. Return the result with a brief explanation
Example: "add 15, 27, and 8" → "The sum is 50 (15 + 27 + 8)"
Claude will automatically reference the skill’s instructions, scripts, and templates. Check out Anthropic’s official skills for pdf, docx, pptx, xlsx, and more.
Subagents are specialized Claude instances with their own context windows and personas. Use them for domain-specific tasks (code review, debugging, architecture) to get better results and save tokens.
Create a subagent:
> /agents
# Follow prompts to define name, description, model, and persona
Subagent config (.claude/agents/reviewer.md):
---
name: reviewer
description: Use for thorough code reviews
model: sonnet
color: orange
---
You are an expert code reviewer. Focus on security, performance, and maintainability.
Claude will invoke subagents when tasks match their descriptions.
Auto mode lets Claude Code run autonomously. It’s ideal for longer tasks where you want to hand off and come back to the result.
You can enable it by running:
claude --permission-mode auto
Or by configuring this in your CC settings file:
{
"permissions": {
"defaultMode": "auto"
}
}
Read our full guide on Claude Code auto mode
Extended thinking is enabled by default. It lets Claude reason through complex problems before writing code/responding.
Toggle thinking:
Option+T (macOS) or Alt+T (Windows/Linux)/config to toggle globally (saves to ~/.claude/settings.json)View thinking output:
Press Ctrl+O to enable verbose mode so you can see Claude’s reasoning
Limit token budget:
export MAX_THINKING_TOKENS=10000
Note: You’re charged for thinking tokens. Phrases like “think harder” in your prompt don’t allocate additional tokens, so use the toggle instead.
Continue recent work:
claude --continue
claude --continue --print "show me our progress"
Resume specific session:
claude --resume # Shows picker
claude --resume session-id
Save and restore context: All CC conversations are auto-saved with full message history and tool state.
Here are a few different tasks that CC can help with. Remember, the more context, the better, so if you can provide specifics around your ask, Claude will give better results (and you’ll have fewer things to correct).
> Analyze this codebase structure and suggest improvements. @./src/
> Implement a user auth system with JWT tokens and password hashing
> Debug this error: "TypeError: Cannot read property 'id' of undefined" @./src/user-service.js
> Review this pull request for potential issues, performance problems, and adherence to our coding standards. @./src/
> Generate comprehensive unit tests for this utility module. @./src/utils/validation.js
> Refactor this class to use dependency injection and make it more testable. @./src/services/EmailService.js
> Generate API docs for all endpoints in this directory. @./src/routes/
# In GitHub Actions or other CI
claude -p "If there are any linting errors, fix them and suggest a commit message"
Claude Code defaults to asking permission for every single action it takes. If you trust it for a certain type of action (e.g. fetching links, reading files), you can grant it wider permissions. Most devs approve actions individually.
Claude Code lets you grant permissions as you see fit:
Tool permissions:
Read: File reading operationsWrite: File writing/modificationBash: Shell command executionMCP tools: External integrationsConfiguration examples:
{
"permissions": {
"allowedTools": [
"Read",
"Write(src/**)",
"Bash(git *)",
"Bash(npm *)"
],
"deny": [
"Read(.env*)",
"Write(production.config.*)",
"Bash(rm *)",
"Bash(sudo *)"
]
}
}
As with anything in dev, keep an eye on what permissions you’re granting, and watch which shell commands are being run. Also:
.claude/settings.local.json for personal/sensitive settings.env files; deny CC permission to theseIf you want to best plan out your Claude sessions, you’ll want to understand your constraints. Claude’s tokens are granted by plan based on overall server load, so on busier days you’ll get fewer.
If you’re not using the API for pay-as-you-go Claude access, you’ll want to choose the Claude tier that works best for you.
Sessions kick off as soon as you send your first message, and last five hours. If you’re using Opus, you’ll burn through tokens much faster.
It’s most token-efficient (and guarantees better outputs) if you start different sessions for different tasks.
Claude Code automatically compresses conversation context before hitting limits so long sessions don’t abruptly stop. You can also trigger this manually with /compact inside a session.
Here’s how you can track your token spend.
Extra resources
/help in your Claude sessionNeed to take CC to the next level? Give your AI agents ephemeral environments where they can deploy code, pull logs, and fix bugs autonomously. Try Shipyard free for 30 days.
AI agents help your team write code 2.5x faster. Don't let your infra hold you back.
Get full-stack, agent-ready environments on every pull request.
Hear about the latest and greatest in cloud native, agents, engineering, and more when you sign up for our monthly newsletter.