Xpersona
A

Alibabacloud Dms Skill

CLAWHUB · Unverified

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: "...

62
Rank
84
Safety
959
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 959 downloads reported by the source. Last updated 10/12/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s173swjet2yrebzqrp6hjkvmy583mxef:alibabacloud-dms-skill
  1. Install using `clawhub skill install s173swjet2yrebzqrp6hjkvmy583mxef:alibabacloud-dms-skill` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/sdk-team/alibabacloud-dms-skill before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-sdk-team-alibabacloud-dms-skill/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

101,660 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: alibabacloud-dms-skill
description: |
  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".
---

# Alibaba Cloud DMS Database Read/Write

Search for target databases and execute SQL queries and data modifications via Alibaba Cloud DMS OpenAPI.

## Scenario Description

This skill implements the following workflow:

1. **Search Target Database** — Search databases by keyword to get Database ID
2. **Execute SQL Query** — Execute SQL statements on the target database

### Architecture

```
User Request → Search Database → Get Database ID → Execute SQL → Return Results
```

## Prerequisites

### AI-Mode Lifecycle (MUST follow in order)

This skill MUST run inside an AI-Mode session. Treat the following five steps as a strict lifecycle — do not skip, reorder, or interleave the setup steps with command execution:

```
1. aliyun configure ai-mode enable                                              # Enable AI-Mode
2. aliyun configure ai-mode set-user-agent AlibabaCloud-Agent-Skills/alibabacloud-dms-skill   # Register skill User-Agent
3. aliyun configure set --auto-plugin-install true && aliyun plugin update      # Plugin update
4. <execute DMS commands via ./scripts/*.sh>                                    # Execute commands
5. aliyun configure ai-mode disable                                             # Disable AI-Mode (Cleanup)
```

