qwen-code-claw
Use Qwen Code as a Code Agent for code understanding, project
git clone --depth 1 https://github.com/QwenLM/qwen-code /tmp/qwen-code-claw && cp -r /tmp/qwen-code-claw/.qwen/skills/qwen-code-claw ~/.claude/skills/qwen-code-clawSKILL.md
# Qwen 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
```bash
npm install -g @qwen-code/qwen-code
```
For normal session reuse, prefer a global install over `npx`.
## Authentication
Check if authentication is already configured:
```bash
qwen auth status
```
If authentication exists, skip this section. If not authenticated, check if the
`BAILIAN_CODING_PLAN_API_KEY` environment variable exists:
```bash
echo $BAILIAN_CODING_PLAN_API_KEY
```
**If `BAILIAN_CODING_PLAN_API_KEY` exists**, authenticate directly:
```bash
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`:
```bash
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:
1. **Install acpx globally** (recommended) or use npx:
```bash
npm install -g acpx@latest
```
Or without installing:
```bash
npx acpx@latest
```
2. **Install the acpx skill** for full reference:
```bash
npx acpx@latest --skill install acpx
```
3. **Read the acpx skill reference** for every command, flag, and workflow
pattern: See the [ACPX Reference](#acpx-reference) section below for details
4. **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:
```bash
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 `--approve-all` flag to prevent task
> interruptions.
## Practical Workflows
### Persistent Repository Assistant
```bash
acpx qwen 'inspect failing tests and propose a fix plan'
acpx qwen 'apply the smallest safe fix and run tests'
```
### One-Shot Script Steps
```bash
acpx qwen exec 'summarize repo purpose in 3 lines'
```
### Parallel Named Streams
```bash
acpx qwen -s backend 'fix API pagination bug'
acpx qwen -s docs 'draft changelog entry for release'
```
### Queue Follow-ups Without Waiting
```bash
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
```bash
acpx --format json qwen 'review current branch changes' > events.ndjson
```
### Repository-Wide Review with Permissive Mode
```bash
acpx --cwd ~/repos/my-project --approve-all qwen -s pr-123 \
'review PR #123 for regressions and propose minimal patch'
```
## Approval Modes
- `--approve-all`: No interactive prompts
- `--approve-reads` (default): Auto-approve reads/searches, prompt for writes
- `--deny-all`: Deny all permission requests
If every permission request is denied/cancelled and none are approved, `acpx`
exits with permission denied.
## Best Practices
1. Use **named sessions** for organizing different types of development tasks
2. Use `--no-wait` for long-running tasks to avoid blocking
3. Use `--approve-all` for non-interactive batch operations
4. Use `--format json` for automation and script integration
5. Use `--cwd` to manage context across multiple projects
## QwenCode Reference
### CLI Commands
| Command | Description |
| ----------- | ------------------------------- |
| `/help` | Show available commands |
| `/clear` | Clear conversation history |
| `/compress` | Compress history to save tokens |
| `/stats` | Show session info |
| `/auth` | Configure authentication |
| `/exit` | Exit Qwen Code |
Full reference: `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.name` | Model to use (e.g. `qwen-max`) |
| `tools.approvalMode` | `plan` / `default` / `auto_edit` / `yolo` |
| `permissions.allow/ask/deny` | Tool permission rules |
| `mcpServers.*` | MCP server configurations |
Full reference: `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: `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: `docs/users/configuration/model-providers.md`.
### Key Features
- Approval Mode: control tool execution permissions.
See `docs/users/features/approval-mode.md`.
- MCP: Model Context Protocol server integration.
See `docs/users/features/mcp.md`.
- Skills: reusable skill system via `/skill`.
See `docs/users/features/skills.md`.
- Sub-agents: delegate tasks to specialized agents.
See `docs/users/features/sub-agents.md`.
- Sandbox: secure code execution environment.
See `docs/users/features/sandbox.md`.
- Headless: non-interUse after a Codex or Claude Code feature has been implemented in Qwen Code to run the selected reference agent and Qwen Code under the same scenario, capture HTTP and terminal traces, compare request bodies, tool/function schemas, outputs, and iterate until the reproduced behavior is close enough.
Use when reproducing an existing Codex or Claude Code feature in Qwen Code or another agent CLI by choosing a reference agent, capturing HTTP request bodies, prompts, tool/function schemas, terminal output, and then implementing the matching behavior in the target repo.
Review and repair current local changes until they converge, or run Qwen Code Autofix issue and review workflows from GitHub Actions.
Fix a bug from a GitHub issue, following the reproduce-first
Classify a bounded batch of stale PR CI failures and choose the safest response.
Analyze indexed codebases via graph database (neug) and vector index (zvec). Covers call graphs, dependencies, dead code, hotspots, module coupling, architecture reports, semantic search, impact analysis, bug root cause from GitHub issues, class diagrams (UML), and PR review (risk scoring, conflict detection, auto-merge candidates, labeling). Also covers creating, inspecting, and repairing a CodeScope index. Use for: code structure, who calls what, why something changed, similar functions, module boundaries, bug tracing, class relationships, PR risk/conflicts, or any question benefiting from a code knowledge graph. Applies when a `.codegraph` index exists in the workspace, or when the user wants to create one.
Draft and submit a GitHub issue from a user idea or bug description, with bilingual body and correct labels.
Stabilize a flaky test with a minimal, assertion-preserving fix — never by weakening or deleting the check.