Use when writing or reviewing MSSQL/T-SQL, creating stored procedures, designing table schemas, writing views, building migrations, defining custom types, or architecting a SQL Server application database. Also use when writing RAISERROR patterns, CHECK constraints with scalar functions, base/subtype table hierarchies, composite key designs, role-scoped views with row-level security, or idempotent DDL scripts. If you are touching MSSQL for an application database, use this skill. Not for PostgreSQL, MySQL, Oracle, or SQLite — patterns are SQL Server-specific.
95
94%
Does it follow best practices?
Impact
98%
1.81xAverage score across 5 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent follows idempotent migration instructions: wrapping every DDL change in meta-function existence checks, building sys.* catalog wrapper functions for those checks, and applying the correct check type for each DDL operation.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Meta functions query sys.* views",
"description": "The meta functions in meta_functions.sql query sys.* catalog views (sys.tables, sys.columns, sys.indexes, etc.) to determine object existence — not INFORMATION_SCHEMA alone",
"max_score": 10
},
{
"name": "Column existence check",
"description": "The migration wraps the ADD column operations in an IF check using a ColumnExists_fn (or equivalent) — not a raw IF EXISTS subquery",
"max_score": 10
},
{
"name": "Table existence check for new table",
"description": "The new OrderTag (or equivalent) table creation is wrapped in a TableExists_fn (or equivalent) check",
"max_score": 10
},
{
"name": "Constraint existence check",
"description": "The unique constraint addition is wrapped in a UniqueConstraintExists_fn (or equivalent) existence check",
"max_score": 8
},
{
"name": "Index existence check",
"description": "The new index creation is wrapped in an IndexExists_fn (or equivalent) existence check",
"max_score": 8
},
{
"name": "Type existence check",
"description": "The new custom type creation is wrapped in a TypeExists_fn (or equivalent) existence check",
"max_score": 8
},
{
"name": "All 6 changes covered idempotently",
"description": "All 6 schema changes (2 columns, 1 table, 1 constraint, 1 index, 1 type) are guarded by existence checks — none are applied unconditionally",
"max_score": 14
},
{
"name": "Meta functions use scalar function pattern",
"description": "Existence checks are implemented as scalar functions returning BIT (1/0), not as inline IF EXISTS subqueries scattered throughout the migration",
"max_score": 10
},
{
"name": "Predicate constraint name on new table",
"description": "The foreign key constraint on the new OrderTag table uses a predicate-style name (Subject_Relationship_Object) rather than FK_ prefix",
"max_score": 10
},
{
"name": "Index naming convention",
"description": "The new index follows the IX_Table_Columns naming convention (e.g., IX_Order_CreatedAt)",
"max_score": 12
}
]
}