kysely

Best practices for Kysely, the type-safe TypeScript SQL query builder. Use when writing queries, defining database types, creating migrations, or integrating Kysely with PostgreSQL, MySQL, or SQLite.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "kysely" with this command: npx skills add rommelandrea/skills/rommelandrea-skills-kysely

When to use

Use this skill when you need to:

  • Build type-safe SQL queries with Kysely
  • Define database interfaces and column types
  • Write and run Kysely migrations
  • Handle transactions, error recovery, and connection pooling
  • Load related data efficiently (JSON aggregation, avoiding N+1)
  • Use raw SQL safely within Kysely
  • Test code that uses Kysely

How to use

Read individual rule files for detailed explanations and code examples:

Core principles

  • Type safety end-to-end: Define database interfaces, let Kysely infer query result types
  • Narrow selects: Select only the columns you need — avoid selectAll()
  • Parameterized queries: Always use the sql template tag — never concatenate user input
  • Single instance: Create one Kysely instance per database, reuse it everywhere
  • Thin abstraction: Kysely compiles to SQL 1:1 — learn the SQL it generates
  • Expression builder first: Prefer eb callbacks over raw SQL for type-safe dynamic expressions

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

typescript

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

typescript

No summary provided by upstream source.

Repository SourceNeeds Review
General

kysely

No summary provided by upstream source.

Repository SourceNeeds Review
General

postgres

No summary provided by upstream source.

Repository SourceNeeds Review