Steps 1–3 belong to setup (this section). Step 4 is covered by [Core Workflow](#core-workflow). Step 5 is covered by [Cleanup](#cleanup).

### Pre-checks

> **Pre-check 0: Aliyun CLI >= 3.3.3 required**
> Run `aliyun version` to verify >= 3.3.3. If not installed or version too low,
> run `curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash` to install/update,
> or see `references/cli-installation-guide.md` for installation instructions.

> **Pre-check 1: Enable AI-Mode**
> [MUST] run `aliyun configure ai-mode enable` to enable AI-Mode before any other configuration or command.
> This activates the AI-Mode session that downstream OpenAPI services use to recognize agent-issued traffic.

> **Pre-check 2: Register skill User-Agent under AI-Mode**
> [MUST] run `aliyun configure ai-mode set-user-agent AlibabaCloud-Agent-Skills/alibabacloud-dms-skill`
> to register this skill's identifier as the AI-Mode User-Agent for the current session.
> Run this immediately after `ai-mode enable` and before any plugin update or DMS command.

> **Pre-check 3: Aliyun CLI plugin update required**
> [MUST] run `aliyun configure set --auto-plugin-install true` to enable automatic plugin installation.
> [MUST] run `aliyun plugin update` to ensure that any existing plugins are always up-to-date.
> Plugin update MUST happen AFTER AI-Mode is enabled and the User-Agent is registered, so the plugin manager itself reports the corre

_meta.json

{
  "ownerId": "kn74p5w8ywv6prh40g0s82gmqh83nw54",
  "slug": "alibabacloud-dms-skill",
  "version": "0.0.2",
  "publishedAt": 1776750713095
}

references/acceptance-criteria.md

# Acceptance Criteria: DMS Database Query

**Scenario**: DMS Database Query Workflow
**Purpose**: Skill testing acceptance criteria

---

## Correct SDK Code Patterns

### 1. Import Patterns

#### ✅ CORRECT
```python
from alibabacloud_dms_enterprise20181101.client import Client as DmsClient
from alibabacloud_dms_enterprise20181101 import models as dms_models
from alibabacloud_tea_openapi import models as open_api_models
```

#### ❌ INCORRECT
```python
# Wrong: Using old SDK import paths
from aliyunsdkdms_enterprise.request.v20181101 import GetUserActiveTenantRequest

# Wrong: Missing required imports
from alibabacloud_dms_enterprise20181101 import Client  # Missing models
```

---

### 2. Client Initialization

#### ✅ CORRECT
```python
def create_client() -> DmsClient:
    ak = os.getenv("ALICLOUD_ACCESS_KEY_ID") or os.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID")
    sk = os.getenv("ALICLOUD_ACCESS_KEY_SECRET") or os.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET")
    if not ak or not sk:
        raise RuntimeError("Missing credentials")
    config = open_api_models.Config(
        access_key_id=ak,
        access_key_secret=sk,
        endpoint="dms-enterprise.cn-hangzhou.aliyuncs.com",
    )
    return DmsClient(config)
```

#### ❌ INCORRECT
```python
# Wrong: Hardcoded credentials
config = open_api_models.Config(
    access_key_id="LTAI5tXXXXXXXX",  # NEVER hardcode
    access_key_secret="8dXXXXXXXXXX",  # NEVER hardcode
)

# Wrong: Missing endpoint
config = open_api_models.Config(
    access_key_id=ak,
    access_key_secret=sk,
    # endpoint missing
)
```

---

### 3. Get Tenant ID (Tid)

#### ✅ CORRECT
```python
def get_tid(client: DmsClient) -> int:
    resp = client.get_user_active_tenant(dms_models.GetUserActiveTenantRequest())
    if not resp.body.success:
        raise RuntimeError(f"Failed to get Tid: {resp.body.error_message}")
    return resp.body.tenant.tid
```

#### ❌ INCORRECT
```python
# Wrong: Not checking success status
def get_tid(client):
    resp = client.get_user_active_tenant(dms_models.GetUserActiveTenantRequest())
    return resp.body.tenant.tid  # May fail silently

# Wrong: Hardcoded Tid
tid = 12345  # NEVER hardcode Tid
```

---

### 4. Search Database

#### ✅ CORRECT
```python
def search_databases(keyword: str) -> list[dict]:
    client = create_client()
    tid = get_tid(client)
    req = dms_models.SearchDatabaseRequest(search_key=keyword, tid=tid)
    resp = client.search_database(req)
    records = []
    if resp.body.search_database_list and resp.body.search_database_list.search_database:
        for db in resp.body.search_database_list.search_database:
            records.append({
                "database_id": db.database_id,
                "schema_name": db.schema_name,
            })
    return records
```

#### ❌ INCORRECT
```python
# Wrong: Not passing Tid
req = dms_models.SearchDatabaseRequest(search_key=keyword)  # Missing tid

# Wrong: Not handling empty results
for db in resp.body.search_database_list.search_data

references/cli-installation-guide.md

# Aliyun CLI Installation & Configuration Guide

Complete guide for installing and configuring Aliyun CLI.

> **Aliyun CLI 3.3.3+**: Supports installing and using all published Alibaba Cloud product plugins. Make sure to upgrade to 3.3.3 or later for full plugin ecosystem coverage.

## Installation

### macOS

**Using Homebrew (Recommended)**
```bash
brew install aliyun-cli
# Upgrade to latest
brew upgrade aliyun-cli

# Verify version (>= 3.3.3)
aliyun version
```

**Using Binary**
```bash
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-macosx-latest-amd64.tgz

# Extract
tar -xzf aliyun-cli-macosx-latest-amd64.tgz

# Move to PATH
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version
```

### Linux

**Debian/Ubuntu**
```bash
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz

# Extract and install
tar -xzf aliyun-cli-linux-latest-amd64.tgz
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version
```

**CentOS/RHEL**
```bash
# Download
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz

# Extract and install
tar -xzf aliyun-cli-linux-latest-amd64.tgz
sudo mv aliyun /usr/local/bin/

# Verify
aliyun version
```

**ARM64 Architecture**
```bash
# Download ARM64 version
wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz

# Extract and install
tar -xzf aliyun-cli-linux-latest-arm64.tgz
sudo mv aliyun /usr/local/bin/
```

### Windows

**Using Binary**
1. Download from: https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip
2. Extract the ZIP file
3. Add the directory to your PATH environment variable
4. Open new Command Prompt or PowerShell
5. Verify: `aliyun version`

**Using PowerShell**
```powershell
# Download
Invoke-WebRequest -Uri "https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip" -OutFile "aliyun-cli.zip"

# Extract
Expand-Archive -Path aliyun-cli.zip -DestinationPath C:\aliyun-cli

# Add to PATH (requires admin privileges)
$env:Path += ";C:\aliyun-cli"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::Machine)

