MCPInstall

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 (2) Activate Bailian Knowledge Base service.

Installs
442
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/aliyun/alibabacloud-aiops-skills --skill alibabacloud-bailian-rag-knowledgebase
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads alibabacloud-bailian-rag-knowledgebase automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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
ItemDescription
Key Formatsk-xxx (standard DashScope API Key)
Not Supportedsk-sp-xxx (Coding Plan Key, does not support knowledge base services)
Get Keyhttps://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:

CommandPurposeCalled From
aliyun modelstudio list-workspacesGet Bailian Workspace IDapi_key.py: _get_workspace_id()
aliyun modelstudio create-api-keyCreate DashScope API Keyapi_key.py: generate_api_key()
aliyun modelstudio delete-api-keyDelete cloud API Keyapi_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
  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

LocationMechanism
scripts/list_indices.pyHTTPS User-Agent header via _get_user_agent()
scripts/retrieve.pyHTTPS 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:

ScriptPurposeParameters
api_key.pyAPI Key management (get, create, delete)-
list_indices.pyQuery knowledge base list[page_number] [page_size]
retrieve.pyRetrieve from specified knowledge baseindex_id query [top_n]

Workflow

Step 1: Query Knowledge Base List

Run scripts/list_indices.py to get all available knowledge bases:

python3 scripts/list_indices.py

Return format:

[
  {
    "id": "qf91w6402d",
    "name": "Product Documentation",
    "description": "Contains product user manuals, API documentation, etc."
  },
  {
    "id": "ip93d2pyvz",
    "name": "Customer Service Q&A",
    "description": "FAQ, customer service scripts"
  }
]

Pagination: page_number starts from 1 (default), page_size defaults to 10. If current page is not fully retrieved, continue to retrieve next page:

python3 scripts/list_indices.py 2 10

Step 2: Intelligent Knowledge Base Selection

Based on the user's question and knowledge base descriptions, select 1-3 most relevant knowledge bases for retrieval.

Selection Strategy:

  • Match keywords (keywords in question vs knowledge base name/description)
  • Prioritize knowledge bases that explicitly contain relevant fields in their descriptions
  • If uncertain, select all or let user manually select

Step 3: Execute Retrieval

For each selected knowledge base, run scripts/retrieve.py index_id query [top_n]:

python3 scripts/retrieve.py lj3hgbq60t "java" 5

Parameters:

  • index_id (required): Knowledge base ID
  • query (required): Search query text
  • top_n (optional): Number of top results to return, default 5, max 20

The retrieve API uses the following configuration:

  • dense_similarity_top_k: 100
  • sparse_similarity_top_k: 100
  • enable_reranking: true
  • rerank: qwen3-rerank-hybrid with similar mode

Return format, content inside each chunk represents chunk content, doc_name represents source document, score represents match score, title represents chunk section title:

{
  "indexId": "lj3hgbq60t",
  "chunks": [
    {
      "content": "Document chunk content...",
      "score": 0.6040189862251282,
      "doc_name": "example-doc.pdf",
      "title": "Section Title"
    }
  ]
}

Step 4: Integrate Answer

Based on retrieval results:

  1. Sort by relevance (score descending)
  2. Extract key information
  3. Organize answer in natural language
  4. Please annotate the information source at the end of the generated answer (knowledge base name; document name; section name), can reference multiple documents and sections.

Common Errors

401 Unauthorized

{"code": "InvalidApiKey", "message": "Invalid API-KEY"}

API Key is incorrect or not configured. Guide user to check their API Key configuration.

403 Forbidden

{"code": "Forbidden", "message": "Service not activated"}

User has not activated the Bailian Knowledge Base service. Guide user to activate it.

Usage Example

User: "What authentication methods does our product support?"

Flow:

  1. Query knowledge base → Returns 3 knowledge bases
  2. Select knowledge base → "Product Documentation" (most relevant)
  3. Retrieve → Get authentication-related document chunks
  4. Answer → "According to product documentation, OAuth2.0, SAML, and API Key authentication methods are supported..."

Notes

  • API Key is automatically retrieved by scripts, Agent should never handle key values directly
  • When retrieving from multiple knowledge bases, merge results and deduplicate
  • Sort retrieval results by score, prioritize high-relevance content

API Key Auto-Retrieval Flow:

  1. Read ~/.aliyun/config.json current profile's dashscope.api_key → Return if found
  2. Read environment variable DASHSCOPE_API_KEY → Return if found
  3. Alibaba Cloud CLI available → Auto-create via generate_api_key() and save to config
  4. All above fail → Error with setup instructions

FAQ

