SQL Formatter for Openclaw

A pure Python CLI tool to format, minify, and lint SQL queries with zero external dependencies.

johnnywang2001
v1.0.0
Mar 19, 2026
0
930
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install sql-formatter

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install sql-formatter using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is SQL Formatter?

SQL Formatter is a specialized utility within the Openclaw Skills ecosystem designed to bring consistency and quality to your SQL codebases. It provides a lightweight, pure Python solution for handling SQL transformations without the overhead of heavy library dependencies. Whether you are prepping queries for production or cleaning up legacy scripts, this tool ensures your SQL follows industry-standard formatting.

Integrating this tool into your Openclaw Skills setup allows for automated SQL cleanup during the development lifecycle. It handles complex SQL syntax including SELECT, INSERT, UPDATE, DELETE, and CTEs (Common Table Expressions). By leveraging this skill, developers can maintain a professional code standard across multiple database dialects without needing complex third-party software.

SQL Formatter Use Cases

  • Prettifying messy SQL queries for better team readability within your Openclaw Skills workflow.
  • Minifying SQL scripts to reduce payload size in production environments and cloud deployments.
  • Linting SQL files to detect common anti-patterns like SELECT * or missing semicolons.
  • Standardizing keyword casing across large database migration scripts to ensure consistency.
  • Automated SQL validation and cleanup within local development environments or CI/CD pipelines.

How SQL Formatter Works

  1. The user provides a raw SQL string, an input file path, or pipes text into the script as part of an Openclaw Skills routine.
  2. The script parses the SQL tokens, identifying keywords, clauses, string literals, and comments.
  3. Based on the selected command (format, minify, or lint), the tool applies specific transformation logic to the SQL structure.
  4. For formatting, it adds line breaks before major clauses and adjusts keyword casing based on user preference.
  5. For minification, it strips all comments and collapses unnecessary whitespace into a single line.
  6. For linting, it evaluates the SQL against a set of best-practice rules and outputs warnings or a JSON report for further processing.
  7. The final result is returned to the terminal, saved to a file, or passed to the next agent in the sequence.

SQL Formatter Setup

To start using this tool with your Openclaw Skills, ensure you have Python 3 installed. No external pip packages are required.

# Download or locate the script
python3 scripts/sql_format.py --help

# Basic formatting check
python3 scripts/sql_format.py format --sql "SELECT * FROM users"

SQL Formatter Data Schema & Taxonomy

The SQL Formatter manages data through standard input/output and can generate structured reports for integration with other Openclaw Skills.

Feature Description
Input Types Raw strings via --sql, file paths via --input, or STDIN (-)
Output Formats Formatted SQL text, minified SQL strings, or structured JSON linting reports
Configuration CLI flags for --indent (integer) and casing options like --lowercase
Linting Checks Detects SELECT *, inconsistent casing, trailing whitespace, and long lines

SQL Formatter Advanced Features

  • JSON Reporting: Generate machine-readable linting reports using the --json flag to integrate with other automation tools in the Openclaw Skills ecosystem.
  • Pipe Support: Fully supports piping (echo "..." | script) for real-time SQL processing in terminal-heavy workflows.
  • Comprehensive Syntax Support: Handles complex SQL structures including CTEs, all types of JOINs, subqueries, and double-quoted identifiers.
  • Custom Indentation: Allows users to define specific indentation levels to match organizational style guides exactly.
  • Zero Dependency Architecture: Operates entirely on pure Python, ensuring it remains fast and portable across different environments.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*