mysql
Installation
SKILL.md
MySQL / MariaDB Skill
Query Standards
- Use ANSI SQL join syntax (
JOIN ... ON ...) — never comma-separated joins inFROM. - Always alias tables:
SELECT u.name FROM users AS u. - Use UPPER_CASE for SQL keywords; snake_case for identifiers.
- Use prepared statements / parameterized queries for all user-supplied values — never concatenate strings into SQL.
- Format complex queries with consistent indentation; each clause on its own line.
Schema Design
- Use
INT UNSIGNEDfor auto-increment primary keys; preferBIGINT UNSIGNEDfor large tables. - Use
AUTO_INCREMENTfor surrogate primary keys. - Always define
NOT NULLwith aDEFAULTfor mandatory columns. - Use soft delete: add a
deleted_at DATETIME NULL DEFAULT NULLcolumn — neverDELETEuser-facing records. - Use
DATETIMEfor timestamps (timezone-aware at the application layer); useTIMESTAMPonly for auto-managedcreated_at/updated_at. - Use
utf8mb4charset andutf8mb4_unicode_cicollation for full Unicode support (including emoji). - Schema changes require team lead approval.