Skip to Content
User GuideFeaturesCommands

Commands

This document details all commands supported by Qwen Code, helping you efficiently manage sessions, customize the interface, and control its behavior.

Qwen Code commands are triggered through specific prefixes and fall into three categories:

Prefix TypeFunction DescriptionTypical Use Case
Slash Commands (/)Meta-level control of Qwen Code itselfManaging sessions, modifying settings, getting help
At Commands (@)Quickly inject local file content into conversationAllowing AI to analyze specified files or code under directories
Exclamation Commands (!)Direct interaction with system ShellExecuting system commands like git status, ls, etc.

1. Slash Commands (/)

Slash commands are used to manage Qwen Code sessions, interface, and basic behavior.

1.1 Session and Project Management

These commands help you save, restore, and summarize work progress.

CommandDescriptionUsage Examples
/initAnalyze current directory and create initial context file/init
/summaryGenerate project summary based on conversation history/summary
/compressReplace chat history with summary to save Tokens/compress
/resumeResume a previous conversation session/resume
/restoreRestore files to state before tool execution/restore (list) or /restore <ID>

1.2 Interface and Workspace Control

Commands for adjusting interface appearance and work environment.

CommandDescriptionUsage Examples
/clearClear terminal screen content/clear (shortcut: Ctrl+L)
/contextShow context window usage breakdown/context
detailShow per-item context usage breakdown/context detail
/themeChange Qwen Code visual theme/theme
/vimTurn input area Vim editing mode on/off/vim
/directoryManage multi-directory support workspace/dir add ./src,./tests
/editorOpen dialog to select supported editor/editor

1.3 Language Settings

Commands specifically for controlling interface and output language.

CommandDescriptionUsage Examples
/languageView or change language settings/language
ui [language]Set UI interface language/language ui zh-CN
output [language]Set LLM output language/language output Chinese
  • Available built-in UI languages: zh-CN (Simplified Chinese), en-US (English), ru-RU (Russian), de-DE (German)
  • Output language examples: Chinese, English, Japanese, etc.

1.4 Tool and Model Management

Commands for managing AI tools and models.

CommandDescriptionUsage Examples
/mcpList configured MCP servers and tools/mcp, /mcp desc
/toolsDisplay currently available tool list/tools, /tools desc
/skillsList and run available skills/skills, /skills <name>
/planSwitch to plan mode or exit plan mode/plan, /plan <task>, /plan exit
/approval-modeChange approval mode for tool usage/approval-mode <mode (auto-edit)> --project
planAnalysis only, no executionSecure review
defaultRequire approval for editsDaily use
auto-editAutomatically approve editsTrusted environment
yoloAutomatically approve allQuick prototyping
/modelSwitch model used in current session/model
/model --fastSet a lighter model for prompt suggestions/model --fast qwen3-coder-flash
/extensionsList all active extensions in current session/extensions
/memoryManage AI’s instruction context/memory add Important Info

1.5 Built-in Skills

These commands invoke bundled skills that provide specialized workflows.

CommandDescriptionUsage Examples
/reviewReview code changes with 5 parallel agents + deterministic analysis/review, /review 123, /review 123 --comment
/loopRun a prompt on a recurring schedule/loop 5m check the build
/qc-helperAnswer questions about Qwen Code usage and configuration/qc-helper how do I configure MCP?

See Code Review for full /review documentation.

1.6 Side Question (/btw)

The /btw command allows you to ask quick side questions without interrupting or affecting the main conversation flow.

CommandDescription
/btw <your question>Ask a quick side question
?btw <your question>Alternative syntax for side questions

How It Works:

  • The side question is sent as a separate API call with recent conversation context (up to the last 20 messages)
  • The response is displayed above the Composer — you can continue typing while waiting
  • The main conversation is not blocked — it continues independently
  • The side question response does not become part of the main conversation history
  • Answers are rendered with full Markdown support (code blocks, lists, tables, etc.)

Keyboard Shortcuts (Interactive Mode):

ShortcutAction
EscapeCancel (while loading) or dismiss (after completed)
Space or EnterDismiss the answer (when input is empty)
Ctrl+C or Ctrl+DCancel an in-flight side question

Example:

