К основному содержанию
скилл CX Codex

alibabacloud-das-agent — скилл для Claude Code: диагностика баз

Отправляет вопросы о базах Alibaba Cloud в DAS Agent и возвращает разбор: высокая нагрузка, медленные запросы, место на диске, проверки безопасности.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-das-agent -a claude-code
Открыть на GitHub

Что делает alibabacloud-das-agent

Скилл превращает обычную фразу вроде «база тормозит» в запрос к Alibaba Cloud DAS (Database Autonomy Service). Агент сам собирает данные с monitoring API, прогоняет диагностику и выдаёт результат. Поддерживаются RDS (MySQL, PostgreSQL, SQL Server), PolarDB, MongoDB, Redis (Tair) и Lindorm.

Внутри — скрипт call_das_agent.py, который запускается через uv. Режим --pipe уводит служебный вывод в stderr, а ответ пишет в stdout между разделителями; --json даёт построчный JSONL для разбора программно. Многоходовый диалог держится на session_id из первой строки ответа. Сложные проверки идут последовательными вызовами, поэтому один вопрос может занять от нескольких минут до получаса.

Заранее нужны uv и HTTPS-доступ к das.cn-shanghai.aliyuncs.com, а учётные данные Alibaba Cloud должны разрешаться через стандартную цепочку (право AliyunHDMFullAccess). Если ALIBABA_CLOUD_DAS_AGENT_ID не задан, скрипт не передаёт AgentId и API берёт агента по умолчанию с ограниченной бесплатной квотой — для продакшена покупают подписку и прописывают свой ID. Инстанс обязан быть привязан к агенту: ошибка -1810006 означает, что привязки нет, и её надо сделать в консоли DAS. Вопрос без ID инстанса вроде rm-bp1xxx даст неточный ответ, поэтому ID спрашивают или сначала запрашивают список.

Какие задачи решает

  • разобраться, почему у инстанса вырос CPU
  • найти причину медленных запросов и подсказать, как их переписать
  • проверить, сколько места осталось на диске
  • прогнать health check по нескольким инстансам сразу
  • выявить нарушения security baseline

Примеры запросов агенту

  • Моя база на RDS тормозит, посмотри инстанс rm-bp1xxx
  • Проверь здоровье pc-2zeyyy и скажи, что не так с диском
  • Помоги переписать этот SQL — он долго выполняется

Как установить alibabacloud-das-agent

1Через Skills CLI (Vercel)

npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-das-agent -a claude-code

2Вручную: положить файлы

~/.claude/skills/alibabacloud-das-agent/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/alibabacloud-das-agent/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о alibabacloud-das-agent

Как установить alibabacloud-das-agent в Claude?

Выполните npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-das-agent -a claude-code. После этого файл скилла появится по пути ~/.claude/skills/alibabacloud-das-agent/SKILL.md.

Что делает alibabacloud-das-agent?

Отправляет вопрос на естественном языке в Alibaba Cloud DAS Agent и возвращает диагностику: состояние инстанса, медленные запросы, загрузку CPU, место на диске, проверки безопасности. Работает с RDS, PolarDB, MongoDB, Redis (Tair) и Lindorm.

Что нужно для работы скилла?

Пакетный менеджер uv, HTTPS-доступ к das.cn-shanghai.aliyuncs.com и учётные данные Alibaba Cloud с правом AliyunHDMFullAccess. ALIBABA_CLOUD_DAS_AGENT_ID необязателен: без него используется агент по умолчанию с бесплатной квотой.

Исходный текст

SKILL.md · Apache-2.0
---
name: alibabacloud-das-agent
description: >
  Diagnose and manage Alibaba Cloud databases through natural language. Use when
  users need to troubleshoot database performance issues (high CPU, slow queries,
  abnormal connections, lock waits), check instance status, analyze disk space,
  optimize SQL, run health inspections, or detect security baseline violations.
  Supports RDS (MySQL/PostgreSQL/SQL Server), PolarDB, MongoDB, Redis (Tair),
  and Lindorm. Trigger this skill even for casual descriptions like "my database
  is slow", "can't connect to the database", "help me check this SQL", or
  "database disk is almost full". Also suitable for consulting Alibaba Cloud-specific
  database features (e.g., PolarDB Serverless, DAS autonomy capabilities) and
  comparing product differences (RDS vs PolarDB). Do NOT use this skill for
  general SQL tutorials, non-Alibaba Cloud databases, or local database administration.
license: Apache-2.0
compatibility: >
  Requires uv (Python package manager) and HTTPS access to das.cn-shanghai.aliyuncs.com.
  Requires Alibaba Cloud credentials to be available through the default credential chain
  (AliyunHDMFullAccess permission). DAS Agent ID is optional.
