Mssql dev
SQL Server database development specialist. Use when creating tables, stored procedures, migrations, or troubleshooting SQL Server/Docker issues. Reads project tech-stack directory conventions if present; falls back to generic SQL Server patterns (UNIQUEIDENTIFIER PKs, CreatedOn/ModifiedOn with GETUTCDATE(), no FK constraints, WITH(NOLOCK), SARG optimization, stored proc naming {Product}_{Module}_{Function}_{Date}).From its SKILL.md
npx -y skills add coolwuu/smart-dev-plugin --skill mssql-devAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
9.7 KB, as published. Nobody here has run it
MSSQL Development Skill
Overview
This skill provides specialized guidance for Microsoft SQL Server database development across projects. Enforce project-wide database conventions (read from project config when available), manage SQL Server Database Project structure, and provide troubleshooting support for common SQL Server and Docker issues.
Note: Naming conventions (stored procedure prefix, project name placeholder
{Product}) come from the project'stech-stack directoryconfig. When no project config exists, the generic{Product}placeholder is used throughout and the skill applies the fallback conventions inreferences/conventions.md.
When to Use This Skill
Activate this skill when:
- Creating new database tables
- Writing or updating stored procedures, views, or functions
- Creating migration scripts or seed data
- Troubleshooting SQL Server on Docker
- Diagnosing database schema synchronization issues
- Working with
.sqlfiles in SQL Server Database projects - Questions about database conventions or patterns
Core Capabilities
1. Enforce Organization Database Conventions
Project conventions take precedence. Before applying conventions below, check if the project has
tech-stack directory. If a SQL/database conventions file exists there (e.g.mssql.md), read it first — it is the authoritative source and overrides any generic guidance in this skill.If
tech-stack directorydoes not exist: apply the generic conventions below and note that project-specific rules are unavailable.
All database objects must follow project-wide conventions documented in the project's tech-stack directory conventions file (see references/conventions.md for generic fallback). Critical requirements:
- Required audit columns: Every table MUST have
CreatedOn DATETIME2 NOT NULL DEFAULT GETUTCDATE()andModifiedOn DATETIME2 NOT NULL DEFAULT GETUTCDATE() - Timestamp naming: Use
CreatedOn/ModifiedOn(NEVERCreatedDate/CreatedAt/UpdatedAt) - Timestamp function: Use
GETUTCDATE()(UTC; NEVERGETDATE()which is timezone-dependent) - Primary key:
Id UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID() PRIMARY KEY(per ADR-012) - Foreign keys: AVOID foreign key constraints (per ADR-006); use application-level integrity
- Data types:
DATETIME2for timestamps,NVARCHARfor strings,BITfor booleans,DECIMAL(18,2)for money - Naming: PascalCase for tables/columns, boolean prefix with
Is, FK columns end withId - Stored procedure naming:
[dbo].[{Product}_{Module}_{Function}_{YYYY.MM.DD}](e.g.,{Product}_Auth_UserLogin_2025.11.22) - Stored procedure versioning: When updating a procedure, UPDATE the existing file in-place and change the date suffix (don't create new separate files for new versions)
- Query hints: All SELECT queries MUST include
WITH(NOLOCK)to prevent read locks - SARG optimization: Use SARG-able predicates when possible (avoid functions on columns in WHERE clauses)
2. Manage Database Project Structure
Ensure all database objects are properly organized and included in builds. See references/folder-structure.md for details.
File Organization (example layout):
- Tables →
{Project}.Database/dbo/Tables/{TableName}.sql - Stored Procedures →
{Project}.Database/dbo/Stored Procedures/{ProcName}.sql - Views →
{Project}.Database/dbo/Views/{ViewName}.sql - Migration Scripts →
{Project}.Database/Scripts/Post-Deployment/{###_Description}.sql
Critical Build Step: After creating any .sql file, ALWAYS update {Project}.Database.sqlproj:
<ItemGroup>
<Build Include="dbo\Tables\YourTable.sql" />
<Build Include="dbo\Stored Procedures\uspYourProc.sql" />
<PostDeploy Include="Scripts\Post-Deployment\001_SeedData.sql" />
</ItemGroup>
Verification Steps:
- Create the
.sqlfile in the correct folder - Add
<Build Include="..." />entry to.sqlproj - Run
dotnet build {Project}.Database/{Project}.Database.sqlprojto validate - Verify
.dacpacis generated inbin/Debug/
3. Use Templates for Consistency
Templates are provided in the assets/ folder to ensure consistency:
assets/table-template.sql: Standard table structure with required audit columnsassets/stored-proc-template.sql: Stored procedure with error handlingassets/migration-template.sql: Idempotent migration script pattern
Copy and customize these templates rather than creating from scratch.
4. Troubleshooting Support
Provide solutions for common issues documented in references/troubleshooting.md:
- SQL Server on Docker: Container startup failures, connection issues, password complexity
- Schema sync issues: Tables exist in code but not database, missing columns, deployment problems
- Build errors: Files not included in
.sqlproj, circular dependencies, syntax errors - Connection string issues: Authentication failures, database access problems
Workflow for Common Tasks
Creating a New Table
- Read conventions: Review
references/conventions.mdfor current standards - Copy template: Use
assets/table-template.sqlas starting point - Customize: Replace
{TableName}and add specific columns - Save file: Place in
{Project}.Database/dbo/Tables/{TableName}.sql - Update project: Add
<Build Include="dbo\Tables\{TableName}.sql" />to.sqlproj - Validate: Run
dotnet build {Project}.Database/{Project}.Database.sqlproj - Verify: Ensure
.dacpacbuilds without errors
Creating a Stored Procedure
- Copy template: Use
assets/stored-proc-template.sql - Customize: Replace placeholders with actual procedure logic
- Save file: Place in
{Project}.Database/dbo/Stored Procedures/usp{ProcName}.sql - Update project: Add
<Build Include="dbo\Stored Procedures\usp{ProcName}.sql" />to.sqlproj - Validate: Build the project
Creating a Migration Script
- Copy template: Use
assets/migration-template.sql - Make idempotent: Ensure script can run multiple times safely (use
IF NOT EXISTSchecks) - Number sequentially: Use format
###_DescriptiveName.sql(e.g.,001_CreateUsersTable.sql) - Save file: Place in
{Project}.Database/Scripts/Post-Deployment/ - Update project: Add
<PostDeploy Include="Scripts\Post-Deployment\###_Name.sql" />to.sqlproj
Troubleshooting "Table Not Found" Errors
- Check file location: Verify
.sqlfile is in{Project}.Database/dbo/Tables/ - Check .sqlproj: Search for filename in
{Project}.Database.sqlproj - Verify build entry: Ensure
<Build Include="..." />exists - Rebuild: Run
dotnet build {Project}.Database/{Project}.Database.sqlproj - Check deployment: Verify
.dacpacwas deployed to target database - Query database: Run
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'YourTable'
Troubleshooting SQL Server Docker Issues
- Check logs: Run
docker logs <container-name> - Verify password: Must be 8+ chars with uppercase, lowercase, numbers, symbols
- Check memory: SQL Server needs at least 2GB RAM
- Verify EULA: Ensure
ACCEPT_EULA=Yis set - Test connection: Use
docker exec -it <container> /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P YourPassword -C - See full guide: Reference
references/troubleshooting.mdfor detailed solutions
Best Practices
- Always enforce conventions: Review project's tech-stack directory conventions file (see references/conventions.md for generic fallback) before creating objects
- Never skip .sqlproj updates: Files not in the project won't be deployed
- Use templates: Start with provided templates for consistency
- Make migrations idempotent: Scripts should be safe to run multiple times
- Validate builds: Always run
dotnet buildafter making changes - Avoid FK constraints: Follow ADR-006 (application-level referential integrity)
- Document stored procedures: Include clear descriptions and parameter documentation
- Test thoroughly: Verify schema changes don't break existing queries
Key Reference Files
references/conventions.md: Generic database conventions (MUST READ when no project-specific tech-stack file exists)references/folder-structure.md: Database project organization and build integrationreferences/troubleshooting.md: Common issues and solutions for SQL Server and Dockerassets/table-template.sql: Standard table templateassets/stored-proc-template.sql: Stored procedure templateassets/migration-template.sql: Migration script template
Important Reminders
- CreatedOn/ModifiedOn are REQUIRED on every table (not CreatedDate/CreatedAt)
- Use GETUTCDATE() not GETDATE() for timestamps (UTC; timezone-independent)
- No foreign key constraints (per ADR-006)
- Stored procedure naming:
[dbo].[{Product}_{Module}_{Function}_{YYYY.MM.DD}] - All SELECT queries MUST use WITH(NOLOCK) to prevent read locks
- Use SARG-able predicates - avoid functions on columns in WHERE clauses
- Always update .sqlproj after creating .sql files
- Build the project to validate changes
- Make migrations idempotent for safe re-execution
- Follow naming conventions: PascalCase,
Isprefix for booleans,Idsuffix for foreign keys