Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Connect to MySQL and run read-only queries to inspect table data. Use when the user wants to query MySQL, show tables, view table contents, check schema, or run read-only SQL. Connection info must be provided by the user; do not read from environment or application config.
.claude/skills/hashgraph-online-mysql-query/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 155% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 97% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 48% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 225% | 0% |
application.yml、application-*.yml、环境变量、.env 等读取 MySQL 连接信息。host、port、user、password、database:全部必须来自用户当次提供。sql:本次准备执行的只读 SQL。<skill_dir>:当前安装环境中的 mysql-query 技能目录,用于定位脚本。/handoff 中明确给出的数据库连接信息。<skill_dir> 为当前 skill 安装目录,由运行环境解析,不需要用户提供。LIMIT。待确认项,不要私自补全。/team-execute、/team-review 或 /handoff 的证据区,而不是只停留在终端输出。/team-release 或 /team-review 中注明表、条件、时间点和结论。使用 python3,依赖:pip3 install pymysql。路径示例:<skill_dir>/scripts/query.py,其中 <skill_dir> 为当前安装环境里的 mysql-query 技能目录。
参数(均由用户提供):
--host:MySQL 主机(必填)--port:端口(可选,默认 3306)--user:用户名(必填)--password:密码(必填)--database:数据库名(必填)--sql:SELECT 语句(必填,或通过 stdin 传入)bash# 用户提供连接信息后,按下列方式调用 python3 <skill_dir>/scripts/query.py \ --host 127.0.0.1 \ --port 3306 \ --user myuser \ --password '用户提供的密码' \ --database mydb \ --sql "SELECT * FROM users LIMIT 10" # 从标准输入传 SQL echo "SELECT id, name FROM products LIMIT 5" | python3 <skill_dir>/scripts/query.py \ --host 127.0.0.1 --port 3306 --user myuser --password 'xxx' --database mydb
脚本会:
若在项目内写一次性脚本,连接参数也必须来自用户当次提供的变量或输入,不要从 application.yml 或 os.environ 读取。
pythonimport pymysql # 使用用户提供的变量(例如从 API 入参、用户输入传入) host = user_provided_host port = user_provided_port user = user_provided_user password = user_provided_password database = user_provided_database conn = pymysql.connect(host=host, port=port, user=user, password=password, database=database, charset="utf8mb4") # ...
LIMIT。| 用户需求 | 做法 | |--------------------|------| | 看某张表前 N 条 | SELECT * FROM table_name LIMIT 20 | | 查表结构 | DESCRIBE table_name 或 SHOW CREATE TABLE table_name | | 统计行数 | SELECT COUNT(*) FROM table_name | | 按条件查 | 用 WHERE,必要时加 LIMIT |
连接 MySQL 执行只读查询,支持查看表列表、表结构、表数据和聚合统计。连接信息(host/port/user/password/database)必须由用户在本次对话中提供,禁止从配置文件或环境变量读取。
本 skill 只执行只读 SQL,不执行 INSERT / UPDATE / DELETE 等写操作。
Other measured skills in the registry, with their headline benchmark lift.