conventions-sql
[!NOTE] If you were invoked directly (e.g.
/conventions-sql) with no specific task, just read this skill so its conventions are loaded into context, then stop — there is nothing to do yet. They're now ready to apply when I ask you to design, write, or edit SQL.
SQL Conventions
Write migrations a DBA can read top to bottom and apply. Most of this skill covers migration files; Formatting applies to all SQL. Examples are MySQL 8.0: the principles hold on any engine, the syntax notes don't.
Simple DDL. Write each migration as a short sequence of literal statements, each exactly what the database will run. DBAs apply migrations by hand, feed them to online-schema-change tools, and diff them in review, and all three need the real statement written in the file. Everything below follows from this.