Session & Memory
/init
Initialize project with
CLAUDE.md. Creates your project's persistent instruction file read at every session start.โธ example
/init
โ output
โ CLAUDE.md created (18 lines)
Detected: Node.js ยท TypeScript ยท Jest
Added: project structure, test cmds, style notes
Claude will read this at every session start.
/memory
View and manage auto-memory files. Use
# prefix in the REPL to add things to memory without editing files.โธ example
/memory
โ output
Memory: ~/.claude/projects/.../memory/
user_role.md senior fullstack dev
feedback_testing.md run tests before commit
project_context.md auth refactor (compliance)
[E]dit [D]elete [N]ew
/resume
Resume a previous session.
/resume 1 for most recent, /resume name by name. Sessions are resumable up to 7 days.โธ example
/resume auth-refactor
โ output
Resuming: "auth-refactor" (2h ago ยท 34 msgs)
Last action: edited src/auth/middleware.ts
Context restored. Continue where you left off.
/rename
Name the current session for easy resuming later.
โธ example
/rename auth-refactor
โ output
Session renamed โ "auth-refactor"
Resume later with: /resume auth-refactor
/clear
Clear conversation history. Keeps files and memory intact โ only the chat context is wiped.
โธ example
/clear
โ output
Conversation cleared (47 messages removed).
Files, memory, and tool state are intact.
/compact
Condense conversation history to free up context. Optionally focus:
/compact focus on testsโธ example
/compact focus on the failing tests
โ output
Compacted: 112 messages โ 14 (87% reduction)
Summary anchored on: test failures in auth.test.ts
Context freed: ~82k tokens
/context
View context window usage with actionable suggestions on when to compact.
โธ example
/context
โ output
Context window: โโโโโโโโโโโโโโโโโ 58%
Used: 116,842 / 200,000 tokens
System + tools: 18k
Conversation: 74k
Files in scope: 24k
โก Suggestion: /compact when above 75%
/export
Export the conversation transcript to a file.
โธ example
/export
โ output
โ Transcript exported
File: claude-session-2026-07-18-14-32.md
Messages: 47 ยท Code blocks: 12
/rewind
Return to a prior checkpoint. Also triggered by pressing Esc Esc.
โธ example
/rewind
โ output
Reverted to checkpoint before last response.
3 file edits undone:
src/auth/middleware.ts
src/auth/types.ts
tests/auth.test.ts
/branch
Branch the conversation for parallel exploration without affecting your main session.
โธ example
/branch
โ output
Branched from turn 23. Branch ID: br_a4f2c9
Explore freely โ main session is unaffected.
Merge back or discard when done.
Model & Effort
/model
Switch model mid-session. Options:
sonnet (default), opus, haiku, fable. Also Alt+P while typing.โธ example
/model opus
โ output
Model โ claude-opus-4-8
Effort: medium
Best for: complex reasoning, agentic tasks
/effort
Set reasoning effort:
low, medium, high, xhigh. Use xhigh with Opus for hardest agentic work.โธ example
/effort xhigh
โ output
Effort โ xhigh
Claude will reason more deeply before responding.
Recommended pairing: /model opus
/fast
Toggle fast output mode โ uses Opus with optimized output speed.
โธ example
/fast
โ output
Fast mode ON
Using Opus 4.8 with optimized output speed.
Toggle off: /fast
/usage
View token usage, cost, and plan limits.
/cost and /stats are shortcuts that open specific tabs here.โธ example
/usage
โ output
Session usage
Input tokens: 142,330
Output tokens: 18,440
Cache hits: 89,200 (63%)
Estimated cost: $0.38
Plan: Pro ยท Resets: Aug 1
/status
View current session state: active model, permission mode, and settings summary.
โธ example
/status
โ output
Model: claude-sonnet-4-6
Mode: acceptEdits
Effort: medium ยท Fast: off
Session: "auth-refactor" (2h 14m)
Working dir: /Users/me/my-project
Autonomous Work
/loop agentic
Run a prompt or command on a repeating interval.
/loop 3h check PRs, /loop 5m /my-skill, or bare /loop for self-paced maintenance. Stop with /loop stop.โธ example
/loop 5m check for new failing tests
โ output
Loop started โบ
Interval: every 5 minutes
Task: check for new failing tests
Wakeup #1: 14:47
Stop with: /loop stop or Ctrl+C
/goal v2.1.139+
Set a completion condition; Claude keeps going autonomously until the condition is met. Uses a fast model to evaluate after each turn.
โธ example
/goal all tests pass
โ output
Goal set: "all tests pass"
Running autonomously...
โ Turn 1: 3 tests failing in auth.test.ts
โ Fixing middleware null check...
โ Turn 2: All 47 tests passing
Goal reached in 2 turns. Stopping.
/plan
Enter plan mode โ Claude outlines the approach before touching any files. Best before large refactors.
โธ example
/plan refactor the auth module
โ output
Plan: Refactor auth module
Phase 1 โ Audit (read-only)
โข Read src/auth/*.ts (6 files)
โข Identify session token issues
Phase 2 โ Restructure
โข Split middleware.ts โ validator + session
โข Update imports in 4 consumers
Phase 3 โ Test: jest --testPathPattern=auth
Approve to begin โ [Y/n]
/batch
Run batch operations across multiple files or targets in parallel.
โธ example
/batch add JSDoc to all files in src/utils/
โ output
Batch: 8 files in src/utils/
โ formatDate.ts โ 3 functions documented
โ validators.ts โ 7 functions documented
โ http.ts โ 4 functions documented
... (5 more)
Completed in 12s ยท 0 errors
/tasks
List all background agents currently running in this session.
โธ example
/tasks
โ output
Background agents (2 running)
[1] โ pr-reviewer Running 1m 34s
[2] โ test-watcher Running 4m 02s
/tasks stop 1 to stop agent #1
/bashes
List background bash tasks spawned by Claude.
โธ example
/bashes
โ output
Background bash tasks (1 running)
[1] โ npm run build Running 0m 48s PID 83421
Output: /tasks output 1
Stop: /tasks stop 1
Tip:
/loop vs /goal โ use /loop when you want Claude to wake up on a schedule. Use /goal when you want Claude to keep working until a condition is true.
Code Quality
/code-review
Find correctness bugs. Supports effort levels:
/code-review medium, /code-review ultra. Use --fix to auto-apply, --comment to post inline GitHub PR comments.โธ example
/code-review --fix
โ output
Reviewing diff (14 files, +342/-89 lines)...
โ HIGH src/api/users.ts:42 SQL injection via userId
โ MED src/auth/session.ts:18 Missing null check
โ LOW src/utils/format.ts:7 Unnecessary re-render
Applying 2 fixes (HIGH + MED)...
โ Fixed. Review LOW finding manually.
/security-review
Review code specifically for security vulnerabilities โ OWASP Top 10, secrets in code, injection risks.
โธ example
/security-review
โ output
Security review: 23 files on current branch
CRITICAL src/api/upload.ts:31 Path traversal
HIGH src/auth/tokens.ts:14 Token in localStorage
HIGH .env.example Real API key โ rotate!
LOW src/utils/log.ts:8 Email in plaintext logs
4 findings ยท 1 critical ยท 2 high ยท 1 low
/claude-api
Get help building apps with the Anthropic SDK โ tool use, batch processing, MCP integration, streaming, prompt caching.
โธ example
/claude-api
โ output
Claude API Reference loaded. Ask me about:
โข Model IDs, pricing, rate limits
โข Tool use / function calling
โข Streaming responses
โข MCP server setup & tool definitions
โข Batch API & prompt caching
Parallel & Agents
/agents
Open Agent View โ an operations screen for running, blocked, and completed Claude Code sessions. Up to 10 subagents can run in parallel.
โธ example
/agents
โ output
Agent View โโโโโโโโโโโโโโโโโโโโโโโโโ
[1] โ pr-reviewer Running 2m 11s
[2] โ test-watcher Running 8m 03s
[3] โ docs-builder Complete --
[S]top [V]iew output [N]ew agent
/skills
List installed skills with a type-to-filter search box. Skills are prompt-based commands stored in
.claude/skills/.โธ example
/skills
โ output
Installed skills (6)
/deep-research Multi-source cited research report
/code-review Review diff at configurable effort
/security-review OWASP-focused security audit
/run Launch and test the app live
/verify Verify a change works in the app
/pr-review Review open PRs [custom]
/add-dir
Expand file access by adding additional working directories to the session.
โธ example
/add-dir ../shared-utils
โ output
โ Added to session scope:
/Users/me/shared-utils (47 files ยท 12.3k lines)
Claude can now read and edit files here.
Config & Permissions
/config
Open the full settings interface interactively.
โธ example
/config
โ output
Settings โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Model claude-sonnet-4-6
Effort medium
Theme dark
Permission acceptEdits
Auto-memory enabled
Hooks 3 configured
MCP servers 2 active
[Tab] navigate [Enter] edit [Q] quit
/permissions
Manage permission settings interactively โ what Claude can read, edit, and execute.
โธ example
/permissions
โ output
Permissions โโโโโโโโโโโโโโโโโโโโโโโโ
โ Read files all paths
โ Edit files all paths
โ Bash: git * allowed
โ Bash: npm test allowed
โ Bash: rm -rf blocked
[A]dd [R]emove [M]ode [Q]uit
/hooks
View current hook configuration. Hooks fire on events like
PreToolUse, PostToolUse, Stop, etc.โธ example
/hooks
โ output
Hooks (3 configured)
PreToolUse โ lint check before file edits
PostToolUse โ run tests after Bash(git commit *)
Stop โ notify Slack #dev-alerts
Source: .claude/settings.json
/mcp
Configure MCP servers.
/mcp enable, /mcp disable. MCP expands Claude's tool access to external services.โธ example
/mcp enable github
โ output
MCP server "github" enabled.
Tools added: list_repos, create_pr,
get_issue (+12 more)
Auth: OAuth (already connected)
Active MCP servers: github, slack
/doctor
Full setup checkup โ diagnoses and fixes environment issues. Alias:
/checkupโธ example
/doctor
โ output
Claude Code Health Check โโโโโโโโโโโ
โ CLI version 2.1.205 (latest)
โ Node.js v20.11.0
โ Auth logged in (anandhu-eng)
โ Git 2.43.0
โ MCP: jira unreachable (timeout)
โ CLAUDE.md found (18 lines)
1 warning ยท fix: /mcp disable jira
/bug
Report a bug directly to Anthropic from within your session.
โธ example
/bug
โ output
Report a bug to Anthropic
Session ID: sess_7f3a2b
Version: 2.1.205
Describe the issue:
> _
[Submit] [Attach transcript] [Cancel]
/login & /logout
Authenticate or sign out mid-session without restarting Claude Code.
โธ example
/logout
โ output
Signed out of claude.ai (anandhu-eng).
Token cleared from keyring.
Sign back in: /login
Or restart: claude --login
Keyboard Shortcuts
Ctrl+CCancel current operation
Ctrl+DExit session (EOF)
Ctrl+LClear screen (keeps history)
Ctrl+BBackground current operation
Ctrl+X Ctrl+KStop all agents
Ctrl+SStash prompt draft
Ctrl+GOpen external editor
Ctrl+VPaste image from clipboard
Ctrl+OToggle verbose output
Ctrl+RSearch command history
Esc EscRewind last change
Shift+TabCycle permission modes
Alt+PSwitch models while typing
Alt+TToggle thinking mode
TabAccept prompt suggestion
! TabBash history autocomplete
?Show all shortcuts
Quick Prefixes
#
Persistent Memory
# Always use TypeScript
/
Slash Command
/code-review --fix
!
Execute Bash
! git status
@
Reference File
@src/index.ts
&
Send to Cloud
& Build the API
Custom Commands
Create a
.md file in .claude/commands/ (project) or ~/.claude/commands/ (personal) and invoke it with /filename. Use $ARGUMENTS for arguments.--- # .claude/commands/pr-review.md
description: Review open PRs and post GitHub comments
allowed-tools: Bash(gh pr list *), Bash(gh pr diff *), Bash(gh pr review *)
model: opus
---
1. Run `gh pr list --state open --json number,title`
2. For each PR, run `gh pr diff <number>`
3. Review for: breaking API changes, missing error handling, security issues
4. Post: `gh pr review <number> --comment -b "<feedback>"`
Usage:
/pr-review โ or schedule it: /loop 3h /pr-reviewPermission Modes
manual (default)
Prompts on first use of each tool
Normal development
acceptEdits
Auto-approves file edits, prompts for bash
Trusted projects
auto
Safety classifier reviews each action automatically
Autonomous with guardrails
plan
Read-only โ no edits or execution
Analysis only
bypassPermissions
Skips all prompts entirely
CI/CD automation
Cycle modes with Shift+Tab. Set at startup:
claude --permission-mode auto