一键导入
database-mysql
MySQL database patterns. Use when querying database schema, exploring data, understanding table relationships, or debugging data issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
MySQL database patterns. Use when querying database schema, exploring data, understanding table relationships, or debugging data issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Code review knowledge. Use when reviewing an implementation against requirements, validating code quality, checking edge cases and security, or before opening a PR.
Systematic debugging knowledge. Use when diagnosing errors, investigating unexpected behavior, doing root cause analysis, or troubleshooting production issues.
QA and testing knowledge. Use when testing an implementation end-to-end — building a test plan, validating APIs with curl, driving the UI with Playwright, comparing against Figma, and documenting pass/fail with evidence.
Requirements refinement knowledge. Use when turning a vague request into a clear spec, defining API contracts, identifying affected repositories, or capturing scope and edge cases before coding.
AWS infrastructure patterns. Use when working with AWS services, secrets, ECS/EKS, RDS, S3, CloudWatch, or debugging infrastructure issues.
NestJS backend development patterns. Use when developing backend APIs with NestJS, TypeORM/Prisma, and TypeScript.
| name | database-mysql |
| description | MySQL database patterns. Use when querying database schema, exploring data, understanding table relationships, or debugging data issues. |
| triggers | ["mysql","database","db","schema","query","sql","tables","migration"] |
Use when exploring database schema, understanding data relationships, debugging data issues, writing queries, or creating migrations.
Use the MySQL MCP for read-only access:
list_tables — List all tables in the database
read_query — Execute SELECT queries (read-only)
SHOW TABLES;
SHOW COLUMNS FROM <table>;
DESCRIBE <table>;
SHOW INDEX FROM <table>;
SELECT
TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME IS NOT NULL
AND TABLE_SCHEMA = DATABASE();
SELECT COUNT(*) FROM <table> WHERE <condition>;
SELECT * FROM <table> WHERE <condition> LIMIT 10;
Tables may use different soft delete approaches:
| Pattern | Meaning |
|---|---|
deleted column (0/1) | Record is soft-deleted |
deactivated column | Record is deactivated |
disabled column | Record is disabled |
active column | Record is active (inverse) |
deleted_at timestamp | Null = active, set = deleted |
Always check the appropriate status column when querying.
| Pattern | Type | Notes |
|---|---|---|
| Primary keys | int or bigint | Auto increment |
| Boolean flags | tinyint(1) | 0 = false, 1 = true |
| Percentages | decimal(5,3) | 0.000 to 100.000 |
| Timestamps | datetime | UTC |
| JSON data | json | MySQL 5.7+ native JSON |
SELECT t1.id, t1.name,
t2.id as related_id, t2.status
FROM main_table t1
LEFT JOIN related_table t2 ON t2.main_id = t1.id
WHERE t1.id = ?;
SELECT <column>, COUNT(*) as count
FROM <table>
GROUP BY <column>
HAVING count > 1;
SELECT * FROM <table>
WHERE updated_at >= NOW() - INTERVAL 1 HOUR
ORDER BY updated_at DESC
LIMIT 20;