Query project databases with automatic SSH tunnel management. Use when you need to execute SQL queries against configured databases, especially those accessi...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install db-query或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install db-query⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/db-query/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: db-query description: Query project databases with automatic SSH tunnel management. Use when you need to execute SQL queries against configured databases, especially those accessible only via SSH tunnels. Automatically manages SSH connection lifecycle (establishes tunnel before query, closes after). Supports multiple databases distinguished by description/name from config file. ---
Query databases through a centralized configuration file with automatic SSH tunnel management. Handles connection details, SSH tunnel setup/teardown, and query execution.
Passwords are never exposed in process lists. The skill uses environment variables for credentials:
MYSQL_PWD for database passwords (passed to mysql client)SSHPASS for SSH tunnel passwords (passed to sshpass)Recommended: Store credentials in environment variables instead of the config file for better security.
~/.config/clawdbot/db-config.json:```bash mkdir -p ~/.config/clawdbot # Copy example config and edit cp /usr/lib/node_modules/clawdbot/skills/db-query/scripts/config.example.json ~/.config/clawdbot/db-config.json ```
- name: Description used to find the database (required) - host: Database host (required) - port: Database port (default: 3306) - database: Database name (required) - user: Database user (required) - password: Database password (optional, can use env var) - ssh_tunnel: Optional SSH tunnel configuration
- enabled: true/false - ssh_host: Remote SSH host - ssh_user: SSH username - ssh_port: SSH port (default: 22) - local_port: Local port to forward (e.g., 3307) - remote_host: Remote database host behind SSH (default: localhost) - remote_port: Remote database port (default: 3306)
Instead of storing passwords in the config file, use environment variables:
# Format: DB_PASSWORD_<DATABASE_NAME> (spaces replaced with underscores, uppercase)
export DB_PASSWORD_PRODUCTION_USER_DB="your_db_password"
# Format: SSH_PASSWORD_<DATABASE_NAME> for SSH tunnel password
export SSH_PASSWORD_PRODUCTION_USER_DB="your_ssh_password"
{
"databases": [
{
"name": "Production User DB",
"host": "localhost",
"port": 3306,
"database": "user_db",
"user": "db_user",
"password": "",
"ssh_tunnel": {
"enabled": true,
"ssh_host": "prod.example.com",
"ssh_user": "deploy",
"local_port": 3307
}
}
]
}
Set environment variables (recommended):
export DB_PASSWORD_PRODUCTION_USER_DB="your_db_password"
export SSH_PASSWORD_PRODUCTION_USER_DB="your_ssh_password"
python3 /usr/lib/node_modules/clawdbot/skills/db-query/scripts/db_query.py --list
python3 /usr/lib/node_modules/clawdbot/skills/db-query/scripts/db_query.py \
--database "Production User DB" \
--query "SELECT * FROM users LIMIT 10"
The script will:
python3 /usr/lib/node_modules/clawdbot/skills/db-query/scripts/db_query.py \
--config /path/to/custom-config.json \
--database "test" \
--query "SHOW TABLES"
apt install mysql-client or equivalent--list to see all configured databases and their descriptionsname field安装 MYSQL QUERY 后,可以对 AI 说这些话来触发它
Help me get started with MYSQL QUERY
Explains what MYSQL QUERY does, walks through the setup, and runs a quick demo based on your current project
Use MYSQL QUERY to query project databases with automatic SSH tunnel management
Invokes MYSQL QUERY with the right parameters and returns the result directly in the conversation
What can I do with MYSQL QUERY in my data & analytics workflow?
Lists the top use cases for MYSQL QUERY, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/db-query/ 目录(个人级,所有项目可用),或 .claude/skills/db-query/(项目级)。重启 AI 客户端后,用 /db-query 主动调用,或让 AI 根据上下文自动发现并使用。
MYSQL QUERY 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
MYSQL QUERY 可免费安装使用。请查阅仓库了解许可证信息。
Query project databases with automatic SSH tunnel management. Use when you need to execute SQL queries against configured databases, especially those accessi...
MYSQL QUERY 属于「Data & Analytics」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my data & analytics tasks using MYSQL QUERY
Identifies repetitive steps in your workflow and sets up MYSQL QUERY to handle them automatically