design-api

Plan custom element APIs covering tags, attributes, events, slots, and CSS properties.

46|4|Updated May 27, 2025
One-click install
npx skills add https://github.com/bennypowers/cem --skill design-api-bennypowers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-api
Source: https://github.com/bennypowers/cem/tree/main/extensions/claude-code/skills/design-api
Command: npx skills add https://github.com/bennypowers/cem --skill design-api-bennypowers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing a coherent public API for a custom element is challenging due to consistency, naming conventions, and interoperability across teams and design systems. This guide helps teams align on tag naming, attribute/property design, events, slots, and CSS custom properties to ensure a predictable API surface.

Core Features & Use Cases

  • Establish consistent tag names that describe what the element is.
  • Define attribute and property naming, types, defaults, and reflection rules.
  • Specify events, slots, CSS parts, and CSS variables to enable theming and integration.
  • Use cases include planning a new component API for a design system, extending existing elements, or auditing a family of components for consistency.

Quick Start

Describe the API design for the new custom element by outlining its tag name, attributes, slots, events, CSS properties, and parts.

Frequently Asked Questions about design-api

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

FAQPage Schema
How do I design a consistent public API for a custom element?

To design a custom element API, outline the tag name, attributes, properties, slots, events, and CSS custom properties. This ensures a predictable API surface across components and design systems by enforcing consistent naming conventions, types, and documentation structure.

What naming conventions should I use for custom element attributes and properties?

Custom element attributes and properties require consistent naming, defined types, and defaults, along with explicit reflection rules. Aligning these with existing elements ensures interoperability and a coherent public API surface across your design system.

How do you plan CSS custom properties and slots for web components?

Planning CSS custom properties and slots involves specifying them explicitly to enable theming and content projection. Defining CSS parts and variables alongside slots ensures the custom element integrates predictably into broader design systems.

Can I use this to audit existing web components for API consistency?

Yes, you can audit a family of existing web components for API consistency. The process evaluates tag naming, events, and CSS custom properties against established guidelines to generate a complete API design summary for alignment.

When do I need to formally define a custom element API surface?

You need to define a custom element API surface when planning a new component for a design system or extending existing elements. It solves the challenge of maintaining interoperability and predictable behavior across teams.

What is the best way to document events and CSS parts for custom elements?

The best way to document events and CSS parts is to generate a complete API design summary. This satisfies guidelines for documentation structure by specifying events, slots, CSS parts, and custom properties aligned with existing elements.