metadata:
  async: true
  timeout: 1800
  required_permissions:
    - "das:Chat"
---

# DAS Agent Chat

Send natural language questions to the Alibaba Cloud DAS (Database Autonomy Service) Agent and receive diagnostic results.

## Pricing and Free Tier

**This is a paid service with a free tier for trial usage.**

- **Free Tier**: When `ALIBABA_CLOUD_DAS_AGENT_ID` is not set, the script omits the `AgentId` parameter and the API will use a **default Agent ID** which comes with a limited free quota for trial purposes.
- **Paid Usage**: For production workloads or higher usage volumes, purchase a DAS Agent subscription and set your own `ALIBABA_CLOUD_DAS_AGENT_ID` to bind your dedicated agent and quota.

> **Recommendation**: Start with the free tier (default Agent ID) to evaluate the service. Once you decide to adopt it for production, purchase a subscription and configure your own Agent ID.

## Environment Variables

The script requires Alibaba Cloud credentials resolvable via the [default credential chain](https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-python-access-credentials). The DAS Agent ID is **optional** — if not provided, the `AgentId` parameter will be omitted and the API will use a default Agent ID with limited free quota.

```bash
# Optional: Set your own Agent ID after purchasing DAS Agent service
export ALIBABA_CLOUD_DAS_AGENT_ID="<agent_id>"               # Obtain from DAS console (optional)
```

The Alibaba Cloud Credentials SDK automatically resolves credentials from multiple sources (environment variables, configuration files, ECS RAM roles, etc.). Refer to the [official credential configuration documentation](https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-python-access-credentials) for setup instructions.

If you have purchased a DAS Agent subscription, create and manage your Agent ID at: https://das.console.aliyun.com/

## Troubleshooting

### Credential Resolution Failed

If the script exits with a credential-related error, it means the Alibaba Cloud Credentials SDK could not resolve a usable credential from its default provider chain.

Supported credential sources:

