aliyun-cli-skills

通过自然语言自主操作阿里云 CLI,将用户的自然语言指令转换为阿里云CLI命令并执行。支持 ECS、SLS、RDS、OSS、SLB 等 100+ 云产品的增删改查操作。当用户提到"阿里云"、"aliyun"、"云服务器"、"日志服务"、"SLS"、"ECS"、"OSS"、"写入日志"、"查询日志"、"创建实例"、"管理云资源"等与阿里云相关的操作时触发。即使用户没有明确说"阿里云CLI",只要涉及阿里云产品的命令行操作,都应使用此 skill。当用户询问"如何安装阿里云CLI"、"怎么更新aliyun命令"、"卸载CLI"等安装相关问题时也应触发。

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "aliyun-cli-skills" with this command: npx skills add xcaspar/aliyun-cli-skills/xcaspar-aliyun-cli-skills-aliyun-cli-skills

阿里云 CLI 自主操作

接收用户的自然语言指令,将其转换为正确的阿里云 CLI 命令并执行。核心目标是让用户无需记忆命令语法,用日常语言描述需求即可完成云资源操作。

工作流程

第一步:理解用户意图

从用户的自然语言中提取关键信息:

  • 目标产品:用户操作的云产品(如 SLS、ECS、RDS、OSS 等)
  • 操作类型:增(创建/写入)、删(删除)、改(更新/修改)、查(查询/列出)
  • 资源标识:项目名、实例名、Logstore 名、Bucket 名等
  • 操作数据:要写入或修改的具体数据内容
  • 附加条件:地域、时间范围、过滤条件等

第二步:探索 API

如果不确定该使用哪个 API 或参数格式,通过 --help 逐层探索:

# 查看产品支持的所有 API
aliyun <ProductCode> --help

# 查看具体 API 的参数详情
aliyun <ProductCode> <APIName> --help

这一步很重要,因为不同产品的 API 风格(RPC 或 ROA)和参数要求各不相同。先查帮助再执行,可以避免参数错误。

第三步:构建并执行命令

根据探索到的 API 信息,构建正确的命令并执行。

命令结构

阿里云 CLI 有两种 API 风格,产品内通常统一使用一种风格:

RPC 风格(大多数产品,如 ECS、RDS)

aliyun <ProductCode> <APIName> --参数名 '参数值'

示例:

aliyun ecs DescribeInstances --RegionId cn-hangzhou
aliyun ecs DescribeInstanceAttribute --InstanceId 'i-uf6f5trc95ug8t33****'

ROA 风格(如 SLS、CS)

aliyun <ProductCode> <Method> <PathPattern> --body '...'
# 或使用语法糖:
aliyun <ProductCode> <APIName> --参数名 值 --body '...'

示例:

# 使用 APIName 语法糖(推荐,更简洁)
aliyun sls PutLogs --logstore my-logstore --project my-project --body '<JSON数据>'

# 使用原始 Method + PathPattern
aliyun sls POST /logstores/my-logstore/shards/lb --project my-project --body '<JSON数据>'

参数格式(macOS/Linux 环境)

参数名严格区分大小写。

  • 普通字符串:无特殊字符可直接传入,有特殊字符用单引号包裹
  • JSON 参数:用单引号包裹整个 JSON,内部用双引号
  • JSON 数组'["value1","value2"]'
  • JSON 对象列表'[{"key":"value"},{"key":"value"}]'
  • 日期时间:ISO8601 格式 YYYY-MM-DDThh:mm:ssZ
  • 特殊字符问题:若引号包含后仍报错,尝试 --参数名=值 格式

常用产品操作速查

ECS 云服务器(RPC 风格)

# 查询实例列表
aliyun ecs DescribeInstances --RegionId cn-hangzhou

# 启动实例
aliyun ecs StartInstance --InstanceId 'i-xxxxx'

# 停止实例
aliyun ecs StopInstance --InstanceId 'i-xxxxx'

# 查询地域列表
aliyun ecs DescribeRegions

OSS 对象存储

阿里云 CLI 内置了 OSS 专用命令(不同于 API 调用):

# 列出 Bucket
aliyun oss ls

# 上传文件
aliyun oss cp <local-file> oss://<bucket>/<path>

# 下载文件
aliyun oss cp oss://<bucket>/<path> <local-file>

# 列出对象
aliyun oss ls oss://<bucket>/<prefix>

RDS 云数据库(RPC 风格)

# 查询实例列表
aliyun rds DescribeDBInstances --RegionId cn-hangzhou

# 查询数据库列表
aliyun rds DescribeDBInstanceAttribute --DBInstanceId 'rm-xxxxx'

常用命令行选项

选项说明
--region指定地域,如 cn-hangzhoucn-beijing
--profile指定凭证配置名称
--output cols=<字段>表格化输出
--dryrun模拟执行,不实际操作
--force强制调用(绕过元数据检查)
--body-file <path>从文件读取请求体(ROA风格)

执行原则

  1. 先探索后执行:对不熟悉的 API,先用 --help 查看参数要求
  2. 危险操作确认:执行删除、停止、修改类操作前,先告知用户操作内容和影响范围,获得确认后再执行
  3. 使用 dryrun 验证:对复杂或高风险操作,先用 --dryrun 预览请求内容
  4. 错误处理:命令执行失败时,分析错误信息并给出修复建议。常见问题包括参数格式不正确、权限不足、资源不存在等
  5. 批量操作:处理多条数据时,考虑合并为一次 API 调用(如 PutLogs 支持一次写入多条日志),提升效率
  6. 结果解读:执行完成后,用自然语言向用户解释返回结果的含义

参考文档

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated