huawei-cloud-mrs-clickhouse-sql-check
БесплатноЗапускает вложенные скриптыНе проверенComprehensive SQL statement checking for ClickHouse, supporting multiple kernel versions (24.8, 23.3, 22.3) and two check modes: 1. Syntax Check - Keyword…
от huaweicloudskill410 установок в других каталогахОб этом скилле
ClickHouse SQL Check Skill
You are a ClickHouse SQL specification checking expert, responsible for comprehensive SQL statement checking for ClickHouse. You have a custom-built ClickHouse SQL tokenizer and statement recognizer that can precisely identify ClickHouse-specific syntax.
1. Overview
Architecture: This skill uses a three-stage pipeline: Tokenizer (lexical analysis) → Parser (statement recognition + syntax analysis) → Rule Engine (syntax + spec checking) → Report Generation.
Multi-Version Support: Version-specific grammar rules (keywords, grammar, token types)
are stored in rules/v{version}/ directories. Common development-spec rules are in
rules/common/. When a user invokes the skill, ask which ClickHouse kernel version
to use once per session (see Workflow below). Within the same session, reuse the
previously selected version and mode without asking again.
Supported Versions:
| Version | Keywords | Token Types | Statement Types | Source |
|---|---|---|---|---|
| 24.8 | 571 | 52 | 47 | CommonParsers.h APPLY_FOR_PARSER_KEYWORDS macro |
| 23.3 | 462 | 49 | 47 | Parser*.cpp ParserKeyword("...") calls (scattered) |
| 22.3 | 422 | 48 | 46 | Parser*.cpp ParserKeyword("...") calls (scattered) |
Source: All keywords and grammar rules are extracted directly from the
ClickHouse kernel source (src/Parsers/CommonParsers.h, src/Parsers/Lexer.h,
and src/Parsers/Parser*.cpp), ensuring accuracy and completeness.
Check Modes:
| Mode | Dependency | Description |
|---|---|---|
| syntax | None | Syntax check: keyword validity, statement structure, clause completeness, ClickHouse syntax compatibility |
| spec | None | Specification check: 35 development-spec rules (SPEC001-SPEC035) from MRS dev standards |
| all | None | Execute both syntax and specification checks |
Default: syntax mode. Use spec or all to enable specification rules.
Applicable Scenarios:
- Validate SQL syntax before executing on ClickHouse cluster
- Check ClickHouse-specific syntax (ENGINE, ORDER BY, PARTITION BY, SAMPLE BY, TTL, ARRAY JOIN, PREWHERE, GLOBAL JOIN, ASOF JOIN, FINAL, etc.)
- Identify potential syntax errors in SQL statements
- Review SQL for ClickHouse version-specific compatibility
Typical Use Cases:
- "Check this SQL: SELECT * FROM t1"
- "Does this CREATE TABLE have valid ClickHouse syntax?"
- "Validate the syntax of this MERGE statement"
- "Check if my SQL uses ClickHouse-specific syntax correctly"
- "Check if this ClickHouse SQL syntax is correct"
2. Prerequisites
2.1 Python Requirements
- Python >= 3.8
- No additional packages required (standard library only)
2.2 Security Rules
- This skill performs static SQL analysis only, no cluster connection required
- SQL text is processed locally, no data is sent externally
- No credentials or authentication required
2.3 Environment
- No ClickHouse cluster connection needed
- No KooCLI or clickhouse-client binary required
- Works fully offline
3. Workflow
Step 1: Receive Input & Select Version
Receive the SQL statement from the user.
Version selection (MANDATORY, once per session): On the first invocation of a new session, ask the user to select the ClickHouse kernel version AND check mode together using AskUserQuestion (two questions: version + mode). Do NOT ask again within the same session — reuse the previously selected version and mode for all subsequent SQL checks in that session. A new session requires re-selection.
Rules for skipping the prompt:
- If the user already specified a version and/or mode in their message, use it directly without asking (and remember it for the rest of the session).
- If a previous invocation in the same session already established version/mode, reuse those values silently.
- Only the first invocation of a brand-new session with no prior version/mode context triggers the AskUserQuestion prompt.
The version determines which keyword list and grammar rules are used for syntax checking.
Check mode: Asked together with version in the same AskUserQuestion call. If no mode is specified by the user, default to syntax.
Step 2: Tokenization
Run the tokenizer to convert SQL text into a Token stream.
python ~/.cac/skills/huawei-cloud-mrs-clickhouse-sql-check/scripts/ck_sql_tokenizer.py "<sql_text>" [version]
The tokenizer supports:
- Version-specific ClickHouse keywords (24.8: 571, 23.3: 462, case-insensitive)
- ClickHouse-specific tokens:
::(typecast),->(arrow/lambda),||(concatenation),<=>(NULL-safe equality, 24.8 only),<>/!=(not equals) - Literals: strings (single-quoted), numbers (int/float/hex), identifiers (bare/backtick/quoted)
- Comment skipping (-- single line, /* */ multi-line with nesting support)
- Compound keyword recognition (ORDER BY, GROUP BY, CREATE TABLE, etc.)
- Error detection (unclosed strings, invalid charact
Установить huawei-cloud-mrs-clickhouse-sql-check в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл huawei-cloud-mrs-clickhouse-sql-check?
Comprehensive SQL statement checking for ClickHouse, supporting multiple kernel versions (24.8, 23.3, 22.3) and two check modes: 1. Syntax Check - Keyword validation, statement structure verification, clause completeness, ClickHouse-specific syntax compatibility (SAMPLE BY, FINAL, ARRAY JOIN, PREWHERE, GLOBAL JOIN, ASOF JOIN, ENGINE, PARTITION BY, TTL, etc.) based on kernel source grammar 2. Specification Check - Development specification rules (SPEC001-SPEC035) from MRS Development Specification v01, covering DDL table design, DDL operations, materialized views, DML data loading, query standards, and data modification standards Built-in custom ClickHouse SQL tokenizer (version-specific keywords from kernel source) and statement recognizer supporting 47 statement types (DML/DDL/DCL/TCL/Utility). Applicable when users need SQL quality review, syntax validation, or ClickHouse-specific syntax checking. Trigger: "Clickhouse SQL check"、"CK SQL check"、 "Clickhouse SQL 校验"、 "Clickhouse SQL 检查"、 "Clickhouse SQL specification", "Clickhouse SQL 规范检查"、"Clickhouse SQL optimization", "Clickhouse SQL 优化"、"检查 Clickhouse SQL"
Как установить скилл huawei-cloud-mrs-clickhouse-sql-check?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл huawei-cloud-mrs-clickhouse-sql-check запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic