Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/allenmuu/mysql-cli/agents-mdgit clone --depth 1 https://github.com/AllenMuu/mysql-cliWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02728 | $0.02728 |
| Opus 5 | $0.01364 | $0.01364 |
| Sonnet 5 | $0.00546 | $0.00546 |
| Haiku 4.5 | $0.00273 | $0.00273 |
Grade A, and why
mysql-cli AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.
This file provides guidance to AI agents when working with code in this repository.
项目定位
Go 实现的 MySQL CLI,目标是替代 designcomputer/mysql_mcp_server:把原 MCP 的全部只读/写能力下沉为命令行子命令,让任何能跑 shell 的 AI agent(Claude Code / Cursor / Codex / Aider)无需 MCP runtime 即可查询 MySQL。设计前提是 agent 是首要调用方(默认 JSON 输出、稳定退出码),REPL 仅供人类调试,不是主路径。
常用命令
go build ./... # 编译
go vet ./... # 静态检查
go test ./... # 单元测试(默认,136 用例,全部用 sqlmock,无需 DB)
go test ./internal/query/ -run TestApplyLimit -v # 跑单个测试
go test -cover ./... # 覆盖率(项目目标 ≥80%,历史区间 81%~92%)
go test -coverprofile=cover.out ./... && go tool cover -func=cover.out # 覆盖率明细
./scripts/skill-format-check.sh skills/ # 校验 SKILL.md frontmatter
./scripts/skill-format-check/test.sh # skill-format-check 自测(good/bad 用例)
集成测试需要真实 MySQL,用 testcontainers-go 起 mysql:8 容器,默认跳过:
RUN_INTEGRATION=1 go test -tags=integration ./internal/integration/ -v
internal/integration/integration_test.go 带 //go:build integration 构建标签,且 TestMain 在 RUN_INTEGRATION 未设置时直接 os.Exit(m.Run()) 跳过容器初始化。Docker 未运行时不要开此变量。
架构(分层与依赖方向)
包严格单向依赖,result 是无依赖底层,避免循环引用:
cmd/mysql-cli/main -> cli(cobra 装配 + 退出码映射 + config 子命令)
↓
config ─-> conn ─-> query ─-> result
│ │ └─-> safety(无依赖,纯逻辑)
│ └─-> schema ─-> result/safety
└─ env/file 解析 repl(聚合 query+schema+format)
format ← result
result- 共享Result{Columns, Rows, RowsAffected, LastInsertID},是 query/schema(生产者)与 format/cli(消费者)之间的中立契约。safety- 纯逻辑、零依赖、完全可单测。SQL 分类(read/dml/ddl/unknown)、只读闸门、标识符校验、多语句检测、破坏性操作识别。改动安全模型时只动这里。config- TOML 命名数据源 +MYSQL_*环境变量兼容(零配置迁移自原 MCP)。解析优先级:CLI flag > env > file > default(见Resolve)。密码支持${ENV}占位符展开。conn- 由config.Datasource渲染 go-sql-driver DSN 并开连接池;SSH 隧道在Open前建立,DSN 指向本地转发端口。Pool.Close先关隧道再关*sql.DB(生命周期绑定,见下)。query-Execute(读,走QueryContext)、ExecuteWrite(单条 DML/DDL,包在事务里提交)、ExecuteTxn(多条原子事务)。每条语句都过 safety 闸门 + 多语句检测。schema- 只读探索命令(schema/sample/tables/databases/read/explore/analyze),对应原 MCP 的get_schema_info/get_table_sample/list_resources/read_resource。所有标识符在拼接 SQL 前经safety.Validate*校验。format-result.Result-> json/table/csv/tsv;JSON 严格信封{success,data,error:{code,message}}。cli- cobra 子命令 + 全局 flag +mapError把核心 error 翻译成退出码;含config子命令(init/list/global/project)。repl- readline 交互壳,仅人类调试用,复用 query/schema/format。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 92 lines · 2,728 tokens per session scan A acec484d6253
mysql-cli AGENTS.md is an instructions file published in the GitHub repository AllenMuu/mysql-cli (2 stars, last pushed 20d ago), licensed MIT. It adds 2,728 tokens to every session, about $0.0136 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
Instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.