formatting-sql

Configure SQL formatting standards with SQLFluff, pg_formatter, and atlas fmt.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/musher-dev/bundles --skill formatting-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formatting-sql
Source: https://github.com/musher-dev/bundles/tree/main/database-schema-governance/skills/formatting-sql
Command: npx skills add https://github.com/musher-dev/bundles --skill formatting-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenges of inconsistent SQL formatting, which leads to noisy diffs, slower code reviews, and unnecessary merge conflicts by providing tools and strategies for automated and consistent SQL formatting.

Core Features & Use Cases

  • Tool Comparison: Evaluates SQLFluff, pg_formatter, and atlas fmt for SQL and HCL formatting.
  • Configuration Guidance: Provides recommended configurations for SQLFluff and pre-commit hooks.
  • CI Integration: Details how to implement PR-scoped linting using diff-quality.
  • Policy Enforcement: Advocates for formatting as an advisory policy, not a hard block.
  • Debate Resolution: Offers a framework for resolving formatting disagreements.
  • Use Case: When setting up SQL formatters for a new project, configuring linters, or deciding between different formatting tools.

Quick Start

Configure SQLFluff for PostgreSQL with the provided recommended settings in your .sqlfluff file.

Frequently Asked Questions about formatting-sql

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

FAQPage Schema
How do I standardize SQL formatting across my team to reduce merge conflicts?

To standardize SQL formatting, configure SQLFluff with a shared .sqlfluff file and enforce it via pre-commit hooks, ensuring consistent style rules that reduce noisy diffs and merge conflicts during code review.

What is the best way to run SQL linting only on changed files in a pull request?

The best way to scope SQL linting to a pull request is integrating diff-quality with SQLFluff, which evaluates only changed SQL lines to provide targeted formatting feedback without linting the entire repository.

How do SQLFluff, pg_formatter, and atlas fmt compare for SQL style enforcement?

SQLFluff, pg_formatter, and atlas fmt differ in scope: SQLFluff offers extensive linting and configuration, pg_formatter focuses on structural SQL formatting, and atlas fmt handles HCL formatting for schema definitions.

Should SQL formatting rules block a pull request or act as advisory feedback?

Implementing SQL formatting as an advisory policy rather than a hard CI block prevents developer friction, allowing teams to resolve formatting disagreements gradually while maintaining consistent SQL style standards.

How do I configure pre-commit hooks for SQLFluff in a PostgreSQL project?

Configuring pre-commit hooks for SQLFluff involves adding the tool to your pre-commit config and defining a .sqlfluff file with recommended settings to enforce PostgreSQL dialect rules locally before committing.