From bitwarden-software-engineer
Bitwarden database architecture, migrations, and dual-ORM strategy. Use when working with .sql files, stored procedures, EF migrations, or database schema changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/bitwarden-software-engineer:writing-database-queriesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Bitwarden maintains two parallel data access implementations:
Bitwarden maintains two parallel data access implementations:
Every database change requires both implementations. Repository interfaces abstract both — when a stored procedure performs specific operations, the EF implementation must replicate identical behavior.
Bitwarden Cloud uses zero-downtime deployments with a multi-phase migration strategy:
util/Migrator/DbScripts): Runs before code deployment. Must be backwards-compatible.util/Migrator/DbScripts_transition): Runs after deployment. Handles batched data migrations only — no schema changes.util/Migrator/DbScripts_finalization): Runs at the next release. Removes backwards-compatibility scaffolding.Simple additive changes (new nullable column, new table, new stored procedure) only need Phase 1.
Always defer to the developer on migration phasing. The multi-phase approach is complex and context-dependent. When a database change is needed, write the migration script for Phase 1 and ask the developer whether additional phases are required.
src/Sql/dbo — Master schema source of truthsrc/Sql/dbo_finalization — Future schema stateutil/Migrator/DbScripts_manual — Exceptional cases (index rebuilds)When implementing Dapper repository methods, stored procedures, or MSSQL migration scripts, activate the implementing-dapper-queries skill.
When implementing EF Core repositories, generating EF migrations, or working with PostgreSQL/MySQL/SQLite, activate the implementing-ef-core skill.
These are the most frequently violated conventions. Claude cannot fetch the linked docs at runtime, so these are inlined here:
YYYY-MM-DD_##_Description.sql (e.g., 2025-06-15_00_AddVaultColumn.sql)dbo schema — never create objects in other schemasPK_TableName (primary key), FK_Child_Parent (foreign key), IX_Table_Column (index), DF_Table_Column (default)IF NOT EXISTS / IF COL_LENGTH(...) guards before schema changes in migration scripts[DatabaseData] attribute — this runs the test against all configured database providersnpx claudepluginhub bitwarden/ai-plugins --plugin bitwarden-software-engineerImplementing Entity Framework Core repositories and migrations for PostgreSQL, MySQL, and SQLite at Bitwarden. Use when creating or modifying EF repositories, generating EF migrations, or working with non-MSSQL data access in the server repo.
Provides database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and ORMs like Prisma, Drizzle, and Django.
Generates database migrations with schema changes and rollback, detecting framework (Knex, Prisma, TypeORM, raw SQL) and validating safety.