TL;DR: Here’s my Qwen Code stack:
| Layer | Tool | Problem It Solves |
|---|---|---|
| 1 — RAG | Context7 + Tavily (7 skills) | Outdated docs → hallucinated code |
| 2 — Context Engineering | context-mode | Tool output bloat → burned context window |
| 3 — Workflow Engine | bkit (21 agents, 35 skills, 10 hooks) | Chaotic workflows → structured PDCA pipeline |
| 4 — Shared Skills | 26 skills (~/.agents/skills/) | No domain knowledge → generic output |
| 5 — Model | coder-model (Qwen3-Coder) | Cost → free (2,000 req/day) |
Start with whatever solves your biggest pain point:
- Want structured dev workflow → bkit
- Outdated docs → Context7
- Context bloat → context-mode
- Domain-specific quality → shared skills
Why Qwen Code?
I already have an opencode setup that works well. But opencode requires a paid model provider. Qwen Code gives me a fully open-source (Apache 2.0) AI coding agent with 2,000 free requests per day via Qwen OAuth — no credit card, no subscription.
The selling points:
| Aspect | Qwen Code | My opencode Setup |
|---|---|---|
| Cost | Free (2,000 req/day) | Paid (Z.AI Coding Plan) |
| License | Apache 2.0 | Open source |
| Extension sources | Qwen + Gemini + Claude marketplaces | Skills-based only |
| IDE support | VS Code, Zed, JetBrains | Terminal |
| SDK | TypeScript + Java | None |
| Subagents | Configurable concurrency/nesting | Task-based |
| SWE-bench | ~69.6% | N/A (provider-dependent) |
The 0.8% gap behind Claude on SWE-bench at $0 vs $240/year makes it a no-brainer for everyday tasks.
The Architecture
My Qwen Code setup follows the same three principles as my opencode config:
- Prompt Engineering — bkit’s 21 agents and 35 skills enforce structured workflows
- RAG — Context7 + Tavily provide current information
- Context Engineering — context-mode protects the context window
pm-discovery, pm-lead"] D["Design
phase-1 to phase-9"] C["Check
code-review, qa-monitor"] A["Act
pdca-iterator, deploy"] end subgraph L1["Layer 1: RAG"] R1["Context7
Live library docs"] R2["Tavily (7 skills)
Search, extract, research"] end subgraph L2["Layer 2: Context Protection"] CM["context-mode
Sandbox execution
FTS5 knowledge base"] end subgraph L3["Layer 3: Domain Skills"] S1["Vue/Go/Tailwind/Astro
framework skills"] S2["Testing/Security
vitest, accessibility"] S3["Research
tavily-*, find-docs"] end P --> D --> C --> A Core --> L1 Core --> L2 Core --> L3 style Core fill:#fff3e0,stroke:#f57c00,stroke-width:3px style L1 fill:#e3f2fd,stroke:#1976d2,stroke-width:2px style L2 fill:#e8f5e9,stroke:#388e3c,stroke-width:2px style L3 fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
The Core — bkit PDCA Workflow Engine
Without structure, AI assistants freestyle. bkit solves this by enforcing the PDCA (Plan-Do-Check-Act) methodology — a 10-event hook system that intercepts the full Qwen Code lifecycle.
What Is bkit?
bkit is an extension originally built for Gemini CLI that auto-converts to Qwen Code format. It provides three layers of Context Engineering:
| Layer | Components | Count | Purpose |
|---|---|---|---|
| Domain Knowledge | Skills | 35 | Expert knowledge activated on-demand |
| Behavioral Rules | Agents | 21 | Role-based constraints with model/tool config |
| State Management | Hook Scripts + Lib Modules | 17 + 13 | PDCA tracking, intent detection, permission control |
The 10-Event Hook System
bkit intercepts Qwen Code’s full lifecycle:
Init + level detect"] --> B["BeforeAgent
Intent detection"] B --> C["BeforeModel
Prompt augmentation"] C --> D["AfterModel
Response tracking"] D --> E["BeforeToolSelection
Phase-based filtering"] E --> F["BeforeTool
Permission blocking"] F --> G["AfterTool
Phase auto-transition"] G --> H["AfterAgent
Cleanup"] H --> I["PreCompress
Context snapshot"] I --> J["SessionEnd
Memory persistence"] style A fill:#e3f2fd,stroke:#1976d2,stroke-width:1px style B fill:#e3f2fd,stroke:#1976d2,stroke-width:1px style C fill:#fff3e0,stroke:#f57c00,stroke-width:2px style F fill:#ffcdd2,stroke:#d32f2f,stroke-width:2px style I fill:#e8f5e9,stroke:#388e3c,stroke-width:1px
The key insight: phase-based tool filtering. During the Plan phase, bkit restricts tools to read-only. During Do, all tools unlock. This prevents the AI from making changes before it understands the codebase.
The 21 Agents
bkit provides specialized agents that auto-activate based on task type and project level:
| Category | Agents | What They Do |
|---|---|---|
| Orchestration | cto-lead, pipeline-guide | High-level task delegation and workflow management |
| Product | pm-discovery, pm-lead, pm-prd, pm-research, pm-strategy, product-manager | Requirements, research, PRD generation |
| Code | bkend-expert, frontend-architect, code-analyzer, design-validator | Architecture, analysis, validation |
| Quality | qa-monitor, qa-strategist, security-architect | Testing, QA, security review |
| Infra | infra-architect | Infrastructure and deployment |
| Dynamic | pdca-iterator, starter-guide, enterprise-expert | Level-specific guidance |
| Reporting | report-generator, gap-detector | Analysis and gap identification |
Project level auto-detection:
| Level | Trigger | Default Agent |
|---|---|---|
| Starter | Default (no k8s/terraform/backend) | starter-guide |
| Dynamic | docker-compose.yml, .mcp.json, backend dirs | bkend-expert |
| Enterprise | kubernetes/, terraform/ dirs | enterprise-expert |
The 35 Skills
The skills cover the full development lifecycle:
| Phase | Skills | Purpose |
|---|---|---|
| Discovery | pm-discovery, simplify | Understand what to build |
| Planning | plan-plus, pdca, bkit-rules | Structured planning |
| Design | phase-1-schema through phase-9-deployment | 9-phase design pipeline |
| Backend | bkend-auth, bkend-data, bkend-security, bkend-storage, bkend-api, bkend-mcp | Backend-specific guidance |
| Frontend | phase-3-mockup, phase-5-design-system, phase-6-ui-integration | Frontend pipeline |
| Quality | code-review, zero-script-qa, phase-8-review | Review and testing |
| Meta | bkit-templates, bkit-rules, output-style-setup, loop | Configuration and iteration |
Configuration
bkit installs as a Qwen Code extension with these settings:
{ "contextFileName": ["GEMINI.md"], "settings": [ { "name": "Output Style", "description": "Response formatting style (bkit-learning, bkit-pdca-guide, bkit-enterprise, bkit-pdca-enterprise)", "envVar": "BKIT_OUTPUT_STYLE" }, { "name": "Project Level", "description": "Override auto-detected project level (Starter, Dynamic, Enterprise)", "envVar": "BKIT_PROJECT_LEVEL" } ]}Key bkit config highlights:
- PDCA status file:
.pdca-status.json— tracks phase transitions automatically - Auto-iterate: Enabled by default, up to 5 iterations per task
- Model routing: Pro models for plan/design/do, flash models for check/act/report
- Team orchestration: Supports up to 10 agents with 5 patterns (leader, council, swarm, pipeline, watchdog)
- Agent memory: Persistent across sessions, scoped per-project or per-user
Installation:
qwen extensions install <bkit-repo-url>qwen extensions settings bkitLayer 1 — Current Information (Context7)
The Problem
Models trained months ago hallucinate confidently about APIs that have since changed.
The Solution — Context7 Extension
Context7 provides an MCP server that queries live library documentation on demand.
Installation:
qwen extensions install context7qwen extensions settings context7 # Set CONTEXT7_API_KEYExtension manifest:
{ "name": "context7", "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "${CONTEXT7_API_KEY}"] } }}Included skills (3):
| Skill | Purpose |
|---|---|
context7-cli | Use ctx7 CLI to resolve and fetch docs |
context7-mcp | Use Context7 MCP tools directly |
find-docs | Unified skill for finding library documentation |
Workflow: Resolve library ID first (ctx7 library), then query docs (ctx7 docs). If you already know the ID, skip straight to querying. Supports version-specific docs.
Layer 2 — Context Protection (context-mode)
The Problem
Raw tool outputs flood the context window. A single Playwright snapshot is 56 KB. The session dies before any real work happens.
The Solution — context-mode
context-mode intercepts tool outputs and routes them through an isolated subprocess. Only condensed summaries enter context. Full data stays in a searchable FTS5 database.
AGENTS.md Enforcement
This is identical to my opencode setup — the same rules file works across both tools:
| Rule | What’s Blocked | What You Use Instead |
|---|---|---|
| curl/wget | Shell HTTP calls | ctx_fetch_and_index or ctx_execute |
| Inline HTTP | fetch(), requests.get() in shell | ctx_execute sandbox |
| Shell >20 lines | Raw command output | ctx_batch_execute or ctx_execute |
Tool hierarchy (same as opencode):
- GATHER:
ctx_batch_execute— primary tool, one call replaces 30+ individual calls - FOLLOW-UP:
ctx_search— query indexed content with natural language - PROCESSING:
ctx_execute/ctx_execute_file— sandboxed subprocess execution - WEB:
ctx_fetch_and_index— fetch, chunk, index, query without touching context - INDEX:
ctx_index— store content in FTS5 for later retrieval
Output constraints:
- Keep responses under 500 words
- Write artifacts to files, not inline text
- Use descriptive source labels for indexed content
Layer 3 — Domain Skills (26 Shared Skills)
These live in ~/.agents/skills/ and are shared between Qwen Code and opencode:
Framework Skills (10)
| Skill | Domain | Key Capabilities |
|---|---|---|
vue | Vue 3 | Composition API, <script setup>, reactivity |
vue-best-practices | Vue | Enforces Composition API + TypeScript standard |
vue-router-best-practices | Vue Router 4 | Navigation guards, route params |
vue-testing-best-practices | Vue testing | Vitest, Vue Test Utils, Playwright |
vueuse-functions | VueUse | Composables for concise Vue features |
pinia | State management | Type-safe stores, actions, getters |
astro | Astro | SSG, islands, content collections |
daisyui-5 | Tailwind CSS 4 | DaisyUI components and patterns |
tailwind-design-system | Design systems | Tokens, component libraries |
tailwindcss-advanced-layouts | Tailwind | CSS Grid and Flexbox patterns |
Go Skills (2)
| Skill | Domain |
|---|---|
golang-patterns | Idiomatic Go, best practices |
golang-documentation | godoc, README, examples |
Research Skills (8)
| Skill | Purpose |
|---|---|
find-docs | Fetch current library documentation |
tavily-search | Web search for current information |
tavily-extract | Extract content from known URLs |
tavily-map | Discover URLs on a website |
tavily-crawl | Bulk extract from site sections |
tavily-research | Deep multi-source analysis with citations |
tavily-cli | General Tavily CLI reference |
tavily-best-practices | Production Tavily integration patterns |
Quality & Other Skills (6)
| Skill | Purpose |
|---|---|
vitest | Fast unit testing with Vite |
accessibility-a11y | WCAG compliance |
web-design-guidelines | UI review and audit |
slidev | Technical presentations |
turborepo | Monorepo build system |
agent-browser | Browser automation |
Why shared? Both Qwen Code and opencode support the ~/.agents/skills/ directory. One skill file, two AI assistants, zero duplication.
Global Configuration
settings.json
{ "security": { "auth": { "selectedType": "qwen-oauth" } }, "model": { "name": "coder-model" }, "permissions": { "allow": [ "Bash(npm init *)", "Bash(git add *)", "Bash(git commit *)", "Bash(git push)" ] }}Output Language
Enforced via ~/.qwen/output-language.md:
- Default: English (mandatory, not preference)
- Exception: Explicit language request switches for remainder of conversation
- Technical artifacts (code, CLI commands, file paths) preserved verbatim
File Structure
~/.qwen/├── AGENTS.md # Context-mode routing rules├── settings.json # Auth, model, permissions├── output-language.md # Language enforcement├── extensions/│ ├── bkit/ # PDCA workflow engine│ │ ├── qwen-extension.json│ │ ├── bkit.config.json # 248-line centralized config│ │ ├── agents/ # 21 specialized agents│ │ ├── skills/ # 35 PDCA/phase skills│ │ ├── hooks/ # 10-event hook system│ │ ├── mcp/ # Spawn-agent MCP server│ │ └── policies/ # Level-based policies│ └── context7/ # Live documentation│ ├── qwen-extension.json│ └── skills/ # 3 doc-fetching skills├── projects/ # Per-project chat history└── todos/ # Persistent task trackingWhat Makes Qwen Code Different
Beyond what I’ve configured, Qwen Code has features I haven’t fully explored yet:
Approval Modes
Four modes, cycled with Shift+Tab:
| Mode | File Edits | Shell | MCP | Best For |
|---|---|---|---|---|
plan | Read-only | Read-only | Read-only | Code review, exploration |
default | Prompt | Prompt | Prompt | Daily development |
auto-edit | Auto | Prompt | Prompt | Bulk refactoring |
yolo | Auto | Auto | Auto | CI/CD, containers |
Sandbox Execution
- macOS: Seatbelt profiles (6 built-in: permissive/restrictive x open/closed/proxied)
- Linux: Docker/Podman with custom Dockerfiles
- Custom profiles:
.qwen/sandbox-macos-*.sbor.qwen/sandbox.Dockerfile
LSP Integration
Experimental (--experimental-lsp): go-to-definition, find references, call hierarchy, hover, diagnostics, code actions.
Headless Mode
# Non-interactive for scripts/CIqwen -p "Run tests and fix failures" --approval-mode yolo
# Pipe inputcat requirements.txt | qwen -p "Create a project from these requirements"
# Stream JSON for tool integrationqwen -p "Analyze" --output stream-json > session.jsonlMulti-Provider Support
Use any model from one CLI:
{ "modelProviders": { "openai": [ { "id": "qwen3.5-plus", "baseUrl": "https://...", "envKey": "BAILIAN_CODING_PLAN_API_KEY" }, { "id": "gpt-4o", "envKey": "OPENAI_API_KEY" } ], "anthropic": [ { "id": "claude-sonnet-4-20250514", "envKey": "ANTHROPIC_API_KEY" } ], "gemini": [ { "id": "gemini-2.5-pro" } ] }}Switch models mid-session with /model.
Subagents
Configurable parallel task delegation:
{ "subagents": { "maxConcurrent": 4, "maxNestingDepth": 2, "defaultModel": "gemini-2.5-flash", "inheritApprovalMode": true }}Session Checkpointing
Enable via general.checkpointing.enabled — restores token counts, request counts, and model usage on resume.
What I Could Install Next
| Extension/Tool | Why | Install Command |
|---|---|---|
qwen-cli-extensions/security | /security:analyze security scanning | qwen extensions install qwen-cli-extensions/security |
qwen-cli-extensions/code-review | Automated code review | qwen extensions install qwen-cli-extensions/code-review |
server-github MCP | Native GitHub Issues/PRs/Actions | qwen mcp add github npx -y @modelcontextprotocol/server-github |
server-filesystem MCP | Filesystem operations with search | qwen mcp add filesystem npx -y @modelcontextprotocol/server-filesystem ~ |
| Claude Marketplace plugins | Thousands of extensions | /extensions explore ClaudeCode |
| Gemini Gallery extensions | More options | /extensions explore Gemini |
qwen-code-action | CI/CD automated review | GitHub Actions: uses: QwenLM/qwen-code-action@v1 |
| LSP | Go-to-definition, references | --experimental-lsp |
How It Compares to My Opencode Setup
Both setups share the same principles. The difference is execution:
| Aspect | Qwen Code | Opencode |
|---|---|---|
| Cost | Free | Paid |
| Workflow engine | bkit (PDCA, 21 agents, 10 hooks) | Superpowers (brainstorming → TDD → verification) |
| Code intelligence | Not configured | GitNexus (knowledge graph, blast radius) |
| Vision | Not configured | zai-mcp-server + agent-browser |
| Context protection | context-mode (shared AGENTS.md) | context-mode (shared AGENTS.md) |
| RAG | Context7 + Tavily (shared skills) | Context7 + Tavily (shared skills) |
| Skills | 26 shared + 35 bkit = 61 total | 26 shared + Superpowers = ~30 total |
| Approach | Heavy process (PDCA) | Light process (skill-driven) |
When I use which: Qwen Code for structured feature work where PDCA adds value. Opencode for quick tasks, refactoring with GitNexus safety, and vision-dependent debugging.
Closing
The beauty of this setup is that most of it is portable. The 26 shared skills in ~/.agents/skills/ work in both Qwen Code and opencode. The context-mode AGENTS.md is identical. Only the workflow engine differs — bkit for Qwen Code, Superpowers for opencode.
If you’re looking for a free, powerful AI coding setup, start with Qwen Code + Context7 + context-mode. Add bkit when you need structured workflows. Add domain skills as you encounter specific frameworks.
The three principles hold regardless of tool choice: prompt engineering, RAG, and context engineering. Everything else is implementation detail.
References
| Tool | Author | What It Does |
|---|---|---|
| Qwen Code | Qwen (Alibaba) | Open-source AI coding agent for the terminal |
| bkit | POPUP STUDIO | PDCA workflow engine with Context Engineering |
| Context7 | Context7 | Live library documentation retrieval |
| context-mode | mksglu | MCP plugin for context window protection |
| Tavily | Tavily | Web search, extraction, crawling, and research |
| agent-browser | Vercel | Browser automation for AI agents |
| Qwen Code Docs | Qwen | Official documentation |
This article was written by opencode (GLM-5-Turbo | Z.AI Coding Plan).


