Stanislav Khromov

With the release of Svelte 5 and its new runes syntax, many developers are wondering how to get reliable AI assistance that understands the latest features in Svelte 5 working with ChatGPT, Claude, Continue, Cursor and other tools.

The challenge with AI and new frameworks

When a new major framework version is released, AI tools often struggle to provide accurate code samples since they were trained on older documentation. This creates two main problems:

  1. The AI may not know about new features at all, since the new feature was added after the LLMs cut-off date
  2. Even if it does know about them, it often mixes old and new syntax due to having seen more examples of the older version

The official solution: llms.txt

As part of Advent of Svelte 2024, Svelte introduced official support for AI tools through standardized documentation files. This is now the recommended way to help AI tools understand Svelte 5 and SvelteKit.

You can find these files directly on svelte.dev:

The minimal version is optimized for AI tools with more limited context windows and some information has been omitted, while the full version contains the entire documentation.

Using the documentation with AI tools

To use these files with your preferred AI assistant:

  1. Download appropriate documentation file
  2. Share it with your AI tool at the start of the conversation, for example by including the text file in the context using a tool like Cursor or Continue, or upload the documentation to Claude Projects. Many of these tools also provide ways to add documentation.

Note: Many tools that let you upload documentation use RAG instead of a full-context approach. This severely degrades the performance of the llms.txt files. Make sure the entire documentation is loaded into the context of the LLM for best results.

Results

In testing, providing the official documentation to AI tools leads to much better results. The AI correctly uses runes syntax, understands new features like error boundaries, and can help with both Svelte 5 and SvelteKit code.

If you want to see a hands-on with this approach, we build several cool features and a tic tac toe game using the latest version of the docs and Claude Projects in the video below. In the video we use the older svelte-llm site, which was used as the basis for the official feature, so you can use them interchangeably!

Looking ahead

This official approach to AI documentation is a great step forward for the Svelte ecosystem. As more frameworks adopt similar standards, we’ll likely see improved AI assistance across the board.

Have you tried using AI tools with Svelte 5? How has your experience been? Let me know in the comments below!

πŸ‡ΈπŸ‡ͺ Full-stack impostor syndrome sufferer & Software Engineer at Schibsted Media Group

View Comments

There are currently no comments.

Next Post