Sqlserver expert
Skill cuongtl1992/vibe-skills/skills/database/sqlserver-expert
Expert in Microsoft SQL Server development and administration. Use when writing T-SQL queries, stored procedures, functions, triggers, optimizing database performance (deadlocks, slow queries, execution plans, index tuning), designing schemas, configuring SQL Server, implementing CDC (Change Data Capture), or integrating SQL Server with .NET Core/C# using Entity Framework Core or Dapper. Also use when user asks "why is my query slow", "how to fix deadlock", "optimize this query", "design this table", or mentions tempdb, query plan, wait stats, or SQL Server error messages.From its SKILL.md
npx -y skills add cuongtl1992/vibe-skills --skill sqlserver-expertAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 11 stars11 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
2.3 KB, as published. Nobody here has run it
SQL Server Expert
Act as DBA and developer expert in Microsoft SQL Server.
Quick Reference
CTEs with Window Functions
WITH RankedData AS (
SELECT Id, Name, Department,
ROW_NUMBER() OVER (PARTITION BY Department ORDER BY HireDate) AS RowNum,
SUM(Salary) OVER (PARTITION BY Department) AS DeptTotal
FROM Employees
)
SELECT * FROM RankedData WHERE RowNum = 1;
MERGE Statement
MERGE INTO Target AS t
USING Source AS s ON t.Id = s.Id
WHEN MATCHED THEN UPDATE SET t.Name = s.Name
WHEN NOT MATCHED THEN INSERT (Id, Name) VALUES (s.Id, s.Name)
WHEN NOT MATCHED BY SOURCE THEN DELETE;
Pagination
SELECT * FROM Orders ORDER BY OrderDate DESC
OFFSET @PageSize * (@PageNumber - 1) ROWS FETCH NEXT @PageSize ROWS ONLY;
Best Practices
Performance
- Avoid
SELECT *- list columns explicitly - Use appropriate indexes for WHERE/JOIN columns
- Avoid functions on columns in WHERE (not sargable)
- Use
SET NOCOUNT ONin stored procedures - Use
OPTION (RECOMPILE)for parameter-sensitive queries
Security
- Never concatenate strings - use parameters
- Least privilege for application users
- Use schemas to organize and control access
Detailed References
- T-SQL Advanced Patterns: See references/tsql-advanced.md
- .NET Core Integration: See references/dotnet-integration.md
- Performance Tuning & Deadlocks: See references/performance.md
- Change Data Capture (CDC): See references/cdc.md
- System Queries & Metadata: See references/system-queries.md