Qwen Code
Qwen Code custom commands: .qwen/commands Markdown files, {{args}}, !{shell} and @{file}
How do I create a custom /command in Qwen Code?
Add a Markdown file to .qwen/commands/ in your project or ~/.qwen/commands/ for all projects. The file name becomes the command, so test.md runs as /test, and subfolders add a colon: git/commit.md runs as /git:commit. Optional YAML frontmatter sets a description shown in /help. Use {{args}} for what you type after the command, !{command} to insert shell output after you confirm it, and @{path} to insert a file. TOML command files still load but are deprecated.
Compare: custom slash commands in every AI coding agent →
Qwen Code settings change often
Get one email a week when a setting, flag or permission rule changes, checked against the vendor docs.
Where Qwen Code reads commands
- User commands: ~/.qwen/commands/, available in every project.
- Project commands: .qwen/commands/ in the project root. Commit them so your team gets the same commands.
- If a project command and a user command have the same name, the project command wins.
- Subfolders become namespaces with a colon: ~/.qwen/commands/test.md is /test and .qwen/commands/git/commit.md is /git:commit.
Minimal command file
A command is a Markdown file. The frontmatter is optional and its description appears in /help. The body is the prompt and is required.
~/.qwen/commands/refactor/pure.md (run as /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
Pass arguments with {{args}}
- Put {{args}} where the text you type after the command should go.
- Without {{args}}, your arguments are appended to the end of the prompt after a blank line. With no arguments, the prompt is sent as written.
- Inside a !{...} shell command, {{args}} is shell escaped automatically. With !{grep {{args}} .} in the file, /search "hello" runs grep "hello" .
.qwen/commands/review.md (run as /review src/app.ts)
---
description: Code review based on best practices
---
Review {{args}}, reference standards:
@{docs/code-standards.md}Inject shell output and files
- @{path} inserts a file. Text files go in as is, images and PDFs are encoded, and binary files may be skipped or cut short. A directory is read recursively and follows .gitignore.
- !{command} runs a shell command and inserts its output. Qwen Code shows a confirmation dialog before the command runs.
- Processing order: @{...} first, then !{...}, then {{args}}.
.qwen/commands/commit.md (run as /commit)
---
description: Generate Commit message based on staged changes
---
Please generate a Commit message based on the following diff:
```diff
!{git diff --staged}
```Old TOML command files
TOML commands with a required prompt field and an optional description still work, but the docs mark the format as deprecated and say it will be removed in a future version. Qwen Code shows a migration prompt when it finds TOML files. Gemini CLI uses the same TOML format, so this matters if you copied commands over from it.
Deprecated: .qwen/commands/analyze.toml
prompt = "Please analyze code: {{args}}"
description = "Code analysis tool"Get Qwen Code settings changes by email
When a setting, flag or permission rule in this guide changes, it goes in the weekly AgentAtlas update, checked against the vendor docs. One email a week.
Sources
More on Qwen Code
More Qwen Code guides
Other guides
Reviewed Oct 21, 2026. Settings change often; the linked vendor docs are the source of truth.