Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tinybird

БесплатноБез исполняемых скриптовНе проверен

Build real-time analytics APIs with Tinybird — ingest millions of events and query with SQL over HTTP. Use when someone asks to "build analytics API"…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Tinybird

Overview

Tinybird is managed ClickHouse with an API layer: you send events over HTTP, write SQL in Pipes, and publish a Pipe as an authenticated HTTP Endpoint that returns JSON, CSV, NDJSON or Parquet. It suits product analytics, usage metering for billing, live dashboards and any aggregation over large append-only event tables.

The current product is Tinybird Forward. Projects are files in git (.datasource, .pipe, .connection), built in Tinybird Local or a Cloud Branch with tb build and shipped with tb deploy. The old Classic commands (tb auth, tb push, the tinybird-cli package) are not the workflow described here. TypeScript (@tinybirdco/sdk) and Python (tinybird-sdk) SDKs can define the same resources in code; this skill uses datafiles.

Instructions

Install and log in

pip install tinybird          # installs the Forward CLI as `tb` (5.x)
tb --version
mkdir product-analytics && cd product-analytics && git init
tb init --type cli --dev-mode local --folder tinybird --cicd skip
tb login                      # opens a browser; writes .tinyb (never commit it)

Tinybird also publishes an installer script at tinybird.co; read it before running it instead of piping it into a shell. If a Classic tb is already on the PATH (which tb), remove it or use a separate virtualenv, because both CLIs use the same command name.

tb init creates tinybird.config.json, .env.local and the folders datasources/, pipes/, endpoints/, materializations/, copies/, sinks/, connections/, fixtures/, tests/. Without --cicd skip it asks about CI/CD templates. dev_mode is local, branch or manual.

Define a Data Source

# tinybird/datasources/events.datasource
DESCRIPTION >
    Raw product events sent from the app

SCHEMA >
    `event_id` String `json:$.event_id`,
    `user_id` String `json:$.user_id`,
    `event_type` LowCardinality(String) `json:$.event_type`,
    `properties` String `json:$.properties`,
    `timestamp` DateTime `json:$.timestamp`

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYYYYMM(timestamp)"
ENGINE_SORTING_KEY "event_type, timestamp, user_id"
ENGINE_TTL "timestamp + toIntervalDay(400)"

TOKEN events_append APPEND

Rules that matter: the sorting key decides query speed (put the columns you filter on first); partition monthly or yearly only, because fine-grained partitions slow writes; TOKEN <name> APPEND creates a token that can only write to this table. Changing a deployed schema in an incompatible way needs a FORWARD_QUERY.

Ingest events

POST /v0/events?name=events takes NDJSON (one JSON object per line). Batch several events per request: it is much faster than one request per event. Use the host of your workspace region (api.tinybird.co for the default region).

// src/analytics/track.ts
const TINYBIRD_HOST = process.env.TINYBIRD_HOST ?? "https://api.tinybird.co";
const INGEST_TOKEN = process.env.TINYBIRD_INGEST_TOKEN!; // the events_append token

type AppEvent = { userId: string; eventType: string; properties?: Record<string, unknown> };

export async function trackEvents(events: AppEvent[]) {
  const now = new Date().toISOString().slice(0, 19).replace("T", " "); // 2026-10-24 17:05:09
  const body = events
    .map((e) =>
      JSON.stringify({
        event_id: crypto.randomUUID(),
        user_id: e.userId,
        event_type: e.eventType,
        properties: JSON.stringify(e.properties ?? {}),
        timestamp: now,
      })
    )
    .join("\n");

  const res = await fetch(`${TINYBIRD_HOST}/v0/events?name=events`, {
    method: "POST",
    headers: { Authorization: `Bearer ${INGEST_TOKEN}` },
    body,
  });
  if (!res.ok) throw new Error(`Tinybird ingest failed: ${res.status} ${await res.text()}`);
  return res.json(); // { successful_rows: 2, quarantined_rows: 0 }
}

await trackEvents([
  { userId: "usr_8f3a21", eventType: "page_view", properties: { page: "/pricing" } },
  { userId: "usr_8f3a21", eventType: "button_click", properties: { button: "start-trial" } },
]);

Responses: 202 means accepted but not yet committed; add &wait=true for a 200 after the write is acknowledged (slower, use a timeout of 10 seconds or more). 400 and 403 must not be retried; 413 means the body is too big (10 MB on Free, 100 MB on paid plans); 429 means over the default 100 requests per second per Data Source, so back off with Retry-After. The API is not idempotent: a retried batch can insert duplicates. Check quarantined_rows in the answer: rows that do not match the schema land in the events_quarantine table instead of failing the request.

Pipes that become Endpoints

A Pipe is an Endpoint only when it ends with TYPE endpoint. Start the SQL block with % so the parameters are parsed.

# tinybird/endpoints/daily_active_users.pipe
TOKEN dashboard_read READ

DESCRIPTION >
    Daily active users for the last N days

NODE daily_counts
SQL >
    %
    SELECT to
Полный SKILL.md на GitHub

Установить tinybird в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл tinybird?

Build real-time analytics APIs with Tinybird — ingest millions of events and query with SQL over HTTP. Use when someone asks to "build analytics API", "Tinybird", "real-time analytics", "event analytics", "ClickHouse as a service", "usage metering", or "product analytics backend". Covers data ingestion, SQL pipes, API endpoints, and real-time dashboards.

Как установить скилл tinybird?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tinybird запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить tinybird с