Claude Skills Guide

Real-time analytics has become essential for modern applications, from monitoring user behavior to detecting anomalies in production systems. Tinybird provides a powerful streaming analytics platform that enables developers to build data pipelines with sub-second latency. When combined with Claude Code, you can automate the entire workflow—from schema design to query optimization—making real-time analytics more accessible than ever.

This guide walks you through building a complete Tinybird real-time analytics workflow using Claude Code, with practical examples and actionable advice you can apply to your own projects.

Understanding the Tinybird Workflow

Tinybird works by ingesting data through various sources (HTTP APIs, Kafka, S3, etc.), processing it through pipes (which are similar to SQL views but more powerful), and exposing results via a REST API. The key components you’ll work with are:

Claude Code can help you design schemas, write efficient SQL transformations, and even generate the code needed to integrate with your data sources.

Setting Up Your Project with Claude Code

Before diving into code, ensure you have the Tinybird CLI installed and authenticated. You can install it via npm:

npm install -g tinybird-cli
tb auth --token YOUR_TINYBIRD_TOKEN

Once authenticated, you can use Claude Code to scaffold your analytics project. Start by creating a new directory and initializing a Tinybird project:

mkdir analytics-workflow && cd analytics-workflow
tb init

Claude Code can then help you generate the necessary configuration files and directory structure. Simply describe your analytics needs in natural language, and Claude will create the appropriate .tinybird files with data source definitions, pipe configurations, and endpoint specifications.

Designing Your Data Schema

The foundation of any real-time analytics workflow is a well-designed schema. When working with Tinybird, you need to consider both the data format (JSON, CSV, Parquet) and the column types that will optimize query performance.

For example, if you’re tracking user events, your schema might look like:

{
  "name": "events",
  "columns": [
    {"name": "event_id", "type": "String"},
    {"name": "user_id", "type": "String"},
    {"name": "event_type", "type": "String"},
    {"name": "timestamp", "type": "DateTime64(3)"},
    {"name": "properties", "type": "JSON"},
    {"name": "session_id", "type": "String"}
  ]
}

Claude Code can analyze your data patterns and recommend optimal column types. For instance, it might suggest using LowCardinality for categorical fields like event_type to improve compression and query speed. It can also identify opportunities to use AggregateFunction columns for pre-computed metrics.

Building Real-Time Pipes

Pipes are Tinybird’s transformation layer, allowing you to filter, aggregate, and enrich your data in real-time. Here’s a practical example of a pipe that calculates user activity metrics:

NODE source
SQL >
  SELECT
      toDate(timestamp) as date,
      user_id,
      event_type,
      count() as event_count
  FROM events
  GROUP BY date, user_id, event_type

NODE daily_stats
SQL >
  SELECT
      date,
      user_id,
      sum(event_count) as total_events,
      uniqExact(event_type) as unique_event_types
  FROM source
  GROUP BY date, user_id

Claude Code can help you write these pipes by explaining Tinybird’s SQL dialect and suggesting optimizations. For instance, it might recommend using SAMPLE clauses for faster development or explain when to use ORDER BY within nodes to improve performance.

Automating Data Ingestion

Getting data into Tinybird in real-time is crucial for actionable analytics. The HTTP endpoint approach is straightforward—Tinybird provides a push API where you can POST JSON data directly:

curl -X POST \
  https://api.tinybird.co/v0/events?name=events \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"event_id":"evt_123","user_id":"user_456","event_type":"click","timestamp":"2026-03-15T10:30:00.000Z","properties":{"page":"/dashboard"}}'

For production systems, you might integrate with Kafka, Amazon Kinesis, or other streaming platforms. Claude Code can generate the producer code you need, whether you’re using Python, Node.js, or another language. Simply describe your source system, and Claude will provide the integration code with proper error handling and retry logic.

Creating API Endpoints

Once your data is flowing and your pipes are processing it, you need to expose the results via API endpoints. Endpoints are defined within pipes and can return JSON, CSV, or even ndJSON (newline-delimited JSON) for streaming results.

Here’s an endpoint that returns hourly active users:

NODE hourly_active_users
SQL >
  SELECT
      toStartOfHour(timestamp) as hour,
      count(distinct user_id) as active_users
  FROM events
  WHERE timestamp >= now() - interval 24 hour
  GROUP BY hour
  ORDER BY hour DESC

ENDPOINT GET hourly-active-users

The endpoint becomes available at https://api.tinybird.co/v0/pipes/hourly_active_users. You can then consume this in your frontend application or integrate it with your monitoring dashboards.

Optimizing Performance

Real-time analytics only deliver value when they’re fast. Claude Code can help you identify and resolve performance bottlenecks in your Tinybird workflow:

  1. Materialized Views: For frequently queried aggregations, create materialized views that pre-compute results. Claude can generate the SQL and help you set up refresh strategies.

  2. Partitioning: Large tables should be partitioned by date or another high-cardinality column. This reduces the data scanned per query.

  3. Indexing: Tinybird supports skip indexes for JSON columns and set skip indexes for low-cardinality columns.

  4. Query Optimization: Review your query patterns. Ensure filters are applied early, and avoid expensive operations like large JOINs in hot paths.

Monitoring and Observability

A robust analytics workflow requires monitoring. Tinybird provides built-in metrics for endpoint performance, but you should also implement application-level monitoring:

Claude Code can generate the monitoring code and help you set up dashboards in tools like Grafana or Datafold.

Conclusion

Building real-time analytics with Tinybird and Claude Code is a powerful combination. Claude Code acts as your development partner, helping you design schemas, write optimized SQL, generate integration code, and troubleshoot issues. Meanwhile, Tinybird handles the heavy lifting of processing millions of events per second with sub-second latency.

Start small—ingest a single event type and expose one endpoint. As your confidence grows, expand to more complex transformations and multiple data sources. With this workflow, you’ll be building production-grade real-time analytics in no time.

Built by theluckystrike — More at zovo.one