# Verify
aliyun version
```

## Configuration

### Quick Start

```bash
aliyun configure set \
  --mode AK \
  --access-key-id <your-access-key-id> \
  --access-key-secret <your-access-key-secret> \
  --region cn-hangzhou
```

All `aliyun configure` commands support non-interactive flags, which is the recommended approach —
it works in scripts, CI/CD pipelines, and agent-driven automation without hanging on stdin prompts.

**Where to Get Access Keys**

1. Log in to Aliyun Console: https://ram.console.aliyun.com/
2. Navigate to: AccessKey Management
3. Create a new AccessKey pair
4. Save the secret immediately — it's only shown once

### Configuration Modes

Aliyun CLI supports 6 authentication modes. All examples below use non-interactive flags.

#### 1. AK Mode (Access Key)

Most common mode for personal accounts and scripts.

```bash
aliyun configure set \
  --mode AK \
  --access-key-id LTAI5tXXXXXXX

references/ram-policies.md

# RAM Policies for DMS Database Query

This document lists the RAM (Resource Access Management) permissions required for the DMS database query workflow.

## Summary Table

| Product | RAM Action | Resource Scope | Description |
|---------|-----------|----------------|-------------|
| DMS | dms:GetUserActiveTenant | * | Get tenant ID |
| DMS | dms:SearchDatabase | * | Search databases by keyword |
| DMS | dms:ExecuteScript | * | Execute SQL scripts |

## RAM Policy Document

```json
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "dms:GetUserActiveTenant",
        "dms:SearchDatabase",
        "dms:ExecuteScript"
      ],
      "Resource": "*"
    }
  ]
}
```

## Minimal Permission Policy

For production environments, consider restricting permissions to specific resources:

```json
{
  "Version": "1",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "dms:GetUserActiveTenant"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "dms:SearchDatabase"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "dms:TenantId": "${your-tenant-id}"
        }
      }
    },
    {
      "Effect": "Allow",
      "Action": [
        "dms:ExecuteScript"
      ],
      "Resource": "acs:dms:*:*:database/${database-id}",
      "Condition": {
        "StringEquals": {
          "dms:SqlType": ["SELECT"]
        }
      }
    }
  ]
}
```

## Permission Descriptions

### dms:GetUserActiveTenant

- **Purpose**: Retrieve the tenant ID (Tid) for the current user
- **Required**: Yes (prerequisite for all other DMS API calls)
- **Resource**: `*` (tenant-level operation)

### dms:SearchDatabase

- **Purpose**: Search for databases by keyword
- **Required**: Yes (to find the target database)
- **Resource**: `*` (searches across all accessible databases)

### dms:ExecuteScript

- **Purpose**: Execute SQL scripts on a database
- **Required**: Yes (core functionality)
- **Resource**: Can be restricted to specific database IDs
- **Note**: This permission allows execution of SELECT, DML, and DDL statements. Consider restricting to read-only queries in production.

## Best Practices

1. **Least Privilege**: Only grant `dms:ExecuteScript` on specific databases that users need to access
2. **Read-Only Access**: For reporting/analytics users, consider creating a separate policy that only allows SELECT queries
3. **Audit Logging**: Enable DMS audit logging to track all SQL executions
4. **Regular Review**: Periodically review and revoke unnecessary permissions

## Related Documentation

- [Alibaba Cloud RAM Documentation](https://help.aliyun.com/zh/ram/)
- [DMS Permission Management](https://help.aliyun.com/zh/dms/user-guide/permission-management)

Sponsored

Ads related to Alibabacloud Dms Skill and adjacent AI workflows.