klh-lit-dev

Build Lit web components with TypeScript decorators, Zod validation, and Playwright testing.

1|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/klh/skills --skill klh-lit-dev-klh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: klh-lit-dev
Source: https://github.com/klh/skills/tree/main/.well-known/agent-skills/klh-lit-dev
Command: npx skills add https://github.com/klh/skills --skill klh-lit-dev-klh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building reusable web components requires consistent structure, type safety, runtime validation, and cross-framework compatibility, which is tedious to set up correctly from scratch each time. ## Core Features & Use Cases - Component Structure Pattern: Enforces a 7-point pattern covering directory layout, barrel exports, decorator-based component definitions, Zod schemas, Playwright fixtures, JSDoc documentation, and test server setup. - Lit API Reference: Covers decorators, template expressions, directives, async tasks, signals, mixins, controllers, custom directives, slots, scoped styles, lifecycle methods, and context-based dependency injection. - Project Configuration: Provides ready-to-use configs for TypeScript, ESLint flat config, Playwright, Turborepo, pnpm workspaces, and Vite in a monorepo setup. - Use Case: When creating a new design system component, follow the pattern to scaffold the component directory, define Zod-validated props, write Playwright fixture tests, and document the public API with JSDoc tags. ## Quick Start Ask the agent to create a new Lit component with TypeScript decorators, Zod-validated properties, JSDoc documentation, and Playwright tests following the standard component structure.

Frequently Asked Questions about klh-lit-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Lit web component with TypeScript decorators?

Extend LitElement, register the element with @customElement, and declare reactive properties with @property and internal state with @state. Enable experimentalDecorators and set useDefineForClassFields to false in tsconfig.

How to test Lit components with Playwright?

Serve static HTML fixtures via http-server on port 8080, then write Playwright tests that navigate to the fixture page and assert on attributes, shadow DOM content, and dispatched custom events.

Should I use Zod with Lit component properties?

Zod schemas define and validate component props at runtime while inferring TypeScript types via z.infer. This keeps a single source of truth for both validation logic and type definitions.

Why is my Lit component event not reaching parent elements?

Custom events dispatched from shadow DOM need both bubbles: true and composed: true to escape the shadow boundary and propagate to ancestor listeners outside the component.

When should I use repeat instead of map in Lit templates?

Use repeat with unique keys when list items reorder, since it preserves DOM identity and avoids full re-renders. Use plain map for simple static lists where diffing is unnecessary.