CtrlK
BlogDocsLog inGet started
Tessl Logo

alonso-skills/mssql-writing-guidelines

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

1.81x
Quality

94%

Does it follow best practices?

Impact

98%

1.81x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

Evaluation results

93%

45%

Library Management System — Core Schema

Criteria
Without context
With context

No bare built-in types

25%

100%

Types YAML manifest exists

100%

100%

Generic primitive underscore prefix

0%

100%

Custom types defined as NOT NULL

100%

100%

Default constraints documented

28%

100%

Reference tables seeded inline

100%

100%

Constraint predicate naming

0%

75%

No structural FK prefixes

0%

62%

PascalCase identifiers

71%

85%

No suffix for Number columns

0%

100%

Associative table naming

100%

100%

100%

26%

Legal Case Management — Document Hierarchy Schema

Criteria
Without context
With context

Composite PKs grow wider per level

100%

100%

No IDENTITY columns

100%

100%

Max-plus-one functions exist

100%

100%

Max-plus-one scoped to parent

100%

100%

ISNULL default to zero

100%

100%

FK references full parent PK

100%

100%

Predicate constraint names

0%

100%

No suffix for sequential identifiers

12%

100%

Function naming convention

18%

100%

100%

10%

E-Commerce Platform — Schema Evolution Migration

Criteria
Without context
With context

Meta functions query sys.* views

100%

100%

Column existence check

100%

100%

Table existence check for new table

100%

100%

Constraint existence check

100%

100%

Index existence check

100%

100%

Type existence check

100%

100%

All 6 changes covered idempotently

100%

100%

Meta functions use scalar function pattern

100%

100%

Predicate constraint name on new table

0%

100%

Index naming convention

100%

100%

100%

44%

Notification Delivery Service — Queue Infrastructure

Criteria
Without context
With context

Required queue columns present

50%

100%

QueueStatus seeded inline

37%

100%

AppSettings table present

100%

100%

AppSettings dot-namespace

0%

100%

Next_ procedure uses READPAST

100%

100%

Next_ procedure uses UPDLOCK and ROWLOCK

100%

100%

Max attempts from AppSettings with COALESCE

0%

100%

Max attempts in WHERE clause

100%

100%

State classification functions

100%

100%

Subtype tables for email and SMS

62%

100%

Next_ procedure is _trx

0%

100%

DML error checking in Next_ procedure

0%

100%

100%

94%

Hotel Reservation System — Booking Procedures

Criteria
Without context
With context

_utx suffix for payment procedure

0%

100%

_trx suffix for reservation procedure

0%

100%

_utx validates @@TRANCOUNT > 0

0%

100%

_trx validates @@TRANCOUNT = 0

0%

100%

No TRY-CATCH for DML

0%

100%

GOTO exit labels present

0%

100%

Atomic @@ROWCOUNT + @@ERROR capture

0%

100%

Structured RAISERROR codes

25%

100%

Transaction name matches procedure

0%

100%

_trx calls _utx inside transaction

50%

100%

No SQL keyword verbs

0%

100%

DECLARE block present

0%

100%

Evaluated
Agent
Claude
Model
Claude Sonnet 4.6

Table of Contents