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 the relational queue design instructions: correct queue column shape, QueueStatus reference table seeded with the correct lifecycle states, AppSettings for max attempts, Next_ procedure with UPDLOCK/ROWLOCK/READPAST for concurrent safety, COALESCE default for max attempts, and state classification functions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Required queue columns present",
"description": "The Notification base table includes all of: Status, Step, AttemptNum, Response, Error, StartedAt, Duration, ScheduledFor, UpdatedAt",
"max_score": 10
},
{
"name": "QueueStatus seeded inline",
"description": "The QueueStatus reference table is immediately followed by INSERT statements seeding at least: Pending, Processing, Error, Failed, Completed, Cancelled",
"max_score": 8
},
{
"name": "AppSettings table present",
"description": "An AppSettings table exists with at least the max attempts setting seeded (e.g., 'notification.maxAttempts' with value 3)",
"max_score": 8
},
{
"name": "AppSettings dot-namespace",
"description": "The AppSettings parameter name for max attempts uses dot-separated namespace format (e.g., 'notification.maxAttempts', not 'maxAttempts' or 'MAX_ATTEMPTS')",
"max_score": 6
},
{
"name": "Next_ procedure uses READPAST",
"description": "The Next_ (claim) procedure's SELECT statement includes READPAST in its locking hints to allow concurrent workers to skip locked rows",
"max_score": 10
},
{
"name": "Next_ procedure uses UPDLOCK and ROWLOCK",
"description": "The Next_ procedure's SELECT statement includes both UPDLOCK and ROWLOCK hints alongside READPAST",
"max_score": 8
},
{
"name": "Max attempts from AppSettings with COALESCE",
"description": "The Next_ procedure reads max attempts from AppSettings using COALESCE with a numeric default (e.g., COALESCE((SELECT ValInt FROM AppSettings WHERE Param = 'notification.maxAttempts'), 3))",
"max_score": 10
},
{
"name": "Max attempts in WHERE clause",
"description": "The Next_ procedure's SELECT filters out items where AttemptNum >= @MaxAttempts directly in the WHERE clause (exhausted items are never claimed)",
"max_score": 8
},
{
"name": "State classification functions",
"description": "At least two state classification scalar functions are defined (e.g., QueueIsProcessable_fn and QueueIsFinished_fn) that return BIT based on the status value",
"max_score": 10
},
{
"name": "Subtype tables for email and SMS",
"description": "Separate subtype tables exist for email-specific data and SMS-specific data, each with a FK to the base Notification table and using the Base_Subtype naming pattern",
"max_score": 8
},
{
"name": "Next_ procedure is _trx",
"description": "The claim procedure name ends with _trx and validates @@TRANCOUNT = 0 before opening its transaction",
"max_score": 8
},
{
"name": "DML error checking in Next_ procedure",
"description": "The Next_ procedure captures @@ROWCOUNT and @@ERROR atomically after the UPDATE claim operation using SELECT @RowCnt = @@ROWCOUNT, @ErrNo = @@ERROR",
"max_score": 6
}
]
}