
Tinybird Typescript Sdk Guidelines
Define type-safe Tinybird datasources, pipes, and clients in TypeScript instead of juggling legacy .datasource/.pipe files by hand.
Overview
Tinybird TypeScript SDK Guidelines is an agent skill for the Build phase that teaches type-safe @tinybirdco/sdk datasource, pipe, and client setup with CLI deploy workflows.
Install
npx skills add https://github.com/tinybirdco/tinybird-agent-skills --skill tinybird-typescript-sdk-guidelinesWhat is this skill?
- Covers @tinybirdco/sdk install, init, dev, build, deploy, and preview CLI flows
- Rule files for datasources, endpoints, typed client, materialized views, copy/sink pipes, and tokens
- Type-safe ingestion and queries with full inference in TypeScript projects
- Migration path from legacy .datasource/.pipe definitions to SDK resources
- Connection patterns for Kafka, S3, and GCS
- 12 referenced rule files from getting-started through tokens
- CLI surface includes dev, build, deploy, and preview commands
Adoption & trust: 513 installs on skills.sh; 19 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want Tinybird analytics in a TypeScript codebase but legacy pipe files and untyped HTTP calls keep breaking schemas and deploys.
Who is it for?
Indie SaaS or API builders migrating to or starting on the Tinybird TypeScript SDK with agent-assisted scaffolding.
Skip if: Pure SQL-only BI users, non-TypeScript stacks, or teams that only need dashboard design without ingestion code.
When should I use this skill?
Use when working with @tinybirdco/sdk, TypeScript Tinybird projects, or type-safe data ingestion and queries.
What do I get? / Deliverables
You ship SDK-defined datasources, endpoints, and typed clients with documented CLI dev/build/deploy steps and optional cloud connection wiring.
- SDK-defined datasources and pipes
- Typed Tinybird client usage
- Documented dev/build/deploy workflow
Recommended Skills
Journey fit
Tinybird SDK work happens while wiring analytics ingestion and query APIs into the product—core build-time integration. Integrations is the right shelf because the skill centers on @tinybirdco/sdk, connections, and deployable data plane resources.
How it compares
Typed SDK integration guide—not a hosted Tinybird substitute and not a generic ORM skill.
Common Questions / FAQ
Who is tinybird-typescript-sdk-guidelines for?
TypeScript developers and agent users building on Tinybird who want inferred types across ingestion, pipes, and client calls.
When should I use tinybird-typescript-sdk-guidelines?
During Build while adding or refactoring Tinybird datasources, endpoints, connections, and deploy pipelines in a TypeScript monorepo or service.
Is tinybird-typescript-sdk-guidelines safe to install?
It may encourage deploy and token patterns—rotate secrets locally, limit CI tokens, and review the Security Audits panel on this Prism page before production deploys.
SKILL.md
READMESKILL.md - Tinybird Typescript Sdk Guidelines
# Tinybird TypeScript SDK Guidelines Guidance for using the `@tinybirdco/sdk` package to define Tinybird resources in TypeScript with complete type inference. ## When to Apply - Installing or configuring @tinybirdco/sdk - Defining datasources or pipes in TypeScript - Creating typed Tinybird clients - Using type-safe ingestion or queries - Running tinybird dev/build/deploy commands for TypeScript projects - Migrating from legacy .datasource/.pipe files to TypeScript - Defining connections (Kafka, S3, GCS) - Creating materialized views, copy pipes, or sink pipes ## Rule Files - `rules/getting-started.md` - `rules/configuration.md` - `rules/defining-datasources.md` - `rules/defining-endpoints.md` - `rules/typed-client.md` - `rules/low-level-api.md` - `rules/cli-commands.md` - `rules/connections.md` - `rules/materialized-views.md` - `rules/copy-sink-pipes.md` - `rules/tokens.md` ## Quick Reference - Install: `npm install @tinybirdco/sdk` - Initialize: `npx tinybird init` - Dev mode: `tinybird dev` (uses configured `devMode`, typically branch) - Build: `tinybird build` (builds against configured dev target) - Deploy: `tinybird deploy` (deploys to main/production) - Preview in CI: `tinybird preview` - Server-side only; never expose tokens in browsers # Defining Endpoints (Pipes) ## Basic Endpoint Definition ```typescript import { defineEndpoint, node, t, p, type InferParams, type InferOutputRow } from "@tinybirdco/sdk"; export const topPages = defineEndpoint("top_pages", { description: "Get the most visited pages", params: { start_date: p.dateTime(), end_date: p.dateTime(), limit: p.int32().optional(10), }, nodes: [ node({ name: "aggregated", sql: ` SELECT pathname, count() AS views FROM page_views WHERE timestamp >= {{DateTime(start_date)}} AND timestamp <= {{DateTime(end_date)}} GROUP BY pathname ORDER BY views DESC LIMIT {{Int32(limit, 10)}} `, }), ], output: { pathname: t.string(), views: t.uint64(), }, }); export type TopPagesParams = InferParams<typeof topPages>; export type TopPagesOutput = InferOutputRow<typeof topPages>; ``` ## Parameter Types The `p` object provides parameter definitions: - `p.string()` - String parameter - `p.int32()`, `p.int64()` - Integer parameters - `p.float32()`, `p.float64()` - Float parameters - `p.dateTime()` - DateTime parameter - `p.date()` - Date parameter ## Parameter Modifiers - `.optional(defaultValue)` - Make parameter optional with a default value Example: ```typescript params: { limit: p.int32().optional(10), filter: p.string().optional(""), } ``` ## Multi-Node Pipes Define multiple nodes for complex transformations: ```typescript nodes: [ node({ name: "filtered", sql: ` SELECT * FROM events WHERE timestamp >= {{DateTime(start_date)}} `, }), node({ name: "aggregated", sql: ` SELECT date, count() as total FROM filtered GROUP BY date `, }), ], ``` ## SQL Templating Use Tinybird templating in SQL: - `{{Type(param_name)}}` - Parameter with type - `{{Type(param_name, default)}}` - Parameter with default value ```sql WHERE user_id = {{String(user_id)}} AND date >= {{Date(start_date, '2024-01-01')}} LIMIT {{Int32(limit, 100)}} ``` ## Type Inference ```typescript export type TopPagesParams = InferParams<typeof topPages>; // Results in: { start_date: Date; end_date: Date; limit?: number } export type TopPagesOutput = InferOutputRow<typeof topPages>; // Results in: { pathname: string; views: bigint } ``` # Public Tinybird API (Low-Level) For cases requiring a decoupled API wrapper without the typed client: ## Creating