web-components-architecture
Web Components Architecture
Core Principles
This skill enforces a strict architectural pattern for web components:
- Zero DOM Selection: NEVER use
querySelector,querySelectorAll, orgetElementById - Attribute-Driven State: All state flows through HTML attributes
- Event Delegation on
this: Usethis.addEventListenerand thehandleEventpattern - No External Dependencies: Use only standard Web Platform APIs
- Declarative Shadow DOM: Use
<template shadowrootmode="open">for instant rendering - Progressive Enhancement: Components work (degraded) even if JavaScript fails
- Customized Built-ins Over Autonomous: Extend native elements when possible to preserve accessibility
Relationship with JavaScript Best Practices
This skill defines the architectural pattern for building web components. When implementing components, combine this skill with javascript-pragmatic-rules for production-quality code:
This skill provides the WHAT (component architecture):
More from matthewharwood/fantasy-phonics
animejs-v4
Anime.js 4.0 animations for Web Components — drag-drop, click feedback, swaps, cancelable motion. Use when adding animations, drag interactions, visual feedback, or motion to custom elements. Combines with web-components-architecture for lifecycle cleanup.
37ux-spacing-layout
Utopia fluid spacing tokens and layout patterns. Use when applying margins, padding, gaps, or creating layouts. Covers space scale, container widths, and responsive spacing. (project)
15html-semantic-engineering
30 pragmatic rules for production HTML covering semantic markup, accessibility (WCAG 2.1 AA), performance optimization, forms, and security. Use when writing HTML, building page structures, creating forms, implementing accessibility, or optimizing for SEO and Core Web Vitals.
15webgpu-canvas
WebGPU fundamentals for high-performance canvas rendering. Covers device initialization, buffer management, WGSL shaders, render pipelines, compute shaders, and web component integration. Use when building GPU-accelerated graphics, particle systems, or compute-intensive visualizations.
11ux-iconography
Icon usage patterns using Material Symbols v3. Use when adding icons to buttons, navigation, or status indicators. Covers sizing, accessibility, animations, and color integration with project tokens.
10audio-design
Game audio design patterns for creating sound effects and UI audio. Use when designing sounds for games, writing AI audio prompts (ElevenLabs, etc.), creating feedback sounds, or specifying audio for abilities/UI. Includes psychological principles from Kind Games, volume hierarchy, frequency masking prevention, and prompt engineering for AI audio generation.
10