← 返回 Skills 市场
sdk-team

Alibabacloud Dms Skill

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.2 · MIT-0
cross-platform ⚠ suspicious
130
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install alibabacloud-dms-skill
功能描述
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: "...
使用说明 (SKILL.md)

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. \x3Cexecute 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. Step 5 is covered by 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 correct identifier.

  • Aliyun CLI >= 3.3.3
  • jq (for JSON parsing): brew install jq
  • Credentials configured via aliyun configure

Pre-check 4: Alibaba Cloud Credentials Required

Security Rules:

  • NEVER read, echo, or print AK/SK values (e.g., echo $ALIBABA_CLOUD_ACCESS_KEY_ID is FORBIDDEN)
  • NEVER ask the user to input AK/SK directly in the conversation or command line
  • NEVER use aliyun configure set with literal credential values
  • ONLY use aliyun configure list to check credential status
aliyun configure list

Check the output for a valid profile (AK, STS, or OAuth identity).

If no valid profile exists, STOP here.

  1. Obtain credentials from Alibaba Cloud Console
  2. Configure credentials outside of this session (via aliyun configure in terminal or environment variables in shell profile)
  3. Return and re-run after aliyun configure list shows a valid profile

[MUST] Per-command CLI User-Agent — In addition to the AI-Mode User-Agent registered in Pre-check 2, every aliyun CLI command invocation in step 4 MUST also include: --user-agent AlibabaCloud-Agent-Skills/alibabacloud-dms-skill The per-command flag and the AI-Mode session-level setting are complementary — both MUST be present so the identifier is sent on every request even if the AI-Mode session expires.

RAM Permissions

[MUST] RAM Permission Pre-check: Verify that the current user has the following RAM permissions before execution. See references/ram-policies.md for the complete permission list.

Parameter Confirmation

IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., database keyword, SQL statement, db-id, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.

Parameter Required/Optional Description Default
keyword Required Database search keyword (1-128 chars, alphanumeric) -
db-id Required Database ID (positive integer, obtained from search) -
sql Required SQL statement to execute (1-10000 chars) -
logic Optional Whether to use logic database mode false
force Optional Confirm write operations (INSERT/UPDATE/DELETE) false
dry-run Optional Preview write operations without executing false

Core Workflow

Task 1: Search Target Database

Search for databases by keyword to get the Database ID:

./scripts/search_database.sh \x3Ckeyword> --json

Example:

# Search for databases containing "mydb"
./scripts/search_database.sh mydb --json

The output includes database_id, schema_name, db_type, host, port, etc.

Task 2: Execute SQL Query

Execute SQL using the Database ID obtained in the previous step:

./scripts/execute_query.sh --db-id \x3Cdatabase_id> --sql "\x3CSQL_statement>"

Write Operation Protection

For write operations (INSERT/UPDATE/DELETE), the script implements protective pre-check:

Parameter Description
--force Required to confirm and execute write operations
--dry-run Preview write operations without executing

DDL Operations (DROP/TRUNCATE/ALTER/RENAME) are completely blocked — these must be executed via DMS Console.

Examples:

# Read operations (no confirmation needed)
./scripts/execute_query.sh --db-id 78059000 --sql "SHOW TABLES"
./scripts/execute_query.sh --db-id 78059000 --sql "SELECT * FROM users LIMIT 10" --json

# Write operations - preview first (recommended)
./scripts/execute_query.sh --db-id 78059000 --sql "INSERT INTO users (name) VALUES ('test')" --dry-run

# Write operations - execute with confirmation
./scripts/execute_query.sh --db-id 78059000 --sql "INSERT INTO users (name) VALUES ('test')" --force
./scripts/execute_query.sh --db-id 78059000 --sql "UPDATE users SET name='test' WHERE id=1" --force
./scripts/execute_query.sh --db-id 78059000 --sql "DELETE FROM users WHERE id=1" --force

