Skip to content

Latest commit

Β 

History

History
83 lines (59 loc) Β· 1.68 KB

File metadata and controls

83 lines (59 loc) Β· 1.68 KB
name sql-lint
description SQL code style check - Use SQLFluff to check SQL statement style and syntax (supports PostgreSQL, MySQL, SQLite, etc.)

SQL Lint Skill

πŸ“‹ Overview

Use SQLFluff to check SQL code quality, supporting multiple database dialects:

  • PostgreSQL, MySQL, MariaDB
  • SQLite, BigQuery, Snowflake
  • Redshift, TSQL, Oracle, etc.

πŸ”§ Prerequisites

Tool Installation
Python 3.8+ python.org
SQLFluff pip install sqlfluff

πŸš€ Usage

Check single file:

.\.agent\skills\sql-lint\scripts\lint.ps1 -File query.sql

Specify database dialect:

.\.agent\skills\sql-lint\scripts\lint.ps1 -Dialect postgres

Auto-fix:

.\.agent\skills\sql-lint\scripts\lint.ps1 -Fix

🎯 What It Checks

  • βœ… SQL keyword case consistency
  • βœ… Indentation and formatting standards
  • βœ… JOIN type clarity
  • βœ… Table alias usage standards
  • βœ… WHERE condition safety

πŸ“Š Supported Database Dialects

Dialect Database
postgres PostgreSQL
mysql MySQL/MariaDB
sqlite SQLite
bigquery Google BigQuery
snowflake Snowflake
tsql SQL Server

βš™οΈ Configuration Example

Create .sqlfluff:

[sqlfluff]
dialect = postgres
templater = jinja
exclude_rules = L003,L009

[sqlfluff:indentation]
indent_unit = space
tab_space_size = 2

[sqlfluff:rules:L010]
capitalisation_policy = upper

πŸ”— Related Resources