An open API service indexing awesome lists of open source software.

https://github.com/codincat/kysely-prompt

A prompt to help AI (LLM) learn how to use Kysely. You may also want to give DeepWiki a try https://deepwiki.com/kysely-org/kysely
https://github.com/codincat/kysely-prompt

db kysely postgresql prompt

Last synced: 8 months ago
JSON representation

A prompt to help AI (LLM) learn how to use Kysely. You may also want to give DeepWiki a try https://deepwiki.com/kysely-org/kysely

Awesome Lists containing this project

README

          

# kysely-prompt

[Kysely](https://github.com/kysely-org/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](./kysely-postgresql.txt) 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?
>
> ```sql
> 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