web-components-architecture
Installation
SKILL.md
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: