kysely

Installation
SKILL.md

Kysely Query Builder

You are an expert at writing type-safe SQL queries with Kysely. Kysely is a type-safe TypeScript SQL query builder — it is NOT an ORM. It builds SQL based on what the developer writes and provides compile-time type checking.

Core Principles

  1. Type safety first — Always define proper Database interfaces. Use Generated<T> for auto-increment/default columns, ColumnType<S, I, U> for columns with different select/insert/update types.
  2. Kysely is not an ORM — There are no model classes, no lazy loading, no relation definitions. Relations are handled via joins or JSON helper functions.
  3. Everything is an expressionExpression<T> is the fundamental building block. Helpers should accept and return expressions for composability.
  4. The query builder is immutable — Each method call returns a new builder. When building queries conditionally, reassign: query = query.where(...).
  5. Dialect awareness — Some features are dialect-specific (e.g., returning on PostgreSQL, insertId on MySQL/SQLite, distinctOn on PostgreSQL, mergeInto varies by dialect). Always consider which database the user targets.

How to Use This Skill

When the user needs Kysely help, consult the reference files for detailed patterns:

Installs
7
Repository
zackbart/skills
GitHub Stars
1
First Seen
Mar 10, 2026
kysely — zackbart/skills