Claude Code Quick Start: Core Commands and Best Practices Guide
As AI-assisted software development evolves from simple code completion to autonomous, multi-file engineering workflows, agentic coding tools are becoming essential for developers. This guide walks through the complete path from installation and authentication to advanced configuration, covering slash commands, the Skills mechanism, Hooks automation, memory management, and Rewind operations—plus practical advice on billing models and security best practices.
Introduction
As AI-assisted software development rapidly evolves, agentic coding tools are advancing from simple code completion toward autonomous planning and multi-file editing at engineering scale. Driven by large language models, these tools can understand repository context, execute terminal commands, and automatically modify code blocks—significantly boosting developer productivity. However, their feature set is far more complex than traditional IDE plugins, and mastering core commands and configuration is a key prerequisite for using them effectively.
This article targets developers with basic programming experience who want to go deeper with agentic coding tools. It systematically covers the full path from installation and authentication to advanced configuration, with a focus on the slash command system, Skills, Hooks automation, memory management, and Rewind operations.
1. Launch and Initialization: From Installation to Authentication
Agentic coding tools typically run as command-line interfaces (CLIs) and can be launched directly from mainstream terminals. After installation, the first run requires authentication, which directly affects billing logic and usage quotas (see Section 6).
On startup, the tool scans version control metadata in the current working directory (such as Git repository information) and builds a code index. It is recommended to launch the tool from the project root so it can read the full repository structure, environment configuration files, and dependency manifests, providing more accurate context awareness.
2. Slash Commands: A Standardized Language for Interacting with the Agent
Slash commands are the command hub of agentic coding tools. Typing a / prefix in the chat input triggers fixed instructions. Mastering slash commands greatly reduces ambiguity when interacting with the model, making it clear to the agent what type of task to execute.
Common Slash Commands
/init: Scans the codebase structure and generates a project description file (such asCLAUDE.md) that serves as persistent context for subsequent conversations./review: Performs a static review of staged changes or recent commits, identifying potential defects, security issues, and style problems./explain: After selecting a piece of code or a function, asks the agent to explain its logic and behavior in natural language./compact: Summarizes conversation history when the context becomes too long, reducing token usage while maintaining response quality and speed./clear: Clears the current session’s context history—essentially a “conversation reset”—useful when switching between tasks.
Custom Project-Level Slash Commands
Advanced users can create project-specific slash commands. Create a .claude/commands/ directory at the project root; each Markdown file corresponds to one custom command. The filename becomes the command name (e.g., /example), the Front Matter section can define parameter placeholders (such as $ARGUMENTS), and the body is the prompt template the agent follows when executing the command.
---description: Generate a unit test skeletonallowed-tools: Read, Write, Edit---Generate a unit test skeleton for the currently selected function based on the standard test framework, including boundary-value and exception-path cases.Arguments: $ARGUMENTS
With custom commands, teams can codify standards (such as commit message formats or API documentation templates) into reusable instructions, reducing repetitive communication.
3. The Skills Mechanism: From Manual Invocation to Automatic Routing
In many modern agentic coding tools, Skills are predefined capability modules that encapsulate complex workflows into reusable instruction units. In earlier versions, Skills were typically invoked manually via slash command syntax such as /skill-name. Under the later unified architecture, Skills are integrated into the agent’s autonomous decision-making system—the model decides whether to invoke a skill based on user input, rather than requiring manual triggering.
Usage Patterns
- Manual invocation: Enter
/skill-nameto activate directly. Suitable for well-defined tasks with clear intent (such as “generate code documentation” or “normalize commit messages”). - Automatic routing: When the tool uses the Model Context Protocol (MCP) or a similar foundation, the agent can identify the task type during planning and automatically select the matching skill package, without explicit user intervention.
How It Works Internally
From an implementation perspective, skill files are essentially prompt templates with structured metadata, stored at the user level (~/.claude/skills) or in project-level directories. On each invocation, the agent reads the skill description, tool permission declarations, and instruction body, then splices them into the system prompt before execution. All skills are registered in a single scheduling system, ensuring consistent security auditing and invocation logs.
4. Hooks: Embedding the Agent into Existing Workflows
The Hooks mechanism lets developers insert custom scripts at specific lifecycle events of the agent, enabling workflow automation. This is the key interface for integrating agentic coding tools with existing CI/CD pipelines or Git workflows.
Supported Events and Typical Use Cases
| Event | Trigger | Typical Use |
|---|---|---|
| PreToolUse | Before the agent calls any tool | Block accidental operations on production IPs; inject standard prompts |
| PostToolUse | After a tool finishes executing | Auto-format code; append test results to context |
| Notification | When the agent is waiting for input | Send a desktop or IDE notification prompting the user |
| Stop | After the agent completes a response | Automatically run the test suite and feed results back |
Configuration
Hooks are declared via the hooks field in a configuration file such as .claude/settings.json. The following example enforces a code style check before every edit-tool invocation:
{"hooks": {"PreToolUse": [{"matcher": "Edit|Write","hooks": [{ "type": "command", "command": "npx standard --fix $CLAUDE_FILE_PATH" }]}]}}
When designing hooks, pay attention to execution timeouts and failure strategies. The tool typically terminates a hook after its script exceeds a timeout (tens of seconds by default) and decides whether to continue subsequent operations. Hook scripts should be idempotent—repeated executions should produce the same result—to avoid accumulating side effects.
5. Memory and Context Management: Giving the Agent Repository-Level “Long-Term Memory”
Agentic coding tools have limited context windows, while exploring and modifying large projects often spans dozens of conversation turns. The memory mechanism addresses the question of how to make the agent remember key constraints and project conventions across sessions.
Layered Memory Storage
- User-level memory: Stored in a configuration file in the user’s home directory (such as
~/.claude/CLAUDE.md), containing personal preferences that apply to all projects (e.g., naming conventions, blocked tools). - Project-level memory: Located in
CLAUDE.mdat the repository root, maintained by the team, recording architecture decisions, coding standards, testing strategies, and other core information. - Session-level automatic memory: Key facts the agent extracts automatically during a run—such as “the user prefers pnpm over npm” or “the build command is make build”—cached within the session for later reference.
Best Practices for Writing Memory Files
Memory files should be neither too short (lacking information) nor too long (wasting tokens). A recommended structure includes: an overview of the project’s tech stack, a list of common commands, architecture conventions, known limitations, and pending tasks. Avoid putting frequently changing temporary information in memory files, as it can pollute the context.
6. Rewind: Session-Level Safe Undo
During real coding sessions, an agent may make a series of complex multi-file modifications. The Rewind feature lets users restore project files to a historical snapshot from the conversation—essentially a “session-level time machine.”
How It Works
The agent records file hashes and key state before each tool call (especially file writes and command executions). When the user triggers the rewind command (such as /rewind), the interface presents a timeline of traceable operations; selecting any node restores the workspace to that state. Rewind only affects changes made in the current session and does not interfere with independent manual edits outside the session.
Usage Tips
- Before attempting large-scale refactoring or dependency upgrades, use the Rewind feature to record the current baseline state.
- Regularly commit session changes to version control, noting “changes generated by the agent” in the commit message to make it easier to distinguish manual from automated edits later.
7. Authentication and Billing: Pay-as-You-Go vs. Subscription
Agentic coding tools typically offer multiple authentication and billing paths, each with a different cost model and feature boundaries. Before committing, clarify your expected call frequency and budget constraints.
Option 1: Pay-as-You-Go with API Keys
Generate an API key from the platform console and bind it to your development environment, paying only for what you use. This model suits evaluation phases or workloads with fluctuating call volumes. Billing factors include total input/output tokens, model tier, and peak-hour multipliers. Pricing details follow the platform’s current published rates and may change as model versions update.
Option 2: Subscription Plans
Subscriptions typically provide a fixed monthly token quota and feature entitlements (such as parallel session counts and advanced hook support). For developers with daily high-frequency usage, the predictable budget of a subscription is more attractive. Some subscription plans also bundle IDE plugins, CLI tools, and other extensions.
Option 3: Enterprise Billing
Enterprise users can work through cloud providers or platform enterprise agreements to include agentic tool costs in a unified cloud billing statement, gaining centralized auditing, usage export, and role-based permission management. This model suits teams subject to internal compliance controls (such as in finance or government sectors).
Cost control tip: Enabling context compression (Auto-Compact) in your configuration, setting a
max_turnslimit, and using large-context-window models judiciously can effectively control token consumption.
8. Security and Best Practices
The essence of agentic coding tools is granting a large language model permission to execute terminal commands and modify files, which requires clear security boundaries:
- Command allowlist: Configure a list of commands the agent is allowed to execute, blocking high-risk operations (such as force deletion, remote connections, and package publishing).
- Hook auditing: Attach hooks at the PreToolUse stage to log all agent actions for later traceability.
- Branch isolation: Require the agent to make changes only on dedicated branches, keeping the main branch clean.
- Protecting sensitive information: Store tokens, passwords, and other credentials in environment variables rather than memory files, to prevent memory files from being accidentally committed to public repositories.
Conclusion
The key to agentic coding tools evolving from “conversational assistants” into “autonomous execution agents” lies in standardized slash commands, modular Skills, workflow-embedded Hooks, and fine-grained context management. By mastering the core commands and configuration logic described in this article, developers can build a robust, auditable, and efficient AI-assisted coding workflow with lower trial-and-error costs. As context windows expand and multi-agent collaboration matures, the engineering benefits of these tools will only grow.
