Claude Code Command Guide: Installation, Slash Commands, and Working Modes Explained

Claude Code is an AI coding assistant built for the terminal. Its core capabilities include reading and writing project files, executing shell commands, integrating with Git, and understanding code across multiple directories. It addresses the key limitation of traditional chat-based tools: they can suggest, but they cannot execute. Keywords: Claude Code, CLI, AI coding.

The technical specification snapshot provides a quick overview

Parameter Details
Tool Name Claude Code
Type Terminal AI coding assistant
Runtime CLI / REPL
Language Ecosystem Node.js 18+
Collaboration Protocol MCP (Model Context Protocol)
Git Integration Supports commit, review, diff, and branch operations
Context Capabilities Session compaction, persistent memory, and sub-agent collaboration
Core Dependencies Node.js, Shell, Git
Reference Data The article cites 46% developer preference and 75% adoption among small and midsize companies

Claude Code delivers real AI execution inside the development workflow

Claude Code is not a browser-based Q&A bot. It is an engineering assistant that runs directly in the command line. It can read repositories, modify files, execute commands, inspect diffs, and participate in real Git workflows.

Compared with IDE plugin tools, its advantage is not that it “sounds more human.” Its advantage is that it can turn suggestions into actual code changes and executable commands. This is especially effective for large repositories, cross-file refactoring, and automated development workflows.

Its capability model consists of three parts

  1. Multiple agents can execute complex tasks in parallel.
  2. Progressive context management reduces token usage.
  3. Deep repository operations cover reading, editing, reviewing, and committing changes.
# Start an interactive session
claude

# Run a one-off query and exit
claude -p "Check the current repository for potential null pointer risks"  # Ideal for scripted calls

# Resume the most recent session
claude -c  # Continue unfinished work from yesterday

These commands form the minimum viable entry point for Claude Code.

image AI Visual Insight: This image shows an overview of the Claude Code command system, highlighting the hierarchy among CLI startup, context management, Git operations, and extensibility. It is useful for understanding the path from “starting a session” to “automated delivery.”

image AI Visual Insight: This image further breaks down Slash Commands and workflow modules. It typically organizes session control, version management, configuration, and external integrations by functional area, which helps developers build command-category memory.

image AI Visual Insight: This image focuses on advanced capabilities such as Skills, Agents, and MCP connectivity. It emphasizes that Claude Code is not just a chat interface, but an extensible engineering execution hub.

Installation and environment setup require Node.js and terminal prerequisites

Claude Code depends on Node.js 18 or later. Before installation, you should verify your local environment. Windows users in particular should use Git Bash or WSL to avoid compatibility issues with native shell commands.

The recommended installation method depends on your platform

node --version  # Check the Node.js version; 18+ is required

# Install the stable version on macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash

# Install with NPM on any platform
npm install -g @anthropic-ai/claude-code  # Install the CLI globally

# Verify the installation result
claude --version  # If a version number is returned, the installation succeeded

These commands complete environment validation, installation, and verification.

If you use a domestic proxy service or a compatible gateway, you can inject authentication and model configuration through ~/.claude/settings.json. This pattern is suitable for enterprise intranets, centralized API gateways, or custom model routing scenarios.

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_API_Key",
    "ANTHROPIC_BASE_URL": "https://coding.dashscope.aliyuncs.com/apps/anthropic",
    "ANTHROPIC_MODEL": "qwen3.6-plus"
  }
}

This configuration file defines authentication, the endpoint, and the default model.

CLI startup parameters determine whether it fits real engineering scenarios

The basic startup mode works well for a single repository and standard interaction. Advanced parameters determine whether Claude Code can handle monorepos, multi-directory dependencies, and automation scripts.

These startup parameters are the highest-priority ones to learn

Parameter Purpose Typical Scenario
-p Run once and exit CI, scripts, log analysis
-c Resume the latest session Continue interrupted work
--add-dir Add extra directories Monorepos, cross-repository dependencies
--model Specify a model Switch based on task complexity
--verbose Output detailed logs Debug tool invocation flow
--append-system-prompt Append system constraints Enforce language or coding standards
# Let Claude read multiple directories at the same time
claude --add-dir ../shared-lib ../api-gateway  # Solve cross-module understanding issues

# Analyze logs directly through a pipe
cat logs/error.log | claude -p "Analyze the error log and locate the root cause"  # Ideal for automated troubleshooting

These parameters upgrade the CLI from a “chat entry point” to an “engineering entry point.”

Slash Commands form the main operational interface for daily use

Slash Commands represent the high-frequency capability layer in Claude Code. They fall into five core categories: session management, Git operations, memory configuration, authentication diagnostics, and integration extensions.