(While the main conversation is about refactoring code) > /btw What's the difference between let and var in JavaScript? ╭──────────────────────────────────────────╮ │ /btw What's the difference between let │ │ and var in JavaScript? │ │ │ │ + Answering... │ │ Press Escape, Ctrl+C, or Ctrl+D to cancel│ ╰──────────────────────────────────────────╯ > (Composer remains active — keep typing) (After the answer arrives) ╭──────────────────────────────────────────╮ │ /btw What's the difference between let │ │ and var in JavaScript? │ │ │ │ `let` is block-scoped, while `var` is │ │ function-scoped. `let` was introduced │ │ in ES6 and doesn't hoist the same way. │ │ │ │ Press Space, Enter, or Escape to dismiss │ ╰──────────────────────────────────────────╯ > (Composer still active)

Supported Execution Modes:

ModeBehavior
InteractiveShows above Composer with Markdown rendering
Non-interactiveReturns text result: btw> question\nanswer
ACP (Agent Protocol)Returns stream_messages async generator
Tip

Use /btw when you need a quick answer without derailing your main task. It’s especially useful for clarifying concepts, checking facts, or getting quick explanations while staying focused on your primary workflow.

1.7 Information, Settings, and Help

Commands for obtaining information and performing system settings.

CommandDescriptionUsage Examples
/helpDisplay help information for available commands/help or /?
/aboutDisplay version information/about
/statsDisplay detailed statistics for current session/stats
/settingsOpen settings editor/settings
/authChange authentication method/auth
/bugSubmit issue about Qwen Code/bug Button click unresponsive
/copyCopy last output content to clipboard/copy
/quitExit Qwen Code immediately/quit or /exit

1.8 Common Shortcuts

ShortcutFunctionNote
Ctrl/cmd+LClear screenEquivalent to /clear
Ctrl/cmd+TToggle tool descriptionMCP tool management
Ctrl/cmd+C×2Exit confirmationSecure exit mechanism
Ctrl/cmd+ZUndo inputText editing
Ctrl/cmd+Shift+ZRedo inputText editing

1.9 CLI Auth Subcommands

In addition to the in-session /auth slash command, Qwen Code provides standalone CLI subcommands for managing authentication directly from the terminal:

CommandDescription
qwen authInteractive authentication setup
qwen auth qwen-oauthAuthenticate with Qwen OAuth
qwen auth coding-planAuthenticate with Alibaba Cloud Coding Plan
qwen auth coding-plan --region china --key sk-sp-…Non-interactive Coding Plan setup (for scripting)
qwen auth statusShow current authentication status
Tip

These commands run outside of a Qwen Code session. Use them to configure authentication before starting a session, or in scripts and CI environments. See the Authentication page for full details.

2. @ Commands (Introducing Files)

@ commands are used to quickly add local file or directory content to the conversation.

Command FormatDescriptionExamples
@<file path>Inject content of specified file@src/main.py Please explain this code
@<directory path>Recursively read all text files in directory@docs/ Summarize content of this document
Standalone @Used when discussing @ symbol itself@ What is this symbol used for in programming?

Note: Spaces in paths need to be escaped with backslash (e.g., @My\ Documents/file.txt)

3. Exclamation Commands (!) - Shell Command Execution

Exclamation commands allow you to execute system commands directly within Qwen Code.

Command FormatDescriptionExamples
!<shell command>Execute command in sub-Shell!ls -la, !git status
Standalone !Switch Shell mode, any input is executed directly as Shell command!(enter) → Input command → !(exit)

Environment Variables: Commands executed via ! will set the QWEN_CODE=1 environment variable.

4. Custom Commands

Save frequently used prompts as shortcut commands to improve work efficiency and ensure consistency.

Note

Custom commands now use Markdown format with optional YAML frontmatter. TOML format is deprecated but still supported for backwards compatibility. When TOML files are detected, an automatic migration prompt will be displayed.

Quick Overview

FunctionDescriptionAdvantagesPriorityApplicable Scenarios
NamespaceSubdirectory creates colon-named commandsBetter command organization
Global Commands~/.qwen/commands/Available in all projectsLowPersonal frequently used commands, cross-project use
Project Commands<project root directory>/.qwen/commands/Project-specific, version-controllableHighTeam sharing, project-specific commands

Priority Rules: Project commands > User commands (project command used when names are same)

Command Naming Rules

