Agent skill

Clickhouse Rust View Column Order

by divinevideo in divinevideo/divine-mobile

Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias.

MPL-2.0Auto-check passedDatabases

Install Clickhouse Rust View Column Order

skills CLI
$ npx skills add divinevideo/divine-mobile --skill clickhouse-rust-view-column-order -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divinevideo/divine-mobile clickhouse-rust-view-column-order --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/clickhouse-rust-view-column-order .claude/skills/clickhouse-rust-view-column-order && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
clickhouse-rust-view-column-order
GitHub stars
266
Token cost
~1.6k tokens
SKILL.md length
572 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias.

  • Works in 5 steps: Identify which query variants fail vs.… → Expand the failing SELECT alias.* — run… → List actual column order of the full… → …
  • Some query variants (e.g
  • SKILL.md covers Problem, Symptoms, Root Cause Explained and Why Only Some Queries Fail, plus 6 more sections
  • Calls curl

What it does

Clickhouse Rust View Column Order is an agent skill from divinevideo/divine-mobile. Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias. on a VIEW that adds computed columns. Use when: (1) Some query variants (e.g. sort=trending) return 500 but others (sort=recent) succeed, (2) Queries use SELECT viewalias., extracols FROM view JOIN ..., (3) The Rust Row struct has the right number and types of fields but deserialization fails anyway (wrong type error, not "not enough data"), (4) The VIEW was recently extended with a computed column (e.g…

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Data warehousing. It works with Rust and ClickHouse. The licence is MPL-2.0.

When your agent uses it

  • Some query variants (e.g
  • Tasks that involve Data warehousing

Example prompts

  • “not enough data”
  • “/clickhouse-rust-view-column-order”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Identify which query variants fail vs. succeed. Failing ones likely use a
  2. Expand the failing SELECT alias.* — run the inner view query directly
  3. List actual column order of the full outer query
  4. Compare with Rust struct field order line by line — they must match exactly.
  5. Find the misplaced field — look for computed columns added to the view that

What it can do on your machine

Read from SKILL.md and the folder at commit 6487b05. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.rs

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Clickhouse Rust View Column Order loads about 1.6k tokens when it runs. Until then it costs about 142 tokens; SKILL.md has 572 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~142
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from divinevideo/divine-mobile at commit 6487b05, republished under its MPL-2.0 licence (© divinevideo). 572 words, ~1,562 tokens.

Download SKILL.mdSave it as .claude/skills/clickhouse-rust-view-column-order/SKILL.md (or your agent's skills folder).
name
clickhouse-rust-view-column-order
description
Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias.* on a VIEW that adds computed columns. Use when: (1) Some query variants (e.g. sort=trending) return 500 but others (sort=recent) succeed, (2) Queries use SELECT view_alias.*, extra_cols FROM view JOIN ..., (3) The Rust Row struct has the right number and types of fields but deserialization fails anyway (wrong type error, not "not enough data"), (4) The VIEW was recently extended with a computed column (e.g. trending_score).
author
Claude Code
version
1.0.0
date
2026-02-25

ClickHouse Rust: View Computed Column Ordering

Problem

When using SELECT alias.* , extra_col FROM my_view alias LEFT JOIN ..., ClickHouse expands alias.* to include ALL columns defined in the view — including any computed columns added by the view itself (e.g. SELECT *, expr AS trending_score FROM base). Those computed columns appear INSIDE the alias.* expansion, BEFORE any columns appended after it in the outer query.

The clickhouse Rust crate (#[derive(Row)]) deserializes positionally — field N in the Rust struct receives column N from the query result. If the struct field order doesn't match the actual SQL column order, the wrong bytes land in the wrong fields, causing type errors at deserialization even though the column count is correct.

Symptoms

  • HTTP 500 on one sort variant (e.g. sort=trending, sort=popular) but not others (e.g. sort=recent) that query a different view or table
  • Error like: "cannot decode Float64 from String" or similar type mismatch
  • Column COUNT is correct (no "not enough data" error)
  • Bug appears after adding a computed column to an existing view

Root Cause Explained

Suppose trending_videos is defined as:

sql
CREATE VIEW trending_videos AS
SELECT
    *,                                          -- all base columns
    (views * 0.5 + likes * 2.0) AS trending_score  -- computed column APPENDED HERE
FROM video_stats;

An outer query then does:

sql
SELECT
    tv.*,                   -- expands to: base_cols..., trending_score
    text_track_ref,         -- subtitle columns come AFTER
    text_track_content
FROM trending_videos tv
LEFT JOIN subtitle_subquery USING (id);

The actual SQL result column order is:

[...base_cols, trending_score, text_track_ref, text_track_content]

But if the Rust struct was written with subtitle fields before trending_score:

rust
pub struct TrendingVideo {
    // ...base fields...
    pub text_track_ref: String,      // position N   <- WRONG: gets trending_score bytes
    pub text_track_content: String,  // position N+1 <- WRONG: gets text_track_ref bytes
    pub trending_score: f64,         // position N+2 <- WRONG: gets text_track_content bytes
}

ClickHouse sends a Float64 where Rust expects a String → deserialization error → 500.

Why Only Some Queries Fail

The sort=recent variant queries video_stats directly with vs.* — that view has no extra computed columns, so subtitle columns land at the same relative position the struct expects. Only the trending_videos view adds trending_score inside vs.*, shifting everything after it.

Debugging Steps

  1. Identify which query variants fail vs. succeed. Failing ones likely use a different view or have a different SELECT * source.

  2. Expand the failing SELECT alias.* — run the inner view query directly:

    bash
    curl -u 'user:pass' 'https://clickhouse-host:8443' \
      --data-binary "SELECT * FROM trending_videos LIMIT 0 FORMAT TabSeparated"

    Or use DESCRIBE TABLE trending_videos to see declared column order.

  3. List actual column order of the full outer query:

    bash
    curl ... --data-binary \
      "SELECT tv.*, '' as text_track_ref, '' as text_track_content
       FROM trending_videos tv LIMIT 0 FORMAT TabSeparatedWithNames"
  4. Compare with Rust struct field order line by line — they must match exactly.

  5. Find the misplaced field — look for computed columns added to the view that appear inside alias.* but after columns that appear in the outer SELECT.

Show full SKILL.md (222 more words)Show less

Fix

Reorder the Rust struct fields to match the actual SQL column order — computed VIEW columns belong before any columns appended in the outer SELECT:

rust
pub struct TrendingVideo {
    // ...base fields in same order as base table...

    // trending_score comes from tv.* (view-computed), so it appears
    // BEFORE the subtitle columns we append in the outer query
    pub trending_score: f64,

    // Subtitle columns are appended after tv.* in the outer SELECT
    pub text_track_ref: String,
    pub text_track_content: String,
}

Do NOT change the SQL query or the view — just align the struct field order.

Key Rule

When a ClickHouse VIEW adds a computed column via SELECT *, expr AS col FROM base, that column becomes part of the view's column list. Any SELECT alias.* in an outer query will emit it in the view's declared order — BEFORE any extra columns appended after alias.* in the outer SELECT. The Rust #[derive(Row)] struct must reflect this exact order.

Prevention

  • When adding a computed column to a ClickHouse view, immediately check ALL Rust structs that query that view with SELECT alias.* and update field ordering.
  • Add an integration test that queries the affected endpoint; CI will catch future ordering drift before staging.
  • Consider using SELECT col1, col2, ..., trending_score, text_track_ref, text_track_content (explicit column list instead of *) in the outer query to make ordering explicit and immune to view schema changes.
  • clickhouse-rust-type-mismatches — covers "not enough data" (column COUNT mismatch), FixedString encoding, Option vs String nullability issues. This skill covers column ORDER mismatch (column count is correct, types match, but positional order is wrong).

References

© divinevideo, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/clickhouse-rust-view-column-order of divinevideo/divine-mobile.

Open the folder on GitHubat commit 6487b05

Compare with similar skills

Clickhouse Rust View Column Order next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Clickhouse Rust View Column Order compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Clickhouse Rust View Column Order this skilldivinevideo/divine-mobile266—~1.6kAutomated safety check: PassMPL-2.0
Webapp Buildersidequery/sidemantic129—~5.5kAutomated safety check: PassAGPL-3.0
Querying Tempotempoxyz/tidx107—~3.1kAutomated safety check: PassMIT
Adding Ingestion WarningsPostHog/posthog40k—~3.7kAutomated safety check: PassCustom licence
Clickhouse Logs Queriessupabase/supabase111k—~2.4kAutomated safety check: PassApache-2.0
Keeper Stress AnalysisClickHouse/ClickHouse50k—~4.7kAutomated safety check: PassApache-2.0

Similar skills

  • Webapp Builder

    sidequery/sidemantic

    Build interactive analytics webapps, demos, dashboards, or embedded app surfaces from Sidemantic semantic models using copyable component primitives and deterministic query inspection.

    129 GitHub stars~5.5k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Querying Tempo

    tempoxyz/tidx

    Query indexed Tempo chain data via tidx HTTP API and CLI. An agent skill from tempoxyz/tidx.

    107 GitHub stars~3.1k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Official

    How to add a new ingestion warning type to the event ingestion pipeline.

    40k GitHub stars~3.7k tokensUpdated today
    DatabasesAuto-check passed
  • Clickhouse Logs Queries

    supabase/supabase

    Official

    Write, review, and migrate Supabase logs queries against the ClickHouse-backed logs table (the logs.all.otel analytics endpoint).

    111k GitHub stars~2.4k tokensUpdated today
    DatabasesAuto-check passed
  • Keeper Stress Analysis

    ClickHouse/ClickHouse

    Analyze ClickHouse Keeper stress-test results from play.clickhouse.com / keeperstresstests data warehouse.

    50k GitHub stars~4.7k tokensUpdated today
    DatabasesAuto-check passed
  • Perf Comparison

    ClickHouse/ClickHouse

    Evaluate ClickHouse performance test results from existing CI/dashboard data or local perf.py runs.

    50k GitHub stars~3.9k tokensUpdated today
    DatabasesAuto-check: notes

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Async Await Null Race Condition

    divinevideo/divine-mobile

    Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

    266 GitHub stars~881 tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Clickhouse Rust View Column Order

What does Clickhouse Rust View Column Order do?

Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias. Clickhouse Rust View Column Order is an agent skill from divinevideo/divine-mobile. Debug ClickHouse deserialization errors in Rust caused by column ORDER mismatch when using SELECT alias.

When should I use Clickhouse Rust View Column Order?

Clickhouse Rust View Column Order fits situations like: some query variants (e.g; tasks that involve Data warehousing.

How do I install Clickhouse Rust View Column Order in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill clickhouse-rust-view-column-order -a claude-code`. Or copy the skill folder (.agents/skills/clickhouse-rust-view-column-order in divinevideo/divine-mobile) into .claude/skills/clickhouse-rust-view-column-order in your project. Claude Code loads it when a task matches its description.

How do I install Clickhouse Rust View Column Order in Codex?

Run `npx skills add divinevideo/divine-mobile --skill clickhouse-rust-view-column-order -a codex`. Or copy the skill folder (.agents/skills/clickhouse-rust-view-column-order in divinevideo/divine-mobile) into .agents/skills/clickhouse-rust-view-column-order in your project. Codex loads it when a task matches its description.

Can I use Clickhouse Rust View Column Order in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divinevideo/divine-mobile --skill clickhouse-rust-view-column-order -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/clickhouse-rust-view-column-order, .gemini/skills/clickhouse-rust-view-column-order, .github/skills/clickhouse-rust-view-column-order and .opencode/skills/clickhouse-rust-view-column-order in your project.

What does Clickhouse Rust View Column Order need to run?

Going by SKILL.md and its folder, Clickhouse Rust View Column Order needs the command-line tools its instructions call (curl).

Does Clickhouse Rust View Column Order access the network?

SKILL.md names 1 domain. As links in the text: docs.rs. This is read from the text; nothing was executed.

Is Clickhouse Rust View Column Order safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Clickhouse Rust View Column Order use?

Clickhouse Rust View Column Order is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Clickhouse Rust View Column Order use?

About 1.6k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Clickhouse Rust View Column Order?

Skills that share tags, products or a category with Clickhouse Rust View Column Order: Webapp Builder (sidequery/sidemantic, 129 stars), Querying Tempo (tempoxyz/tidx, 107 stars), Adding Ingestion Warnings (PostHog/posthog, 40k stars) and Clickhouse Logs Queries (supabase/supabase, 111k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Clickhouse Rust View Column Order?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 9, 2026.

Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.