# Logic database mode
./scripts/execute_query.sh --db-id 78059000 --sql "SELECT 1" --logic

Complete Example

# 1. Search database (assuming searching for "order")
./scripts/search_database.sh order --json
# Example output:
# [{"DatabaseId": "78059000", "SchemaName": "order_db", ...}]

# 2. Execute query
./scripts/execute_query.sh --db-id 78059000 --sql "SELECT COUNT(*) FROM orders"

Success Verification

After executing SQL, check the returned results:

  1. Script return code is 0
  2. Output contains query results (column names and row data)
  3. No error messages
# Verify query success
./scripts/execute_query.sh --db-id \x3Cdb-id> --sql "SELECT 1" --json
# Expected output: [{"Success": true, "RowCount": 1, ...}]

Cleanup

This skill performs read and write operations but does not create persistent resources, so no database resources need to be released.

However, the AI-Mode lifecycle requires an explicit teardown step:

[MUST] Disable AI-Mode after all tasks complete Run aliyun configure ai-mode disable once all DMS commands in this skill session have finished (success or failure). This terminates the AI-Mode session and prevents the registered AlibabaCloud-Agent-Skills/alibabacloud-dms-skill User-Agent from leaking into subsequent unrelated CLI usage.

aliyun configure ai-mode disable

Write Operation Safety

Operation Type Behavior
SELECT / SHOW / DESC Execute directly
INSERT / UPDATE / DELETE Require --force or --dry-run
DROP / TRUNCATE / ALTER / RENAME Blocked — use DMS Console

Available Scripts

Script Description
scripts/search_database.sh Search databases by keyword
scripts/execute_query.sh Execute SQL queries

Note: Scripts use aliyun-cli credentials configured via aliyun configure.

Best Practices

  1. Confirm database — Verify the target database before executing SQL
  2. Use --json parameter — Facilitates programmatic processing of output
  3. Preview write operations — Always use --dry-run first for INSERT/UPDATE/DELETE
  4. Explicit confirmation — Use --force only after reviewing the preview
  5. Avoid DDL operations — DROP/TRUNCATE/ALTER/RENAME are blocked; use DMS Console instead

Reference Links

