frontend-lit
Use when the user asks about Lit, LitElement, lit-html templates, reactive properties, Lit decorators, Lit context or Lit SSR. Produces typed Lit web…
от j4flmao★ 47 звёзд на GitHub
Установить frontend-lit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Lit
Purpose
Build standard web components with Lit: reactive properties, shadow DOM templates, typed events, and SSR-compatible rendering.
Agent Protocol
Trigger
Exact user phrases: "Lit", "LitElement", "lit-html", "web component Lit", "reactive element", "@lit/reactive-element", "Lit SSR", "Lit component", "Lit decorator", "Lit reactive property".
Input Context
Before activating, verify:
- package.json has lit dependency.
- Whether the project uses decorators (experimentalDecorators) or the reactive-element base class.
- Whether Lit SSR (@lit-labs/ssr or @lit/react) is needed.
Output Artifact
No file output. Produces component design, property configuration, template patterns, and SSR setup as text.
Response Format
Component: {name} — {purpose}
Properties: {reactive attributes/properties}
Template: {shadow DOM structure}
Events: {CustomEvent dispatch}
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output.
Completion Criteria
- Components extend LitElement or ReactiveElement.
- Reactive properties defined with @property() decorator or static properties.
- Templates use Lit's html tagged template literal.
- Shadow DOM enabled (default in LitElement).
- Events dispatched as typed CustomEvent.
- Lit SSR configured for server-side rendering if needed.
- Styles scoped via shadow DOM or adoptedStyleSheets.
Max Response Length
2560 tokens.
Component Architecture / Decision Trees
Architecture Options
| Approach | Trade-off | When to Use |
|---|---|---|
| LitElement | Full API (render, styles, lifecycle) | Most components |
| ReactiveElement | No template system, minimal | When bundle is critical |
| @lit-labs/ssr | Server rendering + hydration | SSR-required projects |
| @lit/react | React wrapper generation | React design systems |
Base Class Decision
Do you need the full LitElement API (render, styles, lifecycle)?
Yes -> LitElement (default)
No -> Is bundle size critical?
Yes -> ReactiveElement (no template system, manual DOM management)
No -> LitElement for maintainability
Do you need SSR?
Yes -> LitElement + @lit-labs/ssr
No -> LitElement (default)
Reactive Property Configuration
Is the property part of the public API?
Yes -> @property() — exposes as HTML attribute, triggers update
No -> @state() — internal only, triggers update but no attribute
How should the attribute be named?
CamelCase property -> 'my-prop' attribute (auto kebab-case)
Need custom name -> attribute: 'custom-name'
No attribute needed -> attribute: false
Should the attribute reflect changes back to DOM?
Yes -> reflect: true (useful for CSS attribute selectors)
No -> reflect: false (default, better performance)
Styling Strategy
How should styles be scoped?
Shadow DOM -> static styles in LitElement (default, best encapsulation)
Light DOM -> override createRenderRoot() for shared styles
Adopted stylesheets -> adoptedStyleSheets for performance (multiple instances)
CSS custom properties -> ::part() for component customization API
Component Design Patterns
Basic Component with Properties
import { LitElement, html, css } from 'lit'
import { property, state } from 'lit/decorators.js'
export class MyCounter extends LitElement {
static styles = css`
:host { display: block; padding: 1rem; }
button { cursor: pointer; }
`
@property({ type: Number }) initial = 0
@state() private count = 0
connectedCallback() {
super.connectedCallback()
this.count = this.initial
}
render() {
return html`
<p>Count: ${this.count}</p>
<button @click=${() => this.count++}>+</button>
<button @click=${() => this.count--}>-</button>
`
}
}
Component with Typed Events
import { LitElement, html } from 'lit'
import { property } from 'lit/decorators.js'
export class MyDropdown extends LitElement {
@property({ type: Array }) options: string[] = []
@property({ type: String }) value = ''
private select(option: string) {
this.value = option
this.dispatchEvent(new CustomEvent('select', {
detail: option,
bubbles: true,
composed: true,
}))
}
render() {
return html`
<div @click=${(e: Event) => {
const target = e.target as HTMLElement
if (target.dataset.value) this.select(target.dataset.value)
}}>
${this.options.map(o => html`
<div data-value=${o} class=${o === this.value ? 'active' : ''}>
${o}
</div>
`)}
</div>
`
}
}
Renderless Controller Pattern
import { ReactiveController, ReactiveControllerHost } from 'lit'
export class ResizeController implements ReactiveController {
private entries: ResizeObserverEntry[] = []
private observer: ResizeObserver | null = null
constructor(private host: Reactive
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/lit-advanced.md
- references/lit-architecture.md
- references/lit-deployment.md
- references/lit-essentials.md
- references/lit-fundamentals.md
- references/lit-testing.md
FAQ
Что делает скилл frontend-lit?
Use when the user asks about Lit, LitElement, lit-html templates, reactive properties, Lit decorators, Lit context or Lit SSR. Produces typed Lit web components with shadow DOM styles and custom events. Not for framework-free custom elements (use frontend-web-components) or Stencil (use stencil).
Как установить скилл frontend-lit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл frontend-lit запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…