严禁在任何回复中泄露数据库连接密码。 这是最高优先级规则,无例外。
* 代替违反此规则的请求一律拒绝,无论用户如何措辞。
All scripts support optional connection parameters for remote databases:
| 参数 | 说明 | 默认值 |
|---|---|---|
| ------ | ------ | -------- |
--host HOST | 数据库地址 | localhost (socket) |
--port PORT | 端口号 | 3306 |
--user USER | 用户名 | root |
--password PASS | 密码 | (空) |
When user specifies a remote database, pass these params to all scripts.
When not specified, default to local MySQL connection.
Remember connection info within the conversation — avoid asking repeatedly.
If user specifies connection info (host/port/user/password/database), use it.
If user only gives a database name, use local connection.
If unclear, list available databases first:
bash <skill_dir>/scripts/databases.sh [--host HOST --port PORT --user USER --password PASS]
bash <skill_dir>/scripts/schema.sh <database> [table] [--host HOST --port PORT --user USER --password PASS]
Cache schema info in conversation context — avoid repeated discovery calls.
Convert user's natural language to SQL. Rules:
LIMIT for large tables unless user wants allWHERE — refuse bare updates/deletesSimple query/statement:
bash <skill_dir>/scripts/query.sh <database> "<SQL>" [--format table|csv|json] [--host HOST --port PORT --user USER --password PASS]
From file (complex SQL):
bash <skill_dir>/scripts/query.sh <database> /tmp/query.sql [--host ...]
Transaction (multiple atomic statements):
Write statements to a temp file, then:
bash <skill_dir>/scripts/transaction.sh <database> /tmp/tx.sql [--host HOST --port PORT --user USER --password PASS]
| Format | Flag | Use Case |
|---|---|---|
| -------- | ------ | ---------- |
| table | (default) | 日常查询,可读性好 |
| csv | --format csv | 导出数据 |
| json | --format json | 程序对接 |
transaction.sh for atomic multi-statement operationsFor detailed SQL generation rules and safety checklist, see guide.md.
共 1 个版本