Guide
LLMs and agents
Teach your coding agent Slab with the skill in the package, and point any LLM at these docs as Markdown.
01 Why bother?
Ask an agent for a Select and it'll often reach for a React library's API: an onChange prop, an isOpen, a controlled value. Slab has none of that. It works like a native element, and the agent writes better code when it knows that. So Slab ships with what it needs to know.
02 Add the skill
Slab comes with an agent skill, a folder of instructions your agent reads when it's working with Slab. It works with Claude Code, Cursor, Codex, GitHub Copilot and the rest of the agents that read skills. Add it with one command from your project.
npx skills add ynotdraw/slab-elements --skill slab
It asks which agents to add it to, and puts it where each one looks. Add -g to add it for all your projects.
03 Or copy it from the package
The skill is in the package too, at skills/slab, so the one you copy matches the version you've installed. That command takes it from GitHub instead, so it's the latest. Copy it into wherever your agent looks for skills, such as .claude/skills for Claude Code, and copy it again after you upgrade.
mkdir -p .claude/skills
cp -R node_modules/slab-elements/skills/slab .claude/skills/
04 What's in it
The advice is written by hand. The reference is built from Slab's own source each release, so it can't drift from the code.
-
Picking a component
Every component, grouped as on this site, with the native element it's built on and what it's for.
-
The native way
Attributes in, events out,
labelon every control,showModal(),multipleandvalues, and the rest of what makes Slab work like the platform. -
Forms, styles and frameworks
Form association and validity,
::part()and:state(), subclassing, React 19, Vue, Svelte, Ember and server rendering. -
A page per component
Its imports, usage and keyboard, and every attribute, property, method, event, slot, part and state, from
custom-elements.json.
It also says what not to do. Don't add role or aria-* to fix an element, don't invent attributes, and don't test in jsdom.
05 llms.txt
Using a chat rather than an agent? llms.txt follows the llms.txt proposal: a short summary of Slab, then a link to every page on this site with a line about each. Hand it to an LLM and it can find the page it needs.
Is your tool one that doesn't follow links? llms-full.txt is every page on this site in one file, so it has the whole thing at once. It leaves out the styled examples' source, but it's still big, so save it for tools that can't fetch pages.
06 Every page as Markdown
Each page here has a Markdown twin with the same content, at the same address ending in .md, like Get started's. Every guide and component page has a Copy page button under its title for pasting into a chat, and a link to view it.
07 Let your tools check the work
Agents still make mistakes. Your type checker catches a lot of them. Import your framework's types once, as TypeScript shows, and a made-up attribute or a misspelled event is an error before it ships. Your editor can autocomplete Slab's tags and attributes in plain HTML too, once it's set up. Tools that read custom elements can use slab-elements/custom-elements.json, the manifest the skill is built from.