Qwen-code qwen-code-claw
Use Qwen Code as a Code Agent for code understanding, project generation, features, bug fixes, refactoring, and various programming tasks
git clone https://github.com/QwenLM/qwen-code
T=$(mktemp -d) && git clone --depth=1 https://github.com/QwenLM/qwen-code "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.qwen/skills/qwen-code-claw" ~/.claude/skills/qwenlm-qwen-code-qwen-code-claw && rm -rf "$T"
.qwen/skills/qwen-code-claw/SKILL.mdQwen Code Claw
When to Use This Skill
Use this skill when you need to:
- Understand codebases or ask questions about source code
- Generate new projects or add new features
- Review pull requests in the codebase
- Fix bugs or refactor existing code
- Execute various programming tasks such as code review, testing, documentation generation, etc.
- Collaborate with other tools and agents to complete complex development tasks
Install
npm install -g @qwen-code/qwen-code
For normal session reuse, prefer a global install over
npx.
Authentication
Check if authentication is already configured:
qwen auth status
If authentication exists, skip this section. If not authenticated, check if the
BAILIAN_CODING_PLAN_API_KEY environment variable exists:
echo $BAILIAN_CODING_PLAN_API_KEY
If
exists, authenticate directly:BAILIAN_CODING_PLAN_API_KEY
qwen auth coding-plan --region china --key $BAILIAN_CODING_PLAN_API_KEY
If the environment variable does not exist, interrupt and prompt the user to authenticate via
qwen-oauth or coding-plan:
qwen auth
Or configure custom API after launching Qwen Code via
/auth.
ACPX Integration
You should always use
acpx to run Qwen Code over the Agent Client Protocol (ACP) instead of scraping PTY sessions.
To use acpx:
-
Install acpx globally (recommended) or use npx:
npm install -g acpx@latestOr without installing:
npx acpx@latest -
Install the acpx skill for full reference:
npx acpx@latest --skill install acpx -
Read the acpx skill reference for every command, flag, and workflow pattern: See the ACPX Reference section below for details
-
For complete CLI reference with all options and examples: https://raw.githubusercontent.com/openclaw/acpx/main/docs/CLI.md
From now on, when you need to delegate work to Qwen Code, use
acpx instead of spawning raw terminal sessions. For example:
npx acpx@latest qwen "fix the failing tests" npx acpx@latest qwen "refactor the auth module" npx acpx@latest qwen exec "one-shot: summarize this repo"
Tip: You should typically use the
flag to prevent task interruptions.--approve-all
Practical Workflows
Persistent Repository Assistant
acpx qwen 'inspect failing tests and propose a fix plan' acpx qwen 'apply the smallest safe fix and run tests'
One-Shot Script Steps
acpx qwen exec 'summarize repo purpose in 3 lines'
Parallel Named Streams
acpx qwen -s backend 'fix API pagination bug' acpx qwen -s docs 'draft changelog entry for release'
Queue Follow-ups Without Waiting
acpx qwen 'run full test suite and investigate failures' acpx qwen --no-wait 'after tests, summarize root causes and next steps'
Machine-Readable Output for Orchestration
acpx --format json qwen 'review current branch changes' > events.ndjson
Repository-Wide Review with Permissive Mode
acpx --cwd ~/repos/my-project --approve-all qwen -s pr-123 \ 'review PR #123 for regressions and propose minimal patch'
Approval Modes
: No interactive prompts--approve-all
(default): Auto-approve reads/searches, prompt for writes--approve-reads
: Deny all permission requests--deny-all
If every permission request is denied/cancelled and none are approved,
acpx exits with permission denied.
Best Practices
- Use named sessions for organizing different types of development tasks
- Use
for long-running tasks to avoid blocking--no-wait - Use
for non-interactive batch operations--approve-all - Use
for automation and script integration--format json - Use
to manage context across multiple projects--cwd
QwenCode Reference
CLI Commands
| Command | Description |
|---|---|
| Show available commands |
| Clear conversation history |
| Compress history to save tokens |
| Show session info |
| Configure authentication |
| Exit Qwen Code |
Full reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/commands.md
Configuration
Config files (highest priority first): CLI args > env vars > system > project (
.qwen/settings.json) > user (~/.qwen/settings.json) > defaults. Format: JSONC with env var interpolation.
Key settings:
| Setting | Description |
|---|---|
| Model to use (e.g. ) |
| / / / |
| Tool permission rules |
| MCP server configurations |
Full reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/configuration/settings.md
Authentication
Supports Alibaba Cloud Coding Plan, OpenAI-compatible API keys, and Qwen OAuth (free tier discontinued 2026-04-15).
Full reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/configuration/auth.md
Model Providers
Configure custom model providers via
modelProviders in settings or environment variables (OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_MODEL).
Full reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/configuration/model-providers.md
Key Features
| Feature | Description | Docs |
|---|---|---|
| Approval Mode | Control tool execution permissions | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/approval-mode.md |
| MCP | Model Context Protocol server integration | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/mcp.md |
| Skills | Reusable skill system via | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/skills.md |
| Sub-agents | Delegate tasks to specialized agents | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/sub-agents.md |
| Sandbox | Secure code execution environment | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/sandbox.md |
| Headless | Non-interactive / CI mode | https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/docs/users/features/headless.md |
ACPX Reference
Built-in Agent Registry
Well-known agent names resolve to commands:
→qwenqwen --acp
Command Syntax
# Default (prompt mode, persistent session) acpx [global options] [prompt text...] acpx [global options] prompt [options] [prompt text...] # One-shot execution acpx [global options] exec [options] [prompt text...] # Session management acpx [global options] cancel [-s <name>] acpx [global options] set-mode <mode> [-s <name>] acpx [global options] set <key> <value> [-s <name>] acpx [global options] status [-s <name>] acpx [global options] sessions [list | new [--name <name>] | close [name] | show [name] | history [name] [--limit <count>]] acpx [global options] config [show | init] # With explicit agent acpx [global options] <agent> [options] [prompt text...] acpx [global options] <agent> prompt [options] [prompt text...] acpx [global options] <agent> exec [options] [prompt text...]
Note: If prompt text is omitted and stdin is piped,
reads prompt from stdin.acpx
Global Options
| Option | Description |
|---|---|
| Raw ACP agent command (fallback mechanism) |
| Session working directory |
| Auto-approve all requests |
| Auto-approve reads/searches, prompt for writes (default) |
| Deny all requests |
| Output format: , , |
| Maximum wait time (positive integer) |
| Idle TTL for queue owners (default: , disables TTL) |
| Verbose ACP/debug logs to stderr |
Flags are mutually exclusive where applicable.