webui-dev
Skill93 starsChanged 6 months agoMITView on GitHub
Build interactive WebUI apps with compiled-template hydration, template syntax, component patterns, and CLI usage.
In this repository11 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- webui-referenceSkill
- bump-versionSkill
- code-reviewSkill
- create-exampleSkill
- diagnosticsSkill
- docs-syncSkill
- perfSkill
- prSkill
- quality-gateSkill
- testingSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this skill when building or modifying WebUI applications.
- Very specific: line 12
The template is the UI: All structure lives in .html.
- Very specific: line 13
CSS owns all styling and animation: Never el.style.x =, classList.toggle, or adoptedStyleSheets.
- Distinctive: line 17
HTML, CSS, TypeScript are separate files: No JSX. No CSS-in-JS. No JS in templates.
- Distinctive: line 34
Add a class only when something interactive happens:
- Very specific: line 62
Read that file before generating any WebUI code.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
WebUI App Development
Use this skill when building or modifying WebUI applications.
Critical rules (memorize these)
- The template is the UI. All structure lives in
.html. Neverdocument.createElement,innerHTML,insertAdjacentHTML, orappendChild. Show/hide with<if>, repeat with<for>. The only exception is mounting a lazily loaded component. - CSS owns all styling and animation. Never
el.style.x =,classList.toggle, oradoptedStyleSheets. Bind?data-active="{{expr}}"and select[data-active]in CSS. Animate withtransition,@keyframes,@starting-style- neverelement.animate()or a JS animation library. - JavaScript is opt-in. A component needs no
.tsfile unless it has an@event, aw-reffor an imperative API, a lifecycle hook, a fetch, or a public method API.WebUIElement,@observable, and@attrare optional - add them only when TypeScript reads/writes the value or it is public API. Otherwise the value belongs in the server state JSON. - Use the web platform.
<dialog>over a div modal,popoverover a JS dropdown,<details>over a JS accordion. Prefer:has(),@container,color-mix(),light-dark(),content-visibility. - Every template binding must exist in the server state JSON. Missing keys render empty, silently.
- HTML, CSS, TypeScript are separate files. No JSX. No CSS-in-JS. No JS in templates.
- Unwrapped components default to Shadow;
--dom lightmakes them global Light DOM while authored open wrappers stay Shadow. A sole bare top-level<template>explicitly selects Light and is unwrapped even under the Shadow fallback. Light CSS uses ordinary selectors in its owning CSS tree. Use one sole top-level<template shadowrootmode="open">when the component needs native<slot>projection, Shadow encapsulation, CSS-heavy frequent restyling, root host events, or Shadow-only selectors such as:host. A<slot>and:hostfail only in an effective Light component. - Components inside
<for>loops do NOT inherit loop variables. Pass data via attributes. - Text bindings are path lookups; comparisons belong in conditions.
{{count}}and{{user.name}}resolve a dotted state path - nothing else.{{count > 0}}is looked up as a key literally namedcount > 0and renders empty. Comparisons go in<if condition="count > 0">or?active="{{section == 'guide'}}". Operators:==,!=,<,>,<=,>=,&&,||,!. Forbidden everywhere: ternary (? :), function calls, arithmetic (items.length - 1resolves as a path and silently fails - send a precomputedlastIndex), mixing&&with||, more than 5 logical operators. w-refrequires braces.w-ref="{inputEl}", neverw-ref="inputEl"- non-braced fails the build withinvalid-w-ref. Use it only for imperative APIs (focus, scroll,showModal), never to read state.@attr({ mode: 'boolean' })for true/false. Present = true, absent = false. Never use string"false".
Quick reference
Most components need only HTML and CSS:
<!-- user-card.html - no .ts file -->
<h2>{{user.name}}</h2>
<if condition="user.isAdmin"><span class="badge">Admin</span></if>Add a class only when something interactive happens:
import { WebUIElement, attr, observable } from '@microsoft/webui-framework';
export class MyComponent extends WebUIElement {
@attr label = ''; // set by a parent template
@attr({ mode: 'boolean' }) disabled = false;
@observable count = 0; // mutated by increment()
inputEl!: HTMLInputElement; // populated by w-ref="{inputEl}"
increment(): void { this.count += 1; }
onKeydown(e: KeyboardEvent): void { if (e.key === 'Enter') this.submit(); }
}
MyComponent.define('my-component');webui build ./src --out ./dist --plugin=webui
webui serve ./src --state ./data/state.json --plugin=webui --watchFull reference
The complete guide covering all template syntax, styling and animation rules, anti-patterns, routing, and a pre-flight checklist:
docs/ai.md
Read that file before generating any WebUI code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

