kysely-postgres

Construct type-safe PostgreSQL queries and migrations with Kysely in Node.js/TypeScript.

1|Updated Jan 2, 2026
One-click install
npx skills add https://github.com/gallop-systems/claude-skills --skill kysely-postgres
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kysely-postgres
Source: https://github.com/gallop-systems/claude-skills/tree/main/skills/kysely-postgres
Command: npx skills add https://github.com/gallop-systems/claude-skills --skill kysely-postgres

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write safe, expressive PostgreSQL queries in Node.js/TypeScript projects using Kysely, reducing runtime SQL errors and enabling robust data access patterns.

Core Features & Use Cases

  • Type-safe query patterns: select, where, joins, aggregates, and advanced expressions using the Kysely Expression Builder.
  • Migrations and schema evolution: define migrations, up/down scripts, and safe column types with type-checked builders.
  • JSONB and array handling: work with JSON/JSONB and array columns natively without manual string parsing.
  • Complex relations and subqueries: nested json helpers (jsonArrayFrom/jsonObjectFrom) and subquery joins to fetch related data in a single query.
  • Pitfalls and best practices: guidance on type generation, performance, and TS inference.

Quick Start

Install and configure Kysely with PostgreSQL in your Node.js project. Then begin using the patterns described above to craft type-safe queries and migrations.

Frequently Asked Questions about kysely-postgres

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write type-safe PostgreSQL queries in a Node.js project?

Type-safe PostgreSQL querying in Node.js uses Kysely builders to construct queries, enabling robust data access patterns and reducing runtime SQL errors. The Skill provides patterns for complex query construction, advanced joins, and aggregates.

What is the best way to handle JSONB columns natively in TypeScript?

JSONB handling in TypeScript is achieved natively through Kysely without manual string parsing. This Skill provides specific patterns to work with JSON/JSONB and array columns directly within your type-safe queries.

How do I fetch complex relations in a single PostgreSQL query using Kysely?

Fetching complex relations in a single query uses nested JSON helpers like jsonArrayFrom and jsonObjectFrom. These patterns allow you to construct subquery joins and retrieve related data efficiently without multiple round-trips.

How do I manage database migrations and schema evolution with Kysely?

Managing migrations with Kysely involves defining up/down scripts and safe column types using type-checked builders. This Skill covers schema evolution patterns to ensure your database changes remain type-safe and consistent.

What are common TypeScript inference pitfalls when building advanced SQL expressions?

Common TypeScript inference pitfalls occur during type generation, performance optimization, and advanced expression building. This Skill outlines best practices and precautions to avoid these issues when using the Kysely Expression Builder.