LLMs
Kysely provides LLM-friendly documentation to help AI tools like Cursor, Windsurf, GitHub Copilot, ChatGPT, Claude, and Claude Code understand and work with it.
Documentation for the installed version
Kysely's API documentation and examples ship inside the package's TypeScript declarations. An agent with access to your dependencies or language server can read the documentation attached to the method it is calling, including query examples, SQL output, related methods, and deprecations.
Those docs travel with the installed release. Reading them avoids a common source of agent mistakes: combining an older dependency with examples from a newer website or a model's memory. Interface documentation is also copied onto implementing methods, so following a method definition exposes its documentation.
The inline TypeScript examples are type-checked in CI against the API being released, rather than maintained as a separate collection of unchecked snippets. The published package keeps those examples alongside that version's types.
For agent experience (AX), this gives the agent a direct loop:
- Resolve the installed
kyselypackage and read the relevant method's documentation and examples. - Build or extend the query using the project's database types.
- Run the project's TypeScript check and use errors about references, aliases, values, or result fields to correct the query.
For example, an agent adding an optional relation can inspect the local $if, join, and selection documentation, then let TypeScript check how the new branch affects the result. It can obtain API guidance for the installed version without a browser, documentation server, or extra agent integration.
Website documentation
Use the website's recipes and documentation index for broader discovery, and the installed package for version-specific API details.
The website's playground examples are generated from the same annotated JSDoc. API documentation and website examples share their source, rather than relying on separately maintained copies.
All TypeScript code blocks on the website are type-checked when the site builds, against the Kysely source they document. A snippet that stops compiling fails the build, and hovering an identifier shows its inferred type and documentation.
llms.txt documentation is automatically generated and kept up-to-date with each push on GitHub and is based on the llms.txt standard.
We audit the website's agent experience with AFDocs, the tool behind Mintlify's Agent Score.
Documentation Structure
The llms.txt file acts as a summary and index to all the docs pages.
The llms-full.txt file includes all of the Kysely docs in a single file.
Usage with AI Tools
Cursor
In Cursor, you can reference the documentation using the @Docs feature:
- Type
@Docsin your prompt - Reference the Kysely documentation URL:
https://kysely.dev/llms-full.txt - Ask questions about Kysely queries, types, or database operations
Windsurf
For Windsurf users:
- Reference the documentation using
@https://kysely.dev/llms-full.txt - Or add it to your
.windsurfrulesfile for persistent access
ChatGPT & Claude
When using ChatGPT or Claude:
- Mention that you're using Kysely
- Reference the documentation URL:
https://kysely.dev/llms-full.txt - The AI will fetch and use the documentation to provide accurate answers
GitHub Copilot
While Copilot doesn't directly support external documentation, you can:
- Include relevant documentation snippets in your comments
- Reference query builder methods and types accurately for better suggestions
Claude Code
For Claude Code users:
- Reference the documentation by mentioning the URL:
https://kysely.dev/llms-full.txt - Ask Claude Code to analyze the documentation for specific Kysely patterns
- Use commands like:
claude -p "Using the Kysely docs at https://kysely.dev/llms-full.txt, help me build a type-safe query"
Example Prompts
Here are some example prompts you can use with AI tools:
- "Using Kysely, how do I build a type-safe SELECT query with JOINs?"
- "Show me how to define a database schema interface for Kysely"
- "How can I use transactions with Kysely?"
- "Create a complex query with subqueries and aggregations"
- "How to handle database migrations with Kysely?"