What does the alibabacloud-bailian-rag-knowledgebase skill do?

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.

How do I install alibabacloud-bailian-rag-knowledgebase?

Run npx skills add https://github.com/aliyun/alibabacloud-aiops-skills --skill alibabacloud-bailian-rag-knowledgebase in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/alibabacloud-bailian-rag-knowledgebase/ (personal) or .claude/skills/alibabacloud-bailian-rag-knowledgebase/ (project).

Which AI agents can use alibabacloud-bailian-rag-knowledgebase?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is alibabacloud-bailian-rag-knowledgebase safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains alibabacloud-bailian-rag-knowledgebase?

It is published by aliyun in aliyun/alibabacloud-aiops-skills. It has 442 recorded installs.

More from aliyun/alibabacloud-aiops-skills

View all →

alibabacloud-find-skills

aliyun/alibabacloud-aiops-skills

Use this skill when users want to search, discover, browse, or find Alibaba Cloud (阿里云) agent skills. Triggers include: "find a skill for X", "search alicloud skills", "阿里云有什么 skill","阿里云", "搜索阿里云技能", "有没有管理 ECS/RDS/OSS 的 skill", "阿里云 skills 有哪些类目", "帮我找一个 skill", "browse alicloud skills", "list alicloud skill categories", "is there an alicloud skill that can...", "what alicloud skills are available", "XX Skill 的内容是什么", "我想了解阿里云 XX Skill 具体做什么","帮我安装阿里云 Skill","使用阿里云相关的skill", "阿里云 agent skill 市场", "搜一下阿里云的 skill", "建一个数据分析项目有没有相关 skill".

AI & Agents2.2K installs

alibabacloud-dms-skill

aliyun/alibabacloud-aiops-skills

Alibaba Cloud DMS Database Read/Write Skill. Use this skill to search for target databases in DMS and execute SQL queries and data modifications. Triggers: "DMS query", "database query", "execute SQL", "search database", "DMS SQL", "insert data", "update data".

Data & Databases2.1K installs

alibabacloud-sls-query

aliyun/alibabacloud-aiops-skills

Alibaba Cloud SLS (Simple Log Service) log query & analysis skill. Use this skill to help users write, explain, optimize, execute, or troubleshoot SLS index search, SQL analytics, and SPL scan/pipeline statements through the aliyun CLI. Triggers: "SLS 查询", "SLS 分析", "日志查询", "日志分析", "log query", "analyze sls logs", "aliyun log query".

Data & Databases2K installs

alibabacloud-workbench-cli

aliyun/alibabacloud-aiops-skills

Agent-native CLI for managing ECS instances without public IPs, primarily for single-instance operations. It supports millisecond-level remote command execution, large file transfers up to 1GB, and TCP port forwarding. It offers four authentication modes: AK, RamRoleArn, CredentialsCmd, and CredentialsURI. Use it to run commands, deploy code, view logs, check processes, transfer files, set up port forwarding, or query and filter ECS instance lists.

DevOps & Cloud717 installs

alibabacloud-ecs-diagnose

aliyun/alibabacloud-aiops-skills

Comprehensive Alibaba Cloud ECS instance diagnostics skill. Performs systematic troubleshooting including cloud platform status checks and GuestOS internal diagnostics via Cloud Assistant. Use when users report server connectivity issues, SSH timeout, instance lag, website unavailability, disk full, CPU/memory alerts, system event notifications, or abnormal instance status. Triggers: "ECS", "instance", "server", "cannot connect", "SSH", "timeout", "slow", "disk full", "network", "CPU high", "memory high", "status check", "system event", "diagnose", "troubleshoot", "disk performance", "disk IO slow", "IOPS", "IO latency"

Backend & APIs686 installs

alibabacloud-cli-guidance

aliyun/alibabacloud-aiops-skills

Guide users to manage Alibaba Cloud resources using the Aliyun CLI command-line tool. Covers CLI installation, credential configuration, plugin management, command construction, and error troubleshooting. Use this skill when the user wants to operate Alibaba Cloud services from the terminal — including ECS (云服务器, cloud servers), Function Compute (函数计算, serverless), RDS (云数据库, databases), OSS (对象存储, object storage), SLS (日志服务, log service), VPC (专有网络, networking), ESS (弹性伸缩, auto scaling), and any other Alibaba Cloud product. Also use when the user mentions "aliyun", "阿里云", "阿里云CLI", "命令行", asks about CLI plugin installation, encounters Aliyun CLI errors (InvalidAccessKeyId, SignatureDoesNotMatch, Throttling), or needs help constructing aliyun commands with correct parameter syntax.

585 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs