For AI agents. After reading this guide, you can independently complete the installation, credential configuration, and availability verification of the Knowledge Studio Skill. Once installed and restarted, your agent can retrieve and answer questions from your knowledge base during conversations.
A self-service setup guide for AI agents. After completing the steps in this document, the Knowledge Studio Skill will be installed, credentials configured, and ready to use—simply restart your agent client to enable knowledge base retrieval and Q&A within conversations.
All three requirements below must be satisfied before the Skill can function properly:
Run the following command in your terminal (replace
Supported agents:
Installation scope: By default, installs into the current project. Add
The Skill’s retrieval script invokes the DashScope API using
Add the following line to your shell configuration file (
Option B: Auto-create via Alibaba Cloud CLI (No manual key management required)
Ideal if you prefer not to handle keys manually. The Skill auto-creates and writes the key upon its first invocation after installation:
RAM users require the
Alternatively, check whether the file exists:
After restarting, simply ask natural-language questions in chat—the agent automatically invokes the Skill:
Prerequisites
All three requirements below must be satisfied before the Skill can function properly:
- Node.js ≥18 — Download and install
- Bailian Knowledge Base service enabled — Visit the Knowledge Base page, click Enable Now, and wait 1–2 minutes for activation. Without activation, API calls return
403 Forbidden. - DashScope API Key — Create one on the API Key page. Format:
sk-xxx. Note: Keys starting withsk-sp-xxxare Coding Plan Keys and are not supported for knowledge base services.
Install the Skill
Run the following command in your terminal (replace --agent with your specific agent):
| Agent | --agent value |
|---|---|
| Claude Code | claude-code |
| Qoder | qoder |
| Qwen Code | qwen-code |
| Cursor | cursor |
| Codex | codex |
| Gemini CLI | gemini-cli |
| GitHub Copilot | github-copilot |
| OpenClaw | openclaw |
-g for global installation (available across all projects).
Configure the API Key (Critical Step)
The Skill’s retrieval script invokes the DashScope API using Authorization: Bearer, requiring a valid API Key. The script automatically retrieves the key in the following priority order:
dashscope.api_keyfrom the current profile in Alibaba Cloud CLI config file (~/.aliyun/config.json)- Environment variable
DASHSCOPE_API_KEY - Auto-created by Alibaba Cloud CLI if available
Add the following line to your shell configuration file (
~/.zshrc or ~/.bashrc), or set it temporarily in the current session:
Ideal if you prefer not to handle keys manually. The Skill auto-creates and writes the key upon its first invocation after installation:
AliyunBailianFullAccess system policy, or a custom policy granting permissions for modelstudio:ListWorkspaces, modelstudio:CreateApiKey, and modelstudio:DeleteApiKey.
Verify Installation
.<agent>/skills/alibabacloud-bailian-rag-knowledgebase/SKILL.md (e.g., .claude/skills/...).
Restart Your Agent Client
How to Use After Setup
After restarting, simply ask natural-language questions in chat—the agent automatically invokes the Skill:
- “List all knowledge bases under my account.”
- “Search the ‘Product Documentation’ knowledge base: What authentication methods are supported?”
id and name), then retrieves relevant chunks matching your question and synthesizes answers, citing sources at the end (knowledge base name; document name; section name).
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
401 InvalidApiKey | API Key missing or invalid | Verify DASHSCOPE_API_KEY or dashscope.api_key in ~/.aliyun/config.json |
403 Forbidden / Service not activated | Knowledge Base service not enabled | Go to the Knowledge Base page in the console and click Enable Now |
| Agent fails to recognize the Skill | Not restarted / incorrect directory / missing SKILL.md | Restart the client and verify existence of .<agent>/skills/alibabacloud-bailian-rag-knowledgebase/SKILL.md |
npx skills add fails | Node version too low / network issue | Confirm Node ≥18 and retry |
Additional Resources
- Interactive installation commands are available on the console’s Integration Channels page
- Alibaba Cloud Skills User Guide