Document Description
references/cli-installation-guide.md CLI Installation Guide
references/ram-policies.md RAM Permission Policies
references/related-apis.md Related API List
references/acceptance-criteria.md Acceptance Criteria
安全使用建议
This skill appears to do what it says (search DMS and run SQL) but you should proceed cautiously. Before installing/running: 1) Review the two included shell scripts line-by-line and test them in a safe environment (not production). 2) Provide Alibaba Cloud credentials via a least-privilege RAM user or temporary STS token — do NOT use root keys. 3) Note the package metadata does NOT declare required credentials even though the scripts need them; assume the cli-config or ALIBABA_CLOUD_* env vars will be used. 4) The workflow enables AI-Mode and sets `--auto-plugin-install true` and runs `aliyun plugin update` — these change your CLI config and may install/update plugins; consider running these steps manually and revert auto-plugin-install afterwards if you don't want persistent changes. 5) The scripts can execute write SQL (INSERT/UPDATE/DELETE) if you pass --force — the scripts require explicit confirmation for writes, but double-check inputs and consider dry-run/read-only testing first. 6) If you have concerns, run the skill only in an isolated account or sandbox and restrict DMS permissions to specific database IDs and SELECT-only where possible.
能力标签
requires-walletrequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
Name/description, SKILL.md, and scripts implement DMS database search and SQL execution and therefore legitimately require Alibaba Cloud credentials and aliyun CLI. However the registry metadata declares no required environment variables or primary credential, which is inconsistent. The included references also show the skill expects environment or CLI-stored credentials (ALIBABA_CLOUD_* / ALICLOUD_*), reinforcing the omission.
Instruction Scope
The runtime instructions require enabling an 'AI-Mode' session, setting a skill user-agent, and running `aliyun plugin update` and `--auto-plugin-install true` before executing the provided scripts. Those steps alter the user's CLI configuration and may cause automatic plugin installs/updates. The scripts themselves run the aliyun CLI and execute arbitrary SQL provided by the user (including write DML when --force is supplied). The workflow enforces explicit user confirmation for write ops, which is good, but the requirement to change plugin/install settings and to persist a session-level user-agent are side effects users should be aware of.
Install Mechanism
There is no install spec that downloads/extracts arbitrary code — the skill is instruction + shell scripts. The SKILL.md suggests installing aliyun-cli via official URLs/Homebrew, which is expected. No unusual remote download/install steps are embedded in the skill package itself.
Credentials
The skill requires access to Alibaba Cloud credentials and a configured aliyun CLI, and documentation references environment variables (ALIBABA_CLOUD_* / ALICLOUD_*). The registry metadata, however, lists no required env vars or primary credential, which understates required secrets. The RAM policy docs also show broad actions (ExecuteScript with Resource "*") unless the user reduces scope — users should supply least-privilege credentials and not global/root keys.
Persistence & Privilege
The skill does not set always:true and does not request persistent platform privileges, but its lifecycle instructions modify the user's aliyun CLI configuration (enable AI-Mode, set --auto-plugin-install true, run plugin update, set a session-level user-agent). Some of those settings persist (e.g., auto-plugin-install) and plugin update modifies locally installed plugins. The SKILL.md does not instruct reverting the auto-plugin-install setting, so these side effects are potentially persistent and surprising.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-dms-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-dms-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.2
alibabacloud-dms-skill v0.0.2 changelog: - Added mandatory AI-Mode lifecycle steps for all operations, including session setup and teardown. - Raised minimum Aliyun CLI version requirement to 3.3.3. - Enforced per-command and session-level User-Agent setting for all CLI calls. - Introduced strong write operation protection: `--force` required for INSERT/UPDATE/DELETE, with preview support via `--dry-run`. - Updated parameter rules and clarified security, confirmation, and workflow documentation. - Improved CLI installation and plugin update guidance in CLI installation reference.
v0.0.1-beta.2
- Write (INSERT/UPDATE/DELETE) and DDL (DROP/TRUNCATE/ALTER/RENAME) operation handling and protection were removed from documentation; skill is now described as query-only. - Usage instructions and parameters updated to reflect query-only operations. - References to force/dry-run write confirmation parameters have been removed. - Documentation clarified to advise caution with sensitive operations rather than prescribing write/DDL controls. - Cleanup and housekeeping sections updated for read/query-only actions.
v0.0.1
Initial release of Alibaba Cloud DMS Database Read/Write Skill. - Enables searching for target databases in Alibaba Cloud DMS by keyword and retrieves database IDs. - Allows execution of SQL queries and data modification commands on selected databases via DMS OpenAPI. - Implements safety checks: write operations (INSERT/UPDATE/DELETE) require explicit confirmation with --force or preview with --dry-run; DDL operations (DROP/TRUNCATE/ALTER/RENAME) are blocked. - Requires Aliyun CLI >= 3.3.1, proper RAM permissions, and pre-configured Alibaba Cloud credentials. - Provides usage scripts, safety rules, parameter confirmation, and best practices for safe database operations.
元数据
Slug alibabacloud-dms-skill
版本 0.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Alibabacloud Dms Skill 是什么?

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: "... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 130 次。

如何安装 Alibabacloud Dms Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alibabacloud-dms-skill」即可一键安装,无需额外配置。

Alibabacloud Dms Skill 是免费的吗?

是的,Alibabacloud Dms Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alibabacloud Dms Skill 支持哪些平台?

Alibabacloud Dms Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alibabacloud Dms Skill?

由 alibabacloud-skills-team(@sdk-team)开发并维护,当前版本 v0.0.2。

💬 留言讨论