Session management commands directly affect context quality and cost

/compact and /clear are the most critical commands in this group. The former compresses the conversation history while preserving key conclusions. The latter fully resets the context. For long-running development conversations, the former is almost essential.

/context  # View context usage
/compact retain the authentication patterns and API design decisions  # Preserve key design decisions while compacting history
/clear  # Use this when starting a completely new task

These commands control memory density and prevent long sessions from degrading.

Git commands bring AI directly into the commit workflow

Command Function Value
/diff View current changes Quickly understand the scope of modifications
/review Review code Find bugs, style issues, and exception-handling problems
/commit Generate a commit message Improve commit consistency
/branch Manage branches Simplify branch switching
git add .  # Stage changes first
/review
/commit

These commands connect code changes, review, and commit into a closed loop.

CLAUDE.md is the key asset for long-term output consistency

After you run /init, Claude Code generates CLAUDE.md. This file is effectively project-level persistent memory used to describe the tech stack, directory structure, coding constraints, and testing requirements.

For recurring collaboration projects, it can significantly reduce repeated prompt input and improve consistency across multi-turn tasks. It is especially useful for team collaboration and long-term repository maintenance.

## Tech Stack
- Java 17 + Spring Boot 3.x
- JWT authentication, with tokens stored in httpOnly cookies

## Coding Standards
- Every API must include tests
- Exceptions must return structured error objects

## Project Structure
- controller: src/main/java/.../controller
- service: src/main/java/.../service

This file acts as a stable, reusable project handbook for the AI.

The three working modes define Claude Code’s automation boundary

Claude Code provides three modes: Default, Auto-Accept, and Plan. The best practice is not to keep automation enabled all the time, but to plan first and execute second.

A two-stage strategy of Plan first and Auto-Accept second is recommended

Plan mode analyzes without writing changes to disk, which makes it suitable for solution review. Auto-Accept automatically applies file modifications, which makes it suitable for batch implementation once the rules are clear. In production projects, you should usually start with Default or Plan mode.

Shift+Tab  # Switch to Plan mode
# Prompt: First design the interfaces, entities, and security strategy for the JWT authentication module

Shift+Tab  # Switch to Auto-Accept mode
# Prompt: Start implementing the code according to the approved design

This workflow balances safety and execution efficiency.

Skills, Agents, and MCP extend the upper bound of Claude Code

Skills are reusable capability packages that work well for templating repeated processes such as testing, formatting, and review. Agents emphasize autonomous planning and iterative execution. MCP is responsible for connecting external systems such as GitHub and databases.

In many scenarios, using CLI + Skills is more efficient than introducing a complex MCP integration first, because it reduces context overhead and lowers the maintenance cost introduced by external protocols.

A typical practical workflow can be organized like this

cd my-spring-boot-project  # Enter the project directory
claude  # Start Claude Code
/init  # Generate the project memory file
/memory  # Write authentication module conventions
/review  # Run a code review after development is complete
/commit  # Generate a commit message automatically

This main path covers four critical stages: initialization, development, review, and commit.

Claude Code works best for medium-to-large repositories, automation workflows, and cross-module refactoring

Its strengths are concentrated in cross-file understanding, Git integration, session compaction, and multi-task handling. Its limitations include a steeper learning curve, a noticeable CLI adoption barrier, and the need to manage token costs during deep usage.

If your work only involves modifying single-file scripts, Claude Code may not be more cost-effective than a lightweight plugin. But if you need to handle multi-module projects, complex refactoring, or repeated workflows, its value grows quickly.

FAQ answers the most common implementation questions

1. What is the fundamental difference between Claude Code and a typical IDE AI plugin?

A typical plugin focuses more on “conversational suggestions,” while Claude Code focuses more on “terminal execution.” It can directly access repositories, execute commands, and participate in Git workflows, which makes it better suited to real engineering tasks rather than just code completion.

2. If the AI becomes less effective after a long conversation, what is the most effective fix?

Use /context first to check usage, then use /compact to compress the history while preserving key design decisions. Only use /clear to fully wipe the context when you are completely switching tasks.

3. Which commands should beginners learn first?

Start with claude, claude -c, claude -p, /init, /compact, /review, and /commit. Together, these commands already cover startup, session continuation, automation, project memory, context management, and the Git commit workflow.

[AI Readability Summary]

This article restructures scattered original Claude Code materials into a high-density quick reference guide. It covers installation, startup parameters, slash commands, shortcuts, three working modes, Skills/Agents/MCP, and practical workflows, helping developers quickly build a usable mental model for a terminal-based AI coding assistant.