sql-optimizer

Clean, format, and document Hive/MaxCompute SQL queries with syntax validation.

1|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/OliverOuyang/shuhe-work-skills --skill sql-optimizer-oliverouyang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sql-optimizer
Source: https://github.com/OliverOuyang/shuhe-work-skills/tree/main/skills/sql-optimizer
Command: npx skills add https://github.com/OliverOuyang/shuhe-work-skills --skill sql-optimizer-oliverouyang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Optimizes and cleans Hive/MaxCompute SQL queries by removing duplicates, adding structured documentation, enforcing formatting, and validating syntax to improve readability and maintainability without altering results.

Core Features & Use Cases

  • Remove duplicates and redundant comments to reduce noise and confusion
  • Add file headers with query metadata, sectioned comments for dimensions, metrics, and filters, and a glossary
  • Improve formatting for readability, including aligned aliases and clear CASE blocks
  • Validate Hive/MaxCompute syntax and variable usage (${bizdate}, ${pt}, etc.)
  • Provide safe, guidance-driven transformations for data pipelines and ad-hoc SQL improvements

Quick Start

Provide a messy Hive/MaxCompute SQL file and ask the skill to optimize, format, and add structured comments.

Frequently Asked Questions about sql-optimizer

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

FAQPage Schema
How do I format and add comments to messy Hive SQL queries?

To format Hive SQL queries, provide your messy SQL file to an optimizer that removes duplicates, aligns aliases, structures CASE blocks, and adds metadata headers with sectioned comments for dimensions, metrics, and filters.

Can I validate MaxCompute SQL syntax and partition variables automatically?

Yes, SQL optimization tools can validate MaxCompute syntax and handle partition variables like ${bizdate} and ${pt} automatically, ensuring correct variable usage and structured formatting without altering your business logic or query results.

What is the best way to clean up complex joins in data pipeline SQL?

The best way to clean up complex joins in data pipelines is using a SQL optimizer that enforces consistent style, adds inline comments for non-obvious logic, and applies safe, guidance-driven transformations to improve readability and maintainability.

Does SQL formatting alter my original query results or business logic?

No, SQL formatting and cleaning processes are designed to preserve your business logic and query results exactly. They focus on removing redundant comments, enforcing style, and adding documentation without altering the execution outcome.

How do I add a glossary and metadata headers to ad-hoc MaxCompute SQL?

You can add a glossary and metadata headers to ad-hoc MaxCompute SQL by running it through a documentation tool that automatically generates structured file headers, sectioned comments, and inline documentation for non-obvious logic.

Why should I remove duplicate comments and redundant code from Hive SQL?

Removing duplicate comments and redundant code from Hive SQL reduces noise and confusion, improving overall readability. This makes data pipelines and ad-hoc queries significantly easier to maintain and review during development.