sql-workflow

Enforce SQL best practices for schema design, queries, and migrations.

Updated Apr 11, 2023
One-click install
npx skills add https://github.com/salverius-tech/dotfiles --skill sql-workflow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-workflow
Source: https://github.com/salverius-tech/dotfiles/tree/main/home/dot_claude/skills/sql-workflow
Command: npx skills add https://github.com/salverius-tech/dotfiles --skill sql-workflow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidelines and best practices for writing clean, efficient, and maintainable SQL code, ensuring consistency and quality in database interactions.

Core Features & Use Cases

  • Standardized Naming Conventions: Enforces consistent naming for tables, columns, and other database objects.
  • Data Type Recommendations: Guides on choosing appropriate data types for optimal storage and performance.
  • Migration Best Practices: Defines file naming and structure for database schema migrations.
  • Query Optimization: Offers advice on formatting, aliasing, indexing, and performance tuning.
  • Use Case: Ensure all new database schemas adhere to snake_case for identifiers and use TIMESTAMP WITH TIME ZONE for all temporal data, preventing common data integrity and performance issues.

Quick Start

Follow the SQL workflow guidelines to format the provided SQL query.

Frequently Asked Questions about sql-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for SQL naming conventions and schema design?

SQL best practices for schema design include using `snake_case` for all table and column identifiers to ensure consistency. Choosing appropriate data types, such as `TIMESTAMP WITH TIME ZONE` for temporal data, prevents common data integrity and storage performance issues.

How do I optimize SQL queries for better database performance?

To optimize SQL queries, apply best practices for formatting, aliasing, and indexing. Proper query optimization techniques reduce execution time and improve database performance by addressing common pitfalls and ensuring efficient data retrieval.

How should I structure database migrations to avoid schema conflicts?

Database migrations should follow strict file naming and structural best practices to avoid schema conflicts. Standardized migration management ensures consistent database schema evolution and prevents data loss during deployment.

Does SQLFluff work well for enforcing SQL query formatting standards?

Yes, SQLFluff is used to enforce SQL query formatting and linting standards. It helps standardize query writing by automatically checking for consistent aliasing and formatting, which improves overall code maintainability.

When do I need to use TIMESTAMP WITH TIME ZONE in my database schema?

You need `TIMESTAMP WITH TIME ZONE` when storing temporal data to prevent data integrity issues. Using this specific data type ensures accurate timekeeping across different geographical regions and avoids common temporal data pitfalls.

What is the best way to handle database transactions in SQL?

The best way to handle database transactions is by following established SQL standards for transaction handling. Proper transaction management ensures data consistency and prevents partial updates during database interactions.