Referință rapidă

Comenzi CLI și Slash Commands în Claude Code

Ghid de referință compact pentru agentul de programare în terminal Claude Code dezvoltat de Anthropic: parametri CLI, comenzi slash, scurtături și fișierul CLAUDE.md.

· Publicat

Claude Code este agentul oficial de programare în terminal de la Anthropic. Rulează direct în consolă, înțelege arhitectura proiectelor și modifică fișierele autonom.

🔗 AI Algorithms · Python · Always-on Agents


1. Comenzi CLI și opțiuni de pornire

Command / Flag Description Example Usage
claude Start an interactive REPL session in the current directory claude
claude "prompt" Start a session immediately with an initial goal claude "Fix timeout errors in tests/auth.test.ts"
-p, --print Run non-interactively and print the final response to stdout claude -p "Summarize git commit" > summary.md
--resume [session_id] Resume a previous session; opens a picker if ID is omitted claude --resume
--model <name> Specify the underlying model (e.g., sonnet, opus) claude --model sonnet
--dangerously-skip-permissions Bypass all confirmation prompts (containers/sandboxes only) claude --dangerously-skip-permissions
`claude config [get set list]`
`claude mcp [list add remove]`
claude update Check and upgrade Claude Code to the latest release claude update
claude doctor Inspect environment health (Node, Git, network, dependencies) claude doctor

2. Comenzi Slash interactive

2.1 Initialization & Context Management

Command Description Best Practice & Details
/init Analyze project structure and create/update CLAUDE.md Recommended first command when adopting Claude Code
/context Visualize token allocation in the current context window Breaks down system prompts, tool schemas, and conversation memory
/compact [instructions] Compact conversation history to reclaim context window headroom Optionally pass compaction guidance
/clear Clear conversation history and reset context for a new task Keeps current directory and process active without exiting
/memory Inspect or edit persistent project guidelines in CLAUDE.md Quickly verify rules currently in effect

2.2 Configuration & Security Permissions

Command Description Best Practice & Details
/config Interactive settings menu (editor, model, defaults) Adjust theme preferences, tool policies, and network proxies
/permissions Manage authorized tool execution rules and command whitelists Review trusted Bash patterns and write-permission scopes
/terminal-setup Configure terminal bindings (Shift+Enter multiline support) Run once after initial install for multiline input
/login Authenticate with your Anthropic account Switch active credentials or re-authenticate expired sessions
/logout Clear cached auth tokens from local machine Safely disconnect credentials on shared workstations

2.3 Code Review, Debugging & Task Control

Command Description Best Practice & Details
/review [target] Review code changes for architecture, performance, and defects Common invocations: /review or /review main
/diff Display a diff of all modifications made by Claude Code Verify line-by-line changes before committing
/cost Display token consumption and estimated API costs for session Keep track of token budgets across large-context tasks
/doctor In-session environment diagnostics Troubleshoot failing tool executions and git integration issues
/bug, /feedback Submit telemetry and bug reports directly to Anthropic Packages version and diagnostics to assist triage
/help Print list of available slash commands Quick reference during active development
/exit, /quit Save session state and exit Claude Code Or press Ctrl + D on an empty line

2.4 Model Switching & Protocol Extensions

Command Description Best Practice & Details
/model [model_name] Switch the underlying reasoning model dynamically High-reasoning for architecture, standard for syntax edits
/mcp Manage Model Context Protocol (MCP) integrations Verify status of external databases, docs, and custom tools
/pr Draft commit descriptions and open a GitHub Pull Request Requires GitHub CLI (gh) or configured GitHub Token
/resume Select and resume historical sessions from within prompt Seamlessly switch back to previous project contexts

3. Scurtături de tastatură în terminal

Key / Syntax Action Context & Behavior
Esc Interrupt Task Immediately stops thinking, file editing, or streaming output
Ctrl + C Cancel Input / Abort Clears the prompt line; aborts running sub-processes
Ctrl + D Exit Cleanly Disconnects and exits when the prompt input is empty
Shift + Enter Multiline Input Inserts a newline without submitting
@<path> Explicit File/Dir Reference Injects target file into context (e.g. @src/auth.ts)
!<shell_command> Run Shell Command Runs command without leaving Claude (e.g. !git status)
↑ / ↓ History Navigation Cycle through and recall previously executed prompt commands

4. Ghid de configurare pentru CLAUDE.md

Section Recommended Content Examples
Build & Run Commands Core setup, dependencies, dev server start npm run build, pnpm dev, make all
Test & Lint Commands Unit tests, integration tests, linters npm test, npm run lint, cargo test
Code Style Guidelines Formatting rules, naming conventions, type safety Strict TypeScript mode, functional patterns
Protected Paths Files and directories Claude must not modify .env, secret keys, vendor build directories
Git Workflow Commit conventions and branch strategies Conventional Commits (feat:, fix:, chore:)

Subiecte conexe