Skip to content

CodinCat/kysely-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

kysely-prompt

Kysely is a very powerful query builder, but due to my skill issue, writing more complex queries can sometimes be frustrating.

This repo is just a prompt to help LLMs learn how to write queries using Kysely. All the examples are just copied and pasted from official documentation or GitHub issues, with some tweaks to save tokens. I hand-picked different examples to make sure they're diverse enough to cover most common use cases, and sufficient for AI to learn the patterns/APIs of Kysely. For now, it's PostgreSQL only.

Usage

Just feed this prompt to the AI of your choice, and then you'll have a personal Kysely expert to help you write queries.

The prompt has around 10,300 - 12,000 tokens. Note that on chatgpt.com, free users only get an 8K context window. I recommend Gemini 2.5 Pro, which has an 1M context window and you can use for free at https://aistudio.google.com/

For example, you can ask questions like:

How to do an upsert with the following table?

CREATE TABLE products (
    sku VARCHAR(50) PRIMARY KEY,
    name text NOT NULL,
    quantity INTEGER NOT NULL DEFAULT 0,
    last_updated TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

You can also use it locally with something like Claude Code. The easiest way is just to put the prompt file in your project like docs/kysely.md, and then @ that file when you need to write some queries. You may want to remove some of the instructions at the beginning.

There is another modern tool called DeepWiki, it may also be helpful: https://deepwiki.com/kysely-org/kysely

About

A prompt to help AI (LLM) learn how to use Kysely

Topics

Resources

Stars

Watchers

Forks