agentsclimarketplace

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

Install
npx -y skills add cuongtl1992/vibe-skills --skill sqlserver-expert

Assembled 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

  1. Avoid SELECT * - list columns explicitly
  2. Use appropriate indexes for WHERE/JOIN columns
  3. Avoid functions on columns in WHERE (not sargable)
  4. Use SET NOCOUNT ON in stored procedures
  5. Use OPTION (RECOMPILE) for parameter-sensitive queries

Security

  1. Never concatenate strings - use parameters
  2. Least privilege for application users
  3. Use schemas to organize and control access

Detailed References

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.