File Path to Command Name Mapping Table

File LocationGenerated CommandExample Call
~/.qwen/commands/test.md/test/test Parameter
<project>/.qwen/commands/git/commit.md/git:commit/git:commit Message

Naming Rules: Path separator (/ or \) converted to colon (:)

Custom commands use Markdown files with optional YAML frontmatter:

--- description: Optional description (displayed in /help) --- Your prompt content here. Use {{args}} for parameter injection.
FieldRequiredDescriptionExample
descriptionOptionalCommand description (displayed in /help)description: Code analysis tool
Prompt bodyRequiredPrompt content sent to modelAny Markdown content after the frontmatter

TOML File Format (Deprecated)

Warning

Deprecated: TOML format is still supported but will be removed in a future version. Please migrate to Markdown format.

FieldRequiredDescriptionExample
promptRequiredPrompt content sent to modelprompt = "Please analyze code: {{args}}"
descriptionOptionalCommand description (displayed in /help)description = "Code analysis tool"

Parameter Processing Mechanism

Processing MethodSyntaxApplicable ScenariosSecurity Features
Context-aware Injection{{args}}Need precise parameter controlAutomatic Shell escaping
Default Parameter ProcessingNo special markingSimple commands, parameter appendingAppend as-is
Shell Command Injection!{command}Need dynamic contentExecution confirmation required before

1. Context-aware Injection ({{args}})

ScenarioTOML ConfigurationCall MethodActual Effect
Raw Injectionprompt = "Fix: {{args}}"/fix "Button issue"Fix: "Button issue"
In Shell Commandprompt = "Search: !{grep {{args}} .}"/search "hello"Execute grep "hello" .

2. Default Parameter Processing

Input SituationProcessing MethodExample
Has parametersAppend to end of prompt (separated by two line breaks)/cmd parameter → Original prompt + parameter
No parametersSend prompt as is/cmd → Original prompt

🚀 Dynamic Content Injection

Injection TypeSyntaxProcessing OrderPurpose
File Content@{file path}Processed firstInject static reference files
Shell Commands!{command}Processed in middleInject dynamic execution results
Parameter Replacement{{args}}Processed lastInject user parameters

3. Shell Command Execution (!{...})

OperationUser Interaction
1. Parse command and parameters-
2. Automatic Shell escaping-
3. Show confirmation dialog✅ User confirmation
4. Execute command-
5. Inject output to prompt-

Example: Git Commit Message Generation

--- description: Generate Commit message based on staged changes --- Please generate a Commit message based on the following diff: ```diff !{git diff --staged} ```

4. File Content Injection (@{...})

File TypeSupport StatusProcessing Method
Text Files✅ Full SupportDirectly inject content
Images/PDF✅ Multi-modal SupportEncode and inject
Binary Files⚠️ Limited SupportMay be skipped or truncated
Directory✅ Recursive InjectionFollow .gitignore rules

Example: Code Review Command

--- description: Code review based on best practices --- Review {{args}}, reference standards: @{docs/code-standards.md}

Practical Creation Example

”Pure Function Refactoring” Command Creation Steps Table

OperationCommand/Code
1. Create directory structuremkdir -p ~/.qwen/commands/refactor
2. Create command filetouch ~/.qwen/commands/refactor/pure.md
3. Edit command contentRefer to the complete code below.
4. Test command@file.js/refactor:pure
--- description: Refactor code to pure function --- Please analyze code in current context, refactor to pure function. Requirements: 1. Provide refactored code 2. Explain key changes and pure function characteristic implementation 3. Maintain function unchanged

Custom Command Best Practices Summary

Command Design Recommendations Table

Practice PointsRecommended ApproachAvoid
Command NamingUse namespaces for organizationAvoid overly generic names
Parameter ProcessingClearly use {{args}}Rely on default appending (easy to confuse)
Error HandlingUtilize Shell error outputIgnore execution failure
File OrganizationOrganize by function in directoriesAll commands in root directory
Description FieldAlways provide clear descriptionRely on auto-generated description

Security Features Reminder Table

Security MechanismProtection EffectUser Operation
Shell EscapingPrevent command injectionAutomatic processing
Execution ConfirmationAvoid accidental executionDialog confirmation
Error ReportingHelp diagnose issuesView error information
Last updated on