[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79HC8QBB9P125XZ2K973JTJ":3,"skill-same:01M79HC8QBB9P125XZ2K973JTJ":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":39,"install":40,"resources":53},"01M79HC8QBB9P125XZ2K973JTJ","mysql-shared",null,"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\u002Fpermission errors, exit code meanings, or output formats.","AllenMuu\u002Fmysql-cli","AllenMuu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F40875971?v=4","01M79HBJSC5AA5PSKXX1336TSQ","AllenJoe","01M79HBJT68P2K9FQ1980DV33V",4,"MIT","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fskills\u002Fmysql-shared\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: mysql-shared\nversion: 2.0.0\ndescription: >\n  mysql-cli shared rules: config and datasources, global flags, safety model,\n  stable exit codes, error self-repair, and output formats. MUST be loaded with\n  Read before using the mysql-query or mysql-schema skill. Also used directly when\n  the user asks about mysql-cli config, connection failures, read-only\u002Fpermission\n  errors, exit code meanings, or output formats.\nmetadata:\n  binary: mysql-cli\n  config_file: ~\u002F.config\u002Fmysql-cli\u002Fconfig.toml\n  default_output: json\n  output_formats: json | table | csv | tsv | jsonl\n  safety_model: read-only by default; --write (DML), --write --ddl (DDL), --yes (destructive); every write flag triggers a human confirmation prompt (PreToolUse hook) -- --yes requests execution, it does not self-confirm; SELECT default cap 1000 (--no-limit to disable)\n  license: MIT\n  replaces: designcomputer\u002Fmysql_mcp_server\n---\n\n# mysql-cli Shared Rules\n\n> **CRITICAL**: This skill is referenced by `mysql-query` and `mysql-schema`.\n> Read this file with the Read tool before using either.\n\n`mysql-cli` is a Go CLI that lets any shell-capable AI agent query MySQL without\nan MCP runtime. It is a drop-in replacement for `designcomputer\u002Fmysql_mcp_server`,\nre-exposing all read\u002Fwrite capabilities as plain subcommands with **JSON by\ndefault** and **stable exit codes**. Agents are the primary caller; the REPL is\nonly for human debugging.\n\n> Convention: assume the `mysql-cli` binary is on `PATH`. If not, install with\n> `go install github.com\u002FAllenMuu\u002Fmysql-cli\u002Fcmd\u002Fmysql-cli@latest` or point\n> commands at the built binary.\n\n---\n\n## Before Running\n\nRun these checks before the first command in a session. They are cheap and\nprevent the most common failures (missing config, unreachable datasource).\n\n### 1. Config file exists\n\n```bash\nls ~\u002F.config\u002Fmysql-cli\u002Fconfig.toml\n```\n\nIf missing, `mysql-cli` still works via `MYSQL_*` env vars or `--host\u002F--port\u002F...`\noverrides, but a config file is the normal path. Resolution priority is\n**CLI flag > env > project-level (trusted) > global > default** (see Project-level Config below). Passwords support `${ENV}` placeholders (expanded only in trusted configs).\n\n### 2. Datasource reachable\n\nA lightweight probe via the read-only `databases` command (no table scan):\n\n```bash\nmysql-cli databases -f json\n```\n\n- Exit `0` + `{\"success\":true,...}` -> reachable, proceed.\n- Exit `2` (CONN_FAILED) -> check host\u002Fport\u002Fcredentials\u002FSSH tunnel.\n- Exit `10` (CONFIG_ERROR) -> check `config.toml` syntax or datasource name.\n\n### 3. (Optional) Pick a datasource\n\nIf the config defines multiple `[datasource.\u003Cname>]` profiles, select one with\n`-d \u003Cname>`. Otherwise the `default` entry is used.\n\n---\n\n## Project-level Config\n\nmysql-cli supports project-level config, structurally identical to the global\nconfig and merged override-style (similar to MCP's `.mcp.json`).\n\n- **Project-level config location**: `\u003Cproject-root>\u002F.config\u002Fmysql-cli\u002Fconfig.toml`.\n  Discovered by walking up from cwd; the first match wins (stops at home\u002Ffs\n  root). Shares the relative path `.config\u002Fmysql-cli\u002Fconfig.toml` with the global\n  `~\u002F.config\u002Fmysql-cli\u002Fconfig.toml`; only the root differs.\n- **Trust mechanism (security)**: project-level config is **not loaded** by\n  default. First run `mysql-cli config trust --yes` inside the project directory\n  to write the project root into the trust list at `~\u002F.config\u002Fmysql-cli\u002Ftrusted`.\n  `config trust` requires `--yes` in non-interactive mode (or an interactive\n  `y\u002FN` prompt on a TTY) -- **AI agents must NOT auto-trust**; a human decides.\n  When untrusted, it **falls back to global** (exit 0) and prints a **stderr\n  WARN** naming the skipped project config (the warning deliberately omits the\n  trust command, to avoid AI auto-trusting). Suppress with `--no-trust-warn` or\n  `MYSQL_CLI_NO_TRUST_WARN=1`; escalate to a hard error with `--strict-trust`.\n  `${ENV}` password placeholders expand only in trusted project-level configs -\n  preventing malicious repos from harvesting local env vars or hijacking\n  connections.\n- **Priority chain**: `--config` flag > `MYSQL_CLI_CONFIG` env > project-level\n  (trusted) > global > `MYSQL_*` field-level overrides > default. When `--config`\n  or `MYSQL_CLI_CONFIG` is set, only that file is read and auto-discovery is\n  skipped.\n- **Override-style merge**: same-named datasources replace wholesale (project\n  wins, including SSH subtables); different names form a union; `default` and\n  `default_limit` from project override global.\n\n### config subcommands\n\n| Command | Purpose |\n|---|---|\n| `mysql-cli config path` `[-j]` | Show effective file chain + trust status (project marked `trusted` \u002F `untrusted, skipped` + global) |\n| `mysql-cli config show` `[name]` `[-j]` | Show final merged config (passwords redacted: literal -> `***`, `${ENV}` shown as-is) |\n| `mysql-cli config trust [dir]` | Trust the project root (defaults to detected root), writing it to the trust list |\n| `mysql-cli config init [--project\\|--global] [--force]` | Generate a template config.toml |\n\n> **Self-check tip**: when query results or connections don't match expectations,\n> first run `mysql-cli config path` to inspect trust status, then\n> `mysql-cli config show` to inspect the merged config (passwords redacted).\n\n## Global Flags\n\nAll commands share global flags: `-d\u002F--datasource`, `-f\u002F--format` (default\n`json`), `--write`, `--ddl`, `--yes`, `--limit`, `--timeout` (default `30s`),\n`--config`, and connection overrides `--host\u002F--port\u002F--user\u002F--password\u002F--db`.\n\n---\n\n## Output Formats\n\nDefault is JSON (agent-friendly, parse with `jq`). Success and failure share one\nstrict envelope.\n\n**Success:**\n\n```json\n{\"success\":true,\"data\":{\"columns\":[\"id\",\"email\"],\"rows\":[[1,\"a@x.com\"]]},\"rows_affected\":0,\"meta\":{}}\n```\n\n| Field | Meaning |\n| --- | --- |\n| `success` | `true` on success. |\n| `data.columns` | Column names. |\n| `data.rows` | Row values (text columns come back as strings, not base64). |\n| `rows_affected` | For DML\u002FDDL writes. |\n| `meta` | Reserved metadata. |\n\n**Failure:**\n\n```json\n{\"success\":false,\"error\":{\"code\":\"READONLY_VIOLATION\",\"message\":\"UPDATE requires --write\"}}\n```\n\n| Field | Meaning |\n| --- | --- |\n| `success` | `false` on error. |\n| `error.code` | Stable machine-readable code (see Error Handling). |\n| `error.message` | Human-readable detail. |\n\nSwitch human-readable rendering with `-f table`, `-f csv`, or `-f tsv`. In\nnon-JSON formats, errors render as `Error [\u003CCODE>]: \u003Cmessage>`.\n\n### Default row cap\n\nWhen a SELECT has no LIMIT, mysql-cli returns only the first 1000 rows by default\nand sets `meta.truncated=true` (detected via a cap+1 probe, with no extra\nquery).\n\n- `--limit N`: explicitly request N rows; returned exactly, no truncation probe.\n- `--no-limit`: disable the default cap and return the full table (dangerous -\n  may blow up context).\n- `default_limit` (top-level config.toml) \u002F `MYSQL_CLI_DEFAULT_LIMIT` (env):\n  tune the default cap value.\n- Priority: `--limit` > `--no-limit` > config > env > 1000.\n- When you see `truncated:true` and need the full set, use `--no-limit` or first\n  run `SELECT COUNT(*)` to assess the size.\n\n`--format jsonl`: one JSON object per line (`{\"col\":val,...}`), NULL as `null`;\n  more token-efficient than json. Truncation info goes to stderr.\n\n---\n\n## Error Handling\n\n`mysql-cli` maps every error to a stable exit code. Parse the exit code (or\n`error.code` in JSON) and apply the fix below, then retry. The read-only and\nmulti-statement checks run **before** a connection is opened, so you get the\ncorrect code without touching the database.\n\n| Exit | Code | Meaning | Fix |\n| ---: | --- | --- | --- |\n| `2` | `CONN_FAILED` | Cannot reach MySQL | Check host\u002Fport\u002Fcredentials\u002FSSH tunnel in `config.toml`; verify with `mysql-cli databases`. Use `-d \u003Cname>` for the right datasource. |\n| `3` | `READONLY_VIOLATION` | DML without `--write` | Re-run with `--write`. |\n| `4` | `DDL_REQUIRES_WRITE` | DDL missing flags | Re-run with `--write --ddl`. |\n| `5` | `DESTRUCTIVE_REQUIRES_YES` | Destructive op needs confirmation | Re-run with `--yes` (and `--write`, plus `--ddl` for DDL-class drops). |\n| `6` | `IDENTIFIER_INVALID` | Table\u002Fdb name not in `^[a-zA-Z0-9_$]+$` | Use a valid identifier; avoid quotes\u002Fspaces. For `db.table` use the qualified form. |\n| `7` | `MULTI_STATEMENT` | More than one statement passed to `query` | Use `mysql-cli txn \"\u003Cs1>\" \"\u003Cs2>\"` instead. |\n| `8` | `SQL_ERROR` | SQL syntax\u002Fsemantic error | Run `mysql-cli schema \u003Ctable>` to confirm columns\u002Ftypes, then fix the SQL. |\n| `9` | `QUERY_TIMEOUT` | Exceeded `--timeout` | Raise `--timeout 60s`, add `--limit`, or narrow the `WHERE`. |\n| `10` | `CONFIG_ERROR` | Config parse error or unknown datasource | Check `config.toml` TOML syntax, the `default` value, and datasource name spelling; point `--config` at the right file. |\n| `11` | `INTERNAL_ERROR` | Internal panic \u002F unexpected error | Retry once; if it persists, file a bug with the command, `config.toml` (passwords redacted), and stderr. Not recoverable via flag changes. |\n\nCobra flag\u002Fusage errors (e.g. `--bogus`) have no sentinel match in `mapError` and fall through to `CONFIG_ERROR` (exit `10`); exit `1` is no longer separately reserved.\n\n---\n\n## Security Model\n\n`mysql-cli` is **read-only by default**. Writes are gated in tiers so a missing\nflag never silently mutates data.\n\n| Operation class | Required flags |\n| --- | --- |\n| `SELECT` \u002F read exploration | none (default read-only) |\n| DML (`INSERT`\u002F`UPDATE`\u002F`DELETE`) | `--write` |\n| DDL (`CREATE`\u002F`ALTER`\u002F`DROP`\u002F...) | `--write --ddl` |\n| Destructive (`DROP`\u002F`TRUNCATE`, `UPDATE`\u002F`DELETE` without `WHERE`) | `--yes` (+ `--write`, + `--ddl` for DDL-class) |\n\n> Safety flags at a glance:\n> `--write` unlocks DML · `--ddl` unlocks DDL (**requires** `--write`) ·\n> `--yes` marks a destructive op. **Every write flag triggers a human\n> confirmation prompt** -- `--yes` requests execution, it does not self-confirm.\n\nAdditional guarantees:\n\n- **Human-in-the-loop on writes**: a `PreToolUse` hook (global\n  `~\u002F.claude\u002Fsettings.json`) intercepts any `mysql-cli` call carrying\n  `--write`\u002F`--ddl`\u002F`--yes` and turns it into a Claude Code permission prompt.\n  The AI cannot self-confirm destructive work -- approval is the human's call.\n- **Identifier allowlist**: table\u002Fdb names must match `^[a-zA-Z0-9_$]+$`;\n  qualified `db.table` is allowed. Prevents injection in schema-exploration SQL.\n- **Multi-statement rejection**: `query` accepts a single statement (one\n  trailing `;` tolerated); multiple statements must use `txn`.\n- **Pre-connection gating**: read-only and multi-statement checks run before any\n  DB connection, so the right exit code is returned without touching the\n  database.\n- **Config safety**: prefer a read-only DB user (`ro_user`) for the default\n  datasource; reserve write-capable users for explicit `-d` profiles.\n\n---\n\n## Best Practices\n\n- **Explore before you query**: run `explore`\u002F`analyze`\u002F`schema` first to\n  confirm column names and types; this prevents `SQL_ERROR` (exit `8`).\n- **Bound large results**: always add `--limit N` to `SELECT`, or use\n  `sample`\u002F`read` which are already capped.\n- **Default to JSON**: keep `-f json` (the default) so you can parse with `jq`;\n  switch to `table` only when showing data to the user.\n- **Validate WHERE on reads first**: before an `UPDATE`\u002F`DELETE`, run the same\n  `WHERE` as a `SELECT COUNT(*)` to confirm scope.\n- **Match flags to intent**: DML -> `--write`; DDL -> `--write --ddl`;\n  destructive -> add `--yes`. Don't add `--yes` speculatively. Any write flag\n  triggers a human confirmation prompt; `--yes` is a request, not a waiver.\n- **Reuse the connection model**: each invocation opens and closes its own pool\n  (and SSH tunnel). Don't try to hold connections across calls; just issue\n  separate commands.\n- **Prefer read-only DB users**: configure the default datasource with a\n  read-only user; force writes to go through an explicit `-d` profile.\n","# mysql-cli Shared Rules\n\n> **CRITICAL**: This skill is referenced by `mysql-query` and `mysql-schema`.\n> Read this file with the Read tool before using either.\n\n`mysql-cli` is a Go CLI that lets any shell-capable AI agent query MySQL without\nan MCP runtime. It is a drop-in replacement for `designcomputer\u002Fmysql_mcp_server`,\nre-exposing all read\u002Fwrite capabilities as plain subcommands with **JSON by\ndefault** and **stable exit codes**. Agents are the primary caller; the REPL is\nonly for human debugging.\n\n> Convention: assume the `mysql-cli` binary is on `PATH`. If not, install with\n> `go install github.com\u002FAllenMuu\u002Fmysql-cli\u002Fcmd\u002Fmysql-cli@latest` or point\n> commands at the built binary.\n\n---\n\n## Before Running\n\nRun these checks before the first command in a session. They are cheap and\nprevent the most common failures (missing config, unreachable datasource).\n\n### 1. Config file exists\n\n```bash\nls ~\u002F.config\u002Fmysql-cli\u002Fconfig.toml\n```\n\nIf missing, `mysql-cli` still works via `MYSQL_*` env vars or `--host\u002F--port\u002F...`\noverrides, but a config file is the normal path. Resolution priority is\n**CLI flag > env > project-level (trusted) > global > default** (see Project-level Config below). Passwords support `${ENV}` placeholders (expanded only in trusted configs).\n\n### 2. Datasource reachable\n\nA lightweight probe via the read-only `databases` command (no table scan):\n\n```bash\nmysql-cli databases -f json\n```\n\n- Exit `0` + `{\"success\":true,...}` -> reachable, proceed.\n- Exit `2` (CONN_FAILED) -> check host\u002Fport\u002Fcredentials\u002FSSH tunnel.\n- Exit `10` (CONFIG_ERROR) -> check `config.toml` syntax or datasource name.\n\n### 3. (Optional) Pick a datasource\n\nIf the config defines multiple `[datasource.\u003Cname>]` profiles, select one with\n`-d \u003Cname>`. Otherwise the `default` entry is used.\n\n---\n\n## Project-level Config\n\nmysql-cli supports project-level config, structurally identical to the global\nconfig and merged override-style (similar to MCP's `.mcp.json`).\n\n- **Project-level config location**: `\u003Cproject-root>\u002F.config\u002Fmysql-cli\u002Fconfig.toml`.\n  Discovered by walking up from cwd; the first match wins (stops at home\u002Ffs\n  root). Shares the relative path `.config\u002Fmysql-cli\u002Fconfig.toml` with the global\n  `~\u002F.config\u002Fmysql-cli\u002Fconfig.toml`; only the root differs.\n- **Trust mechanism (security)**: project-level config is **not loaded** by\n  default. First run `mysql-cli config trust --yes` inside the project directory\n  to write the project root into the trust list at `~\u002F.config\u002Fmysql-cli\u002Ftrusted`.\n  `config trust` requires `--yes` in non-interactive mode (or an interactive\n  `y\u002FN` prompt on a TTY) -- **AI agents must NOT auto-trust**; a human decides.\n  When untrusted, it **falls back to global** (exit 0) and prints a **stderr\n  WARN** naming the skipped project config (the warning deliberately omits the\n  trust command, to avoid AI auto-trusting). Suppress with `--no-trust-warn` or\n  `MYSQL_CLI_NO_TRUST_WARN=1`; escalate to a hard error with `--strict-trust`.\n  `${ENV}` password placeholders expand only in trusted project-level configs -\n  preventing malicious repos from harvesting local env vars or hijacking\n  connections.\n- **Priority chain**: `--config` flag > `MYSQL_CLI_CONFIG` env > project-level\n  (trusted) > global > `MYSQL_*` field-level overrides > default. When `--config`\n  or `MYSQL_CLI_CONFIG` is set, only that file is read and auto-discovery is\n  skipped.\n- **Override-style merge**: same-named datasources replace wholesale (project\n  wins, including SSH subtables); different names form a union; `default` and\n  `default_limit` from project override global.\n\n### config subcommands\n\n| Command | Purpose |\n|---|---|\n| `mysql-cli config path` `[-j]` | Show effective file chain + trust status (project marked `trusted` \u002F `untrusted, skipped` + global) |\n| `mysql-cli config show` `[name]` `[-j]` | Show final merged config (passwords redacted: literal -> `***`, `${ENV}` shown as-is) |\n| `mysql-cli config trust [dir]` | Trust the project root (defaults to detected root), writing it to the trust list |\n| `mysql-cli config init [--project\\|--global] [--force]` | Generate a template config.toml |\n\n> **Self-check tip**: when query results or connections don't match expectations,\n> first run `mysql-cli config path` to inspect trust status, then\n> `mysql-cli config show` to inspect the merged config (passwords redacted).\n\n## Global Flags\n\nAll commands share global flags: `-d\u002F--datasource`, `-f\u002F--format` (default\n`json`), `--write`, `--ddl`, `--yes`, `--limit`, `--timeout` (default `30s`),\n`--config`, and connection overrides `--host\u002F--port\u002F--user\u002F--password\u002F--db`.\n\n---\n\n## Output Formats\n\nDefault is JSON (agent-friendly, parse with `jq`). Success and failure share one\nstrict envelope.\n\n**Success:**\n\n```json\n{\"success\":true,\"data\":{\"columns\":[\"id\",\"email\"],\"rows\":[[1,\"a@x.com\"]]},\"rows_affected\":0,\"meta\":{}}\n```\n\n| Field | Meaning |\n| --- | --- |\n| `success` | `true` on success. |\n| `data.columns` | Column names. |\n| `data.rows` | Row values (text columns come back as strings, not base64). |\n| `rows_affected` | For DML\u002FDDL writes. |\n| `meta` | Reserved metadata. |\n\n**Failure:**\n\n```json\n{\"success\":false,\"error\":{\"code\":\"READONLY_VIOLATION\",\"message\":\"UPDATE requires --write\"}}\n```\n\n| Field | Meaning |\n| --- | --- |\n| `success` | `false` on error. |\n| `error.code` | Stable machine-readable code (see Error Handling). |\n| `error.message` | Human-readable detail. |\n\nSwitch human-readable rendering with `-f table`, `-f csv`, or `-f tsv`. In\nnon-JSON formats, errors render as `Error [\u003CCODE>]: \u003Cmessage>`.\n\n### Default row cap\n\nWhen a SELECT has no LIMIT, mysql-cli returns only the first 1000 rows by default\nand sets `meta.truncated=true` (detected via a cap+1 probe, with no extra\nquery).\n\n- `--limit N`: explicitly request N rows; returned exactly, no truncation probe.\n- `--no-limit`: disable the default cap and return the full table (dangerous -\n  may blow up context).\n- `default_limit` (top-level config.toml) \u002F `MYSQL_CLI_DEFAULT_LIMIT` (env):\n  tune the default cap value.\n- Priority: `--limit` > `--no-limit` > config > env > 1000.\n- When you see `truncated:true` and need the full set, use `--no-limit` or first\n  run `SELECT COUNT(*)` to assess the size.\n\n`--format jsonl`: one JSON object per line (`{\"col\":val,...}`), NULL as `null`;\n  more token-efficient than json. Truncation info goes to stderr.\n\n---\n\n## Error Handling\n\n`mysql-cli` maps every error to a stable exit code. Parse the exit code (or\n`error.code` in JSON) and apply the fix below, then retry. The read-only and\nmulti-statement checks run **before** a connection is opened, so you get the\ncorrect code without touching the database.\n\n| Exit | Code | Meaning | Fix |\n| ---: | --- | --- | --- |\n| `2` | `CONN_FAILED` | Cannot reach MySQL | Check host\u002Fport\u002Fcredentials\u002FSSH tunnel in `config.toml`; verify with `mysql-cli databases`. Use `-d \u003Cname>` for the right datasource. |\n| `3` | `READONLY_VIOLATION` | DML without `--write` | Re-run with `--write`. |\n| `4` | `DDL_REQUIRES_WRITE` | DDL missing flags | Re-run with `--write --ddl`. |\n| `5` | `DESTRUCTIVE_REQUIRES_YES` | Destructive op needs confirmation | Re-run with `--yes` (and `--write`, plus `--ddl` for DDL-class drops). |\n| `6` | `IDENTIFIER_INVALID` | Table\u002Fdb name not in `^[a-zA-Z0-9_$]+$` | Use a valid identifier; avoid quotes\u002Fspaces. For `db.table` use the qualified form. |\n| `7` | `MULTI_STATEMENT` | More than one statement passed to `query` | Use `mysql-cli txn \"\u003Cs1>\" \"\u003Cs2>\"` instead. |\n| `8` | `SQL_ERROR` | SQL syntax\u002Fsemantic error | Run `mysql-cli schema \u003Ctable>` to confirm columns\u002Ftypes, then fix the SQL. |\n| `9` | `QUERY_TIMEOUT` | Exceeded `--timeout` | Raise `--timeout 60s`, add `--limit`, or narrow the `WHERE`. |\n| `10` | `CONFIG_ERROR` | Config parse error or unknown datasource | Check `config.toml` TOML syntax, the `default` value, and datasource name spelling; point `--config` at the right file. |\n| `11` | `INTERNAL_ERROR` | Internal panic \u002F unexpected error | Retry once; if it persists, file a bug with the command, `config.toml` (passwords redacted), and stderr. Not recoverable via flag changes. |\n\nCobra flag\u002Fusage errors (e.g. `--bogus`) have no sentinel match in `mapError` and fall through to `CONFIG_ERROR` (exit `10`); exit `1` is no longer separately reserved.\n\n---\n\n## Security Model\n\n`mysql-cli` is **read-only by default**. Writes are gated in tiers so a missing\nflag never silently mutates data.\n\n| Operation class | Required flags |\n| --- | --- |\n| `SELECT` \u002F read exploration | none (default read-only) |\n| DML (`INSERT`\u002F`UPDATE`\u002F`DELETE`) | `--write` |\n| DDL (`CREATE`\u002F`ALTER`\u002F`DROP`\u002F...) | `--write --ddl` |\n| Destructive (`DROP`\u002F`TRUNCATE`, `UPDATE`\u002F`DELETE` without `WHERE`) | `--yes` (+ `--write`, + `--ddl` for DDL-class) |\n\n> Safety flags at a glance:\n> `--write` unlocks DML · `--ddl` unlocks DDL (**requires** `--write`) ·\n> `--yes` marks a destructive op. **Every write flag triggers a human\n> confirmation prompt** -- `--yes` requests execution, it does not self-confirm.\n\nAdditional guarantees:\n\n- **Human-in-the-loop on writes**: a `PreToolUse` hook (global\n  `~\u002F.claude\u002Fsettings.json`) intercepts any `mysql-cli` call carrying\n  `--write`\u002F`--ddl`\u002F`--yes` and turns it into a Claude Code permission prompt.\n  The AI cannot self-confirm destructive work -- approval is the human's call.\n- **Identifier allowlist**: table\u002Fdb names must match `^[a-zA-Z0-9_$]+$`;\n  qualified `db.table` is allowed. Prevents injection in schema-exploration SQL.\n- **Multi-statement rejection**: `query` accepts a single statement (one\n  trailing `;` tolerated); multiple statements must use `txn`.\n- **Pre-connection gating**: read-only and multi-statement checks run before any\n  DB connection, so the right exit code is returned without touching the\n  database.\n- **Config safety**: prefer a read-only DB user (`ro_user`) for the default\n  datasource; reserve write-capable users for explicit `-d` profiles.\n\n---\n\n## Best Practices\n\n- **Explore before you query**: run `explore`\u002F`analyze`\u002F`schema` first to\n  confirm column names and types; this prevents `SQL_ERROR` (exit `8`).\n- **Bound large results**: always add `--limit N` to `SELECT`, or use\n  `sample`\u002F`read` which are already capped.\n- **Default to JSON**: keep `-f json` (the default) so you can parse with `jq`;\n  switch to `table` only when showing data to the user.\n- **Validate WHERE on reads first**: before an `UPDATE`\u002F`DELETE`, run the same\n  `WHERE` as a `SELECT COUNT(*)` to confirm scope.\n- **Match flags to intent**: DML -> `--write`; DDL -> `--write --ddl`;\n  destructive -> add `--yes`. Don't add `--yes` speculatively. Any write flag\n  triggers a human confirmation prompt; `--yes` is a request, not a waiver.\n- **Reuse the connection model**: each invocation opens and closes its own pool\n  (and SSH tunnel). Don't try to hold connections across calls; just issue\n  separate commands.\n- **Prefer read-only DB users**: configure the default datasource with a\n  read-only user; force writes to go through an explicit `-d` profile.\n",{"name":5,"version":24,"metadata":25,"description":32},"2.0.0",{"binary":26,"license":15,"replaces":27,"config_file":28,"safety_model":29,"default_output":30,"output_formats":31},"mysql-cli","designcomputer\u002Fmysql_mcp_server","~\u002F.config\u002Fmysql-cli\u002Fconfig.toml","read-only by default; --write (DML), --write --ddl (DDL), --yes (destructive); every write flag triggers a human confirmation prompt (PreToolUse hook) -- --yes requests execution, it does not self-confirm; SELECT default cap 1000 (--no-limit to disable)","json","json | table | csv | tsv | jsonl","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\u002Fpermission errors, exit code meanings, or output formats.\n","main","026589dd5841439e5c8220569da8a31300b5aa92","skills\u002Fmysql-shared",2,"https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli","https:\u002F\u002Fgithub.com\u002FAllenMuu","2026-09-04 19:06:02",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add AllenMuu\u002Fmysql-cli --skill mysql-shared",{"tool":46,"command":47},"bunx","bunx skills add AllenMuu\u002Fmysql-cli --skill mysql-shared",{"tool":49,"command":50},"pnpm","pnpm dlx skills add AllenMuu\u002Fmysql-cli --skill mysql-shared","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fskills\u002Fmysql-shared\u002FSKILL.md",true,[],[55,62,69,76,82,89],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M79HC264P05E90KNBHS1B1GR","mysql-schema","Explore MySQL schema with mysql-cli: list databases\u002Ftables, table structure, sample\u002Fread rows, database overview, one-shot analyze. Use when the user asks about table structures, columns, types, indexes, listing tables\u002Fdatabases, or sampling data. All read-only; no safety flags needed. For DML\u002FDDL\u002Ftransactions use the mysql-query skill.","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fskills\u002Fmysql-schema\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M79HBYMM18EZVVH8SVXGT0FV","mysql-query","Run SQL with mysql-cli: SELECT queries, DML (INSERT\u002FUPDATE\u002FDELETE), DDL (CREATE\u002FALTER\u002FDROP), and multi-statement atomic transactions. Use when the user asks to run SQL, query data, insert\u002Fupdate\u002Fdelete rows, execute transactions, or perform DDL. Read-only JSON output by default, stable exit codes, and tiered gating for write operations.","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fskills\u002Fmysql-query\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79HBVKBR4JZ24W90E3J4GFP","good","A valid skill used only by the skill-format-check self-test.","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-format-check\u002Ftestdata\u002Fgood\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79HBRWVR590DBP33N75717B","bad-no-frontmatter","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-format-check\u002Ftestdata\u002Fbad-no-frontmatter\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M79HBP3VRH9ZG80G5CS7B2E4","wrong-name","The name does not match the parent directory.","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-format-check\u002Ftestdata\u002Fbad-name-mismatch\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M79HBMPDNJPG3Y5V8R0JR8YD","bad-missing-version","Missing the required version field.","https:\u002F\u002Fgithub.com\u002FAllenMuu\u002Fmysql-cli\u002Fblob\u002Fmain\u002Fscripts\u002Fskill-format-check\u002Ftestdata\u002Fbad-missing-version\u002FSKILL.md",[],[]]