Agent Skillsopskat/opskat › database

database

GitHub

提供数据库资产配置与SQL执行能力,支持MySQL、PostgreSQL等主流数据库。允许直接运行查询语句并返回结果,自动处理凭证解析与安全策略检查,适用于数据读写及数据库管理场景。

internal/ai/skills/database/SKILL.md opskat/opskat

触发场景

需要执行SQL查询或修改数据 配置或连接数据库实例

安装

npx skills add opskat/opskat --skill database -g -y
更多选项

非标准路径

npx skills add https://github.com/opskat/opskat/tree/main/internal/ai/skills/database -g -y

不安装直接使用

npx skills use opskat/opskat@database

指定 Agent (Claude Code)

npx skills add opskat/opskat --skill database -a claude-code -g -y

安装 repo 全部 skill

npx skills add opskat/opskat --all -g -y

预览 repo 内 skill

npx skills add opskat/opskat --list

SKILL.md

Frontmatter
{
    "name": "database",
    "description": "Run SQL against a database asset (MySQL, PostgreSQL, SQL Server, SQLite) via exec. Covers SQL syntax and the database scope parameter."
}

Database assets

Command syntax

Pass the SQL verbatim as command:

  • SELECT id, name FROM users LIMIT 10
  • SHOW TABLES
  • DESCRIBE orders
  • UPDATE users SET active = 0 WHERE id = 3

Scope

Use scope to override the default database for this call, e.g. scope: "analytics".

Notes

  • Reads (SELECT / SHOW / DESCRIBE / EXPLAIN) return rows as JSON; writes return an affected-row count.
  • Multi-statement input is split and each statement is policy-checked separately, so a read cannot smuggle a write past approval.
  • Credentials are resolved automatically; never ask the user for a password.

Asset config (for put_asset)

field type required notes
driver string yes "mysql", "postgresql", "mssql", or "sqlite"
host string non-SQLite Hostname or IP
port number no Defaults by driver: 3306 / 5432 / 1433
username string non-SQLite Database account name
password string no Write-only. For non-SQLite, encrypted in the asset; does not create a credential
credential_id number no Existing managed password credential ID; rejected for SQLite
database string no Default database
read_only boolean no Connection-level read-only mode
query_timeout_seconds number no Per-query timeout override, seconds
ssh_asset_id number no SSH asset for remote connections; required by remote SQLite VFS
sqlite_source string SQLite only "local" (default) or "remote_ssh_vfs"
path string SQLite only Absolute database-file path

For non-SQLite drivers, password and credential_id are mutually exclusive. Plaintext is write-only, encrypted in the asset, and never creates a managed credential. SQLite accepts neither password source: local SQLite must not have an SSH asset; remote_ssh_vfs requires one and uses a POSIX absolute remote path.

Examples:

put_asset(name="prod-db", type="database", config={"driver":"postgresql","host":"db.internal","username":"app","password":"..."})
put_asset(name="local-db", type="database", config={"driver":"sqlite","path":"/var/lib/app/data.db"})
put_asset(name="remote-db", type="database", config={"driver":"sqlite","sqlite_source":"remote_ssh_vfs","path":"/srv/data.db","ssh_asset_id":12})

版本历史

  • b159e91 当前 2026-08-19 20:20

    新增对 SQLite 的支持,完善资产配置字段(如 driver、ssh_asset_id),增强托管凭据自动化与安全脱敏机制。

  • d6c7a6e 2026-08-16 07:28

    修正文档遗漏了database技能的query_timeout_seconds配置项说明。

  • aeb4bc3 2026-07-24 16:28

同 Skill 集合

internal/ai/skills/etcd/SKILL.md
internal/ai/skills/k8s/SKILL.md
internal/ai/skills/kafka/SKILL.md
internal/ai/skills/local/SKILL.md
internal/ai/skills/mongodb/SKILL.md
internal/ai/skills/oss/SKILL.md
internal/ai/skills/rdp/SKILL.md
internal/ai/skills/redis/SKILL.md
internal/ai/skills/serial/SKILL.md
internal/ai/skills/ssh/SKILL.md
internal/ai/skills/vnc/SKILL.md
plugin/opsctl/skills/opsctl/SKILL.md

元信息

文件数
0
版本
d919872
Hash
04700b88
收录时间
2026-07-24 16:28

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-28 05:25
浙ICP备14020137号-1 $访客地图$