mysql-schema
Explore MySQL schema with mysql-cli: list databases/tables, table structure, sample/read rows, database overview, one-shot analyze. Use when the user asks about table structures, columns, types, indexes, listing tables/databases, or sampling data. All read-only; no safety flags needed. For DML/DDL/transactions use the mysql-query skill.
- License 许可
- MIT
- 最近更新
- 2026-09-04
- Stars
- ★ 4
- Forks
- 2
01 前言 Front Matter
- name
- mysql-schema
- version
- 2.0.0
- metadata
- { "binary": "mysql-cli", "cliHelp": "mysql-cli schema --help", "license": "MIT", "requires": { "bins": [ "mysql-cli" ] }, "config_file": "~/.config/mysql-cli/config.toml", "default_output": "json" }
- description
- Explore MySQL schema with mysql-cli: list databases/tables, table structure, sample/read rows, database overview, one-shot analyze. Use when the user asks about table structures, columns, types, indexes, listing tables/databases, or sampling data. All read-only; no safety flags needed. For DML/DDL/transactions use the mysql-query skill.
03 SKILL.md 正文
mysql-schema Skill
CRITICAL - Before starting, you MUST Read ../mysql-shared/SKILL.md.
It contains config and datasource, global flags, identifier validation, exit
codes, error recovery, and output formats.
Convention: assume
mysql-cliis onPATH.
This skill covers schema exploration and data sampling - all read-only, no
safety flags needed. Identifiers are validated against ^[a-zA-Z0-9_$]+$ before
any SQL is built. For SQL writes/DML/DDL/transactions, use the mysql-query
skill.
Trigger Conditions
Use this skill when the user asks about any of the following:
- Table structure, columns, types, indexes (
schema,analyze) - Listing tables/databases (
tables,databases,explore) - Sampling or reading table data (
sample,read) - Database/table overview (
explore)
Commands
All commands share global flags (see mysql-shared): -d/--datasource,
-f/--format (default json), --limit, --timeout, --config, and
connection overrides. Schema commands are read-only - no --write/--ddl/--yes needed.
All read-only; no safety flags needed. Identifiers are validated against
^[a-zA-Z0-9_$]+$ before any SQL is built.
| Command | Args | Description |
|---|---|---|
mysql-cli databases |
(none) | List databases. |
mysql-cli tables [db] |
[db] |
List tables (current db, or given db). |
mysql-cli schema [table] |
[table] |
Table structure, or whole database when omitted. |
mysql-cli sample <table> |
<table> |
Sample rows. -n N (default 5, max 20). |
mysql-cli read <table> |
<table> |
First 100 rows. |
mysql-cli explore |
(none) | Database + table overview. |
mysql-cli analyze <table> |
<table> |
Schema + sample in one shot. |
Typical Workflow
The safe path is explore -> read -> (write via mysql-query). Always confirm schema and row shape before writing.
# 1. Orient: what databases/tables exist?
mysql-cli explore -f json
# 2. Inspect a table's structure + a data sample in one call.
mysql-cli analyze users -f json
# 3. Look at a specific table's columns/types/indexes.
mysql-cli schema users -f json
# 4. Sample a few rows to understand data shape.
mysql-cli sample users -n 5 -f json
Notes
analyzepreserves native cell types (NULL/number/string); values are rendered as-is, not stringified.- Invalid identifiers exit
6(IDENTIFIER_INVALID); use a valid name or thedb.tablequalified form. - For error recovery, exit codes, and output formats, see
mysql-shared. - Run
mysql-cli schema --helpfor the full set of flags.
04 同仓库更多 Skills
mysql-shared
mysql-cli shared rules: config and datasources, global flags, safety model, stable exit codes, error self-repair, and output formats. MUST be loaded with Read before using the mysql-query or mysql-schema skill. Also used directly when the user asks about mysql-cli config, connection failures, read-only/permission errors, exit code meanings, or output formats.
mysql-query
Run SQL with mysql-cli: SELECT queries, DML (INSERT/UPDATE/DELETE), DDL (CREATE/ALTER/DROP), and multi-statement atomic transactions. Use when the user asks to run SQL, query data, insert/update/delete rows, execute transactions, or perform DDL. Read-only JSON output by default, stable exit codes, and tiered gating for write operations.
good
A valid skill used only by the skill-format-check self-test.
bad-no-frontmatter
暂无简介
wrong-name
The name does not match the parent directory.
bad-missing-version
Missing the required version field.