CLI

The library ships a command line tool with one job: hand your coding assistant the rules it cannot guess. It is a single command, it writes a pointer rather than a copy, and everything it does can be undone by deleting a few lines.

The Command

Run it in your project root, after theui-svelte is installed:

Your project root
npx theui ai

It reports what it touched, so you can see exactly what changed:

Output
  theui-svelte · AI rules

  ✓ AGENTS.md                        created    the AGENTS.md standard
  ✓ CLAUDE.md                        updated    Claude Code
  ✓ .github/copilot-instructions.md  updated    GitHub Copilot

  Your agent now reads node_modules/theui-svelte/AGENTS.md.
  Start a new agent session to pick it up.

Start a new session in your assistant afterwards. Instruction files are read when a session begins, so one already running will not see the change.

Why A Command At All

The rules themselves ship inside the package, at node_modules/theui-svelte/AGENTS.md. The problem is that no coding agent reads them from there. Every one of them looks for instructions in a project root, and none promises to look inside node_modules.

So something has to connect the two. The command writes that connection into the files your tools already read — which is work you can also do by hand in about a minute, and AI coding assistants shows how.

What It Writes

A short block, between two HTML comment markers, naming the path to the rules:

AGENTS.md
<!-- theui-svelte:start -->

## theui-svelte v3.1.0

This project builds its UI with **theui-svelte**, a Svelte 5 component library on
Tailwind CSS v4.

Before writing or changing any code that uses one of its components, read:

`node_modules/theui-svelte/AGENTS.md`

That file carries what the type definitions cannot - which component to reach for,
how the compound families compose, which children throw without their parent, and
the gotchas that fail silently rather than erroring.

Prop names and types are in the bundled `.d.ts` files, so trust those for the shape
of a component and the file above for the intent behind it.

Documentation as Markdown: https://www.theui.dev/svelte/llms.txt

<!-- theui-svelte:end -->

A pointer, not a copy, for two reasons. It cannot overwrite rules you wrote yourself, because it only ever adds its own block to the end of a file. And it cannot go stale: upgrading the library upgrades what your assistant reads, with nothing to refresh.

In a CLAUDE.md the block carries one extra line, @node_modules/theui-svelte/AGENTS.md, because Claude Code resolves that as a real import and pulls the rules in rather than looking them up later.

Which Files It Touches

Only the tools your project shows a sign of. A CLAUDE.md written into a project that does not use Claude Code would be noise, so the command does not create one.

FileToolWhen
AGENTS.md Codex, Cursor, Copilot, Zed, Aider, Jules Always. Created if missing, since one file has to carry the pointer.
CLAUDE.md Claude Code If the file already exists.
.github/copilot-instructions.md GitHub Copilot in VS Code If the file already exists.
.cursor/rules/theui-svelte.mdc Cursor If a .cursor folder exists.
.windsurf/rules/theui-svelte.md Windsurf If a .windsurf folder exists.
GEMINI.md Gemini CLI If the file or a .gemini folder exists.

AGENTS.md alone covers most of the ecosystem: it is a published convention rather than one vendor's format, and Claude Code falls back to it when a project has no CLAUDE.md. The rest of the table is for the tools that keep their own file.

Options

OptionWhat it does
none Writes the pointer. This is the normal choice.
--copy Copies the rules to .theui-svelte/AGENTS.md and points there instead. For a project that would rather commit the rules, or one whose agents run before anyone has installed anything.
--dry Prints what would change and writes nothing. Works with either of the above.
-h, --help The usage summary.
-v, --version The installed library version.

Look before you leap, if you would rather:

See the changes without making them
npx theui ai --dry

The command is also published as npx theui-svelte ai, which is the same tool under the package's own name. Use whichever reads better; theui is the one these pages use.

Running It Again, And Undoing It

Re-running is safe and is the right thing to do after an upgrade. The block names the version it was written for, so the command replaces the old one in place rather than adding a second copy, and tells you nothing changed when nothing needed to:

Already current
  theui-svelte · AI rules

  · AGENTS.md  unchanged  the AGENTS.md standard
  · CLAUDE.md  unchanged  Claude Code

  Everything was already current for v3.1.0.

To undo it, delete the block between <!-- theui-svelte:start --> and <!-- theui-svelte:end -->. Nothing else in the file is ever touched, and the two files the command owns outright — the Cursor and Windsurf rules — can simply be deleted.

When It Cannot Find The Library

The command points at the installed package, so it needs the package to be there. If it is not, it says so rather than writing a path that leads nowhere:

Nothing installed yet
  theui-svelte is not installed here.

  Run npm i theui-svelte first.
  Or pass --copy to write the rules into the project rather than
  pointing at the installed package.

It also stops if there is no package.json beside you, which almost always means the terminal is in the wrong folder.