- Environment variables (see [official documentation](https://www.alibabacloud.com/help/en/sdk/developer-reference/v2-manage-python-access-credentials))
- Local profile files: `~/.aliyun/config.json` or `~/.alibabacloud/credentials.ini`
- ECS RAM Role metadata when running on an Alibaba Cloud ECS instance

Common cases:

- Credential environment variables are empty or missing — configure them according to the official documentation.
- Errors mentioning `~/.aliyun/config.json` or `~/.alibabacloud/credentials.ini`
  The SDK attempted local profile-based credentials, but the files were missing or invalid. Create/fix the default profile if you want to use local profiles.
- Errors mentioning `100.100.100.200`
  The SDK attempted ECS metadata. This is expected on ECS, but usually a local-machine misconfiguration elsewhere.

For local development, if you are not using ECS RAM Role credentials, you can explicitly disable ECS metadata lookup:

```bash
export ALIBABA_CLOUD_ECS_METADATA_DISABLED=true
```

This avoids confusing `100.100.100.200` metadata connection errors on non-ECS machines and makes missing-credential failures easier to read.

## Invocation

Run from the `scripts/` directory of this skill:

```bash
cd scripts

# Pipe mode (RECOMMENDED for agents) — clean output: progress to stderr, answer clearly delimited on stdout
uv run call_das_agent.py --question "<user's question>" --pipe

# Default mode (CLI chat UI) — real-time streaming with tool details
uv run call_das_agent.py --question "<user's question>"

# JSON mode — machine-readable JSONL, one JSON object per line on stdout
uv run call_das_agent.py --question "<user's question>" --json

# Multi-turn conversation — reuse the server-assigned session ID to maintain context
uv run call_das_agent.py --question "List my instances" --pipe  # Returns session_id on first line
# Extract session_id (line starting with "SESSION:"), then reuse it:
uv run call_das_agent.py --question "Check the first one" --session "<session_id_from_above>" --pipe
```

**Always use `--pipe` when invoking as an agent.** It routes all progress/tool-call noise to stderr and writes only the DAS answer to stdout, wrapped in clear delimiters — making the real response impossible to miss.

Prefer `--json` when you need to parse the response programmatically. For JSON event types and output mode details, see [references/api-reference.md](references/api-reference.md).

## Behavioral Notes

DAS Agent internally orchestrates multiple API calls and tool invocations to answer a single question. This has important implications:

1. **Long-running tasks**: Complex diagnostics (multi-instance inspection, comprehensive health checks, batch SQL analysis) can take several minutes up to 30 minutes, because DAS Agent sequentially calls monitoring APIs, runs diagnostics, and synthesizes results. Inform the user before starting and provide periodic progress updates.

2. **Instance enrollment**: The target database instance must be enrolled under the DAS Agent. If you see error code `-1810006`, it means the agent is not associated with any instance — guide the user to the [DAS console settings](https://das.console.aliyun.com/?aes_debug=#/das-agent?currentView=settings) to associate instances.

3. **Include instance ID in questions**: DAS Agent resolves instances by ID (e.g., `rm-bp1xxx`, `pc-2zeyyy`). Always include the specific instance ID in the question for accurate results. If the user hasn't provided one, ask them or first query the instance list.

4. **Parallel execution**: When diagnosing multiple instances, launch multiple script processes in parallel — each invocation is independent and stateless (unless sharing a session ID).

5. **Multi-turn conversations — always reuse the session ID when questions are related**: If the user's questions are sequential or contextually connected (follow-up diagnostics, drill-down analysis, referencing a previous result, comparing findings), you **must** pass `--session <session_id>` on every subsequent call. Starting a new session mid-conversation forces the DAS Agent to re-run all prior context from scratch, wastes time, and produces lower-quality answers.

   **Decision rule**: Default to reusing the session ID. Only start a new session when the user explicitly switches to a completely unrelated topic or asks to "start over".

   The session ID is **server-assigned** and returned as the very first line of every `--pipe` invocation:
   ```
   SESSION: <uuid>
   ```
   Extract it immediately after each call and carry it forward. In `--json` mode it appears as `{"type": "session", "session_id": "..."}` on the first line.

   Examples of when reuse is **mandatory**:
   - "List my instances" → "Check CPU on the first one" → "Why is it high?"
   - "Run a health check on rm-bp1xxx" → "Show me the top slow queries"
   - "What locks are held?" → "Kill that session"

   The DAS Agent retains the full conversation history server-side, so follow-up questions can be short and natural — no need to repeat instance IDs or prior context.

## Output

For output mode comparison and format details, see [references/api-reference.md](references/api-reference.md).

**After running the script, relay the complete stdout to the user verbatim.** Do not summarize, paraphrase, or omit any part of the script's stdout. The DAS Agent's actual diagnostic answer is embedded in the output — the user must see it in full.

For detailed API signature and SSE event documentation, see [references/api-reference.md](references/api-reference.md).

© aliyun · Apache-2.0 · aliyun/alibabacloud-aiops-skills

Похожие скиллы

Все скиллы по теме «Данные и базы» →
creating-amazon-aurora-db-cluster-with-instances aws Создаёт Aurora-кластер с инстансами, настраивает пароль через Secrets Manager и следит за статусом с повторами. Для MySQL и PostgreSQL. CX Codex +1 6 000установок amazon-aurora-postgresql aws Скилл для работы с Aurora PostgreSQL: создаёт кластеры, считает ACU и сравнивает варианты экономии. Полезен, когда база живёт в AWS и нужны действия, а не советы. CX Codex +1 5 600установок databases mrgoonie Скилл с единым справочником по MongoDB и PostgreSQL: схемы, запросы, индексы, миграции, бэкапы и администрирование. CX Codex +1 435установок optimize-database-performance davila7 Слэш-команда для Claude, которая разбирает запросы, индексы и схему базы и предлагает, что переписать. Пригодится, когда страница тормозит на выборке. 794установок database-administrator VoltAgent Community Субагент анализирует базы данных, настраивает производительность, репликацию, резервное копирование и восстановление. Подходит для production-инфраструктуры. 452установок prisma-orm-setup prisma Проводит агента по настройке Prisma ORM: определить версию, подключить базу, проверить соединение. Новые приложения сажает на Prisma ORM 8. CX Codex +1 67 900установок

Из того же набора6

alibabacloud-find-skills Ищет агентские скиллы Alibaba Cloud по задаче, ключевым словам и категориям. Пригодится, когда нужно подобрать скилл для ECS, RDS, OSS или другой облачной работы. CX Codex +1 2 200установок alibabacloud-sls-query Помогает составлять, проверять и запускать поисковые запросы, аналитику SQL и конвейеры SPL в Alibaba Cloud Simple Log Service через интерфейс командной строки aliyun CLI. CX Codex +1 2 000установок alibabacloud-bailian-rag-knowledgebase Скилл даёт агенту доступ к базе знаний Alibaba Cloud Bailian: список баз и выборка документов по запросу через HTTPS API. CX Codex +1 442установок alibabacloud-rds-copilot Скилл подключает ИИ-ассистента Alibaba Cloud RDS Copilot к вашему агенту: вопросы по базам, разбор SQL, диагностика и операции с инстансами. CX Codex +1 438установок alibabacloud-tech-solution-animation-creation-auto-deploy Разворачивает готовое приложение для генерации анимаций на Alibaba Cloud. Создаёт бакет OSS, выпускает ключ Bailian и запускает ComfyUI с WebUI в Function Compute. CX Codex +1 410установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой