/alibabacloud-bailian-rag-knowledgebase
Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use HTTPS API to query and retrieve knowledge base content. Use when: User needs to query knowledge base, retrieve document content, or answer questions based on knowledge base. Prerequisites: (1) Configure DashScope API Key
$ npx -y skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-bailian-rag-knowledgebase --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/alibabacloud-bailian-rag-knowledgebase
Context preview
The summary Claude sees to decide when to auto-load this skill.
Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use HTTPS API to query and retrieve knowledge base content. Use when: User needs to query knowledge base, retrieve document content, or answer questions based on knowledge base. Prerequisites: (1) Configure DashScope API Key
SKILL.md
alibabacloud-bailian-rag-knowledgebase.SKILL.mdname: alibabacloud-bailian-rag-knowledgebase
description: "Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use HTTPS API to query and retrieve knowledge base content. Use when: User needs to query knowledge base, retrieve document content, or answer questions based on knowledge base. Prerequisites: (1) Configure DashScope API Key (2) Activate Bailian Knowledge Base service."
Bailian Knowledge Base Retrieval
This Skill provides query and retrieval capabilities for Alibaba Cloud Bailian Knowledge Base via HTTPS API.
API Key Security Management
Scripts automatically handle key retrieval via `api_key.py`. The Agent does not need to and should not manually extract, set, or pass API Key values.
- **Key retrieval is automated**: Scripts internally call `api_key.py` to automatically obtain keys from config files/environment variables. The Agent only needs to run the script command.
- **Never hardcode any form of key**: Including `api_key = "sk-..."`, `export DASHSCOPE_API_KEY="sk-..."`, and assigning keys in shell scripts.
- **Never extract keys from CLI output**: The Agent must not write key values into any script, variable, or file.
- **Never expose keys in any output**: Including generated scripts, shell commands, log files, and terminal output containing strings starting with `sk-`.
- **Never read or print keys from config files**: Do not use `cat`, `jq`, `python -c`, or other commands to read and output API Key values.
- **Mandatory self-check before task completion**: Run `grep -rn "sk-" <output_directory>/` to check all output files; if any strings starting with `sk-` are found (excluding `sk-xxx` placeholders), delete the affected files and regenerate.
🚀 Initial Setup (Required for First-time Use)
1. Configure API Key
API Keys are managed by the unified `scripts/api_key.py` module, with the following retrieval priority: 1. Alibaba Cloud CLI config `~/.aliyun/config.json` current profile's `dashscope.api_key` 2. Environment variable `DASHSCOPE_API_KEY` 3. Auto-create and save when Alibaba Cloud CLI is available (`generate_api_key()`)
# All scripts use this unified approach
from api_key import get_api_key
api_key = get_api_key() # Returns str, raises ValueError if not found
Manual environment variable configuration:
export DASHSCOPE_API_KEY=sk-xxx
| Item | Description | |------|-------------| | **Key Format** | `sk-xxx` (standard DashScope API Key) | | **Not Supported** | `sk-sp-xxx` (Coding Plan Key, does not support knowledge base services) | | **Get Key** | https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key |
Alibaba Cloud CLI Configuration (API Key Auto-Create/Delete)
The `scripts/api_key.py` module creates and deletes API Keys via `aliyun modelstudio` commands. Complete the following setup before use:
**1. Update Plugins**
# Update plugins to latest version
aliyun plugin update
**2. Install ModelStudio Plugin** (if not already installed)
aliyun plugin install --names aliyun-cli-modelstudio --enable-pre
**CLI Commands Used**:
| Command | Purpose | Called From | |---------|---------|-------------| | `aliyun modelstudio list-workspaces` | Get Bailian Workspace ID | `api_key.py: _get_workspace_id()` | | `aliyun modelstudio create-api-key` | Create DashScope API Key | `api_key.py: generate_api_key()` | | `aliyun modelstudio delete-api-key` | Delete cloud API Key | `api_key.py: _delete_cloud_api_key()` |
2. Important Prerequisite: Activate Bailian Knowledge Base Service
**Before using this skill, you must first activate the knowledge base service in the Alibaba Cloud Bailian console!**
1. Visit [Bailian Knowledge Base page](https://bailian.console.aliyun.com/cn-beijing/?tab=app#/knowledge-base) 2. Click the **"Activate Now"** button 3. Confirm activation and wait for the service to take effect (usually 1-2 minutes)
Observability (MUST follow for every aliyun command)
Upon loading this skill, generate a random session ID (32-char lowercase hex string) and export it as `SKILL_SESSION_ID`. This value must remain constant for the entire skill session.
Every `aliyun` CLI command and HTTPS API call must include a `User-Agent` identifier for traceability.
User-Agent Format
AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session-id}- `{session-id}` = value of `SKILL_SESSION_ID` environment variable (32-char lowercase hex string)
- Scripts read it via `os.environ.get("SKILL_SESSION_ID", "")`; if empty, generate one with `secrets.token_hex(16)`
Per-Command --user-agent (CLI)
Every `aliyun modelstudio` business command MUST carry `--user-agent` on the command line:
aliyun modelstudio list-workspaces --region cn-beijing \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session-id}"> **Prohibited**: Do NOT set User-Agent via global configuration commands. Only per-command `--user-agent` is allowed.
HTTPS User-Agent Header
All HTTPS API requests set the `User-Agent` HTTP header:
"User-Agent": f"AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session_id}"Applied Locations
| Location | Mechanism | |----------|----------| | `scripts/list_indices.py` | HTTPS `User-Agent` header via `_get_user_agent()` | | `scripts/retrieve.py` | HTTPS `User-Agent` header via `_get_user_agent()` | | `scripts/api_key.py` → `_get_workspace_id()` | `aliyun modelstudio list-workspaces --user-agent ...` | | `scripts/api_key.py` → `generate_api_key()` | `aliyun modelstudio create-api-key --user-agent ...` | | `scripts/api_key.py` → `_delete_cloud_api_key()` | `aliyun modelstudio delete-api-key --user-agent ...` |
Available Scripts
All scripts are located in the `scripts/` directory:
| Script | Purpose | Parameters | |--------|---------|--------
Read more
name: alibabacloud-bailian-rag-knowledgebase description: "Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use HTTPS API to query and retrieve knowledge base content. Use when: User needs to query knowledge base, retrieve document content, or answer questions based on knowledge base. Prerequisites: (1) Configure DashScope API Key (2) Activate Bailian Knowledge Base service."
Bailian Knowledge Base Retrieval
This Skill provides query and retrieval capabilities for Alibaba Cloud Bailian Knowledge Base via HTTPS API.
API Key Security Management
Scripts automatically handle key retrieval via `api_key.py`. The Agent does not need to and should not manually extract, set, or pass API Key values.
- **Key retrieval is automated**: Scripts internally call `api_key.py` to automatically obtain keys from config files/environment variables. The Agent only needs to run the script command.
- **Never hardcode any form of key**: Including `api_key = "sk-..."`, `export DASHSCOPE_API_KEY="sk-..."`, and assigning keys in shell scripts.
- **Never extract keys from CLI output**: The Agent must not write key values into any script, variable, or file.
- **Never expose keys in any output**: Including generated scripts, shell commands, log files, and terminal output containing strings starting with `sk-`.
- **Never read or print keys from config files**: Do not use `cat`, `jq`, `python -c`, or other commands to read and output API Key values.
- **Mandatory self-check before task completion**: Run `grep -rn "sk-" <output_directory>/` to check all output files; if any strings starting with `sk-` are found (excluding `sk-xxx` placeholders), delete the affected files and regenerate.
🚀 Initial Setup (Required for First-time Use)
1. Configure API Key
API Keys are managed by the unified `scripts/api_key.py` module, with the following retrieval priority: 1. Alibaba Cloud CLI config `~/.aliyun/config.json` current profile's `dashscope.api_key` 2. Environment variable `DASHSCOPE_API_KEY` 3. Auto-create and save when Alibaba Cloud CLI is available (`generate_api_key()`)
# All scripts use this unified approach from api_key import get_api_key api_key = get_api_key() # Returns str, raises ValueError if not found
Manual environment variable configuration:
export DASHSCOPE_API_KEY=sk-xxx
| Item | Description | |------|-------------| | **Key Format** | `sk-xxx` (standard DashScope API Key) | | **Not Supported** | `sk-sp-xxx` (Coding Plan Key, does not support knowledge base services) | | **Get Key** | https://bailian.console.aliyun.com/cn-beijing/?tab=app#/api-key |
Alibaba Cloud CLI Configuration (API Key Auto-Create/Delete)
The `scripts/api_key.py` module creates and deletes API Keys via `aliyun modelstudio` commands. Complete the following setup before use:
**1. Update Plugins**
# Update plugins to latest version aliyun plugin update
**2. Install ModelStudio Plugin** (if not already installed)
aliyun plugin install --names aliyun-cli-modelstudio --enable-pre
**CLI Commands Used**:
| Command | Purpose | Called From | |---------|---------|-------------| | `aliyun modelstudio list-workspaces` | Get Bailian Workspace ID | `api_key.py: _get_workspace_id()` | | `aliyun modelstudio create-api-key` | Create DashScope API Key | `api_key.py: generate_api_key()` | | `aliyun modelstudio delete-api-key` | Delete cloud API Key | `api_key.py: _delete_cloud_api_key()` |
2. Important Prerequisite: Activate Bailian Knowledge Base Service
**Before using this skill, you must first activate the knowledge base service in the Alibaba Cloud Bailian console!**
1. Visit [Bailian Knowledge Base page](https://bailian.console.aliyun.com/cn-beijing/?tab=app#/knowledge-base) 2. Click the **"Activate Now"** button 3. Confirm activation and wait for the service to take effect (usually 1-2 minutes)
Observability (MUST follow for every aliyun command)
Upon loading this skill, generate a random session ID (32-char lowercase hex string) and export it as `SKILL_SESSION_ID`. This value must remain constant for the entire skill session.
Every `aliyun` CLI command and HTTPS API call must include a `User-Agent` identifier for traceability.
User-Agent Format
AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session-id}- `{session-id}` = value of `SKILL_SESSION_ID` environment variable (32-char lowercase hex string)
- Scripts read it via `os.environ.get("SKILL_SESSION_ID", "")`; if empty, generate one with `secrets.token_hex(16)`
Per-Command --user-agent (CLI)
Every `aliyun modelstudio` business command MUST carry `--user-agent` on the command line:
aliyun modelstudio list-workspaces --region cn-beijing \
--user-agent "AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session-id}"> **Prohibited**: Do NOT set User-Agent via global configuration commands. Only per-command `--user-agent` is allowed.
HTTPS User-Agent Header
All HTTPS API requests set the `User-Agent` HTTP header:
"User-Agent": f"AlibabaCloud-Agent-Skills/alibabacloud-bailian-rag-knowledgebase/{session_id}"Applied Locations
| Location | Mechanism | |----------|----------| | `scripts/list_indices.py` | HTTPS `User-Agent` header via `_get_user_agent()` | | `scripts/retrieve.py` | HTTPS `User-Agent` header via `_get_user_agent()` | | `scripts/api_key.py` → `_get_workspace_id()` | `aliyun modelstudio list-workspaces --user-agent ...` | | `scripts/api_key.py` → `generate_api_key()` | `aliyun modelstudio create-api-key --user-agent ...` | | `scripts/api_key.py` → `_delete_cloud_api_key()` | `aliyun modelstudio delete-api-key --user-agent ...` |
Available Scripts
All scripts are located in the `scripts/` directory:
| Script | Purpose | Parameters | |--------|---------|--------
Official Alibaba Cloud Agent Skills collection, providing AI agents with rich Alibaba Cloud product capabilities and general-purpose tooling.
Other skills on alibabacloud-aiops-skills.
- /alibabacloud-agentbay-aio-skills
Execute code in a secure cloud sandbox via AgentBay SDK. Use this skill whenever users request to run, execute, or evaluate code (Python, JavaScript, R, Java), including plotting charts, running scripts, or viewing code output. Covers requests like "run this code", "execute
Open skill - /alibabacloud-agentloop-dataset
Operate Alibaba Cloud AgentLoop Dataset resources with aliyun CLI and the AgentLoop API version 2026-05-20. Use when requests concern AgentLoop datasets, data rows, Dataset schemas, embedding fields, semantic search, ExecuteQuery, AgentSpace data, 数据集, 数据写入, 数据查询, 语义检索, or ask
Open skill - /alibabacloud-agentloop-evaluation
Orchestrate AgentLoop evaluation workflows through the Aliyun CLI plugin with safe previews, saved evaluator and evaluator-skill management, one-shot sample tests, trace or dataset batch runs, polling, and result inspection. Analyze evaluation quality and low-score cases from
Open skill - /alibabacloud-agentloop-experience
Proactively use AgentLoop Recall to retrieve prior Alibaba Cloud AgentLoop experience through the bundled SearchContext CLI whenever the user asks or implies that prior work may help. Trigger for requests to check, search, recall, retrieve, look up, review, consult, reference,
Open skill - /alibabacloud-agentloop-management
AgentLoop APM接入 / AI可观测接入 / 应用监控接入 / 自研探针 / 探针安装. Use for Python aliyun-bootstrap (aliyun-instrument), Java AliyunJavaAgent, Golang instgo, Node.js cms_node_sdk, PHP/.NET OpenTelemetry, ack-onepilot, LicenseKey, AgentLoop workspace agentloop-*. Also for LangChain, Dify,
Open skill - /alibabacloud-avatar-video
Use Alibaba Cloud DashScope API and LingMou to generate AI video and speech. Seven capabilities — (1) LivePortrait talking-head (image + audio → video, two-step), (2) EMO talking-head, (3) AA/AnimateAnyone full-body animation (three-step), (4) T2I text-to-image (Wan 2.x, default
Open skill

