design-api
Design a custom element's public API e.g. attributes, properties, events, slots, CSS parts and custom properties. Use when the user asks to "design an element", "plan a component API", "create element API", "design component interface", or discusses naming conventions, API surface, or element architecture.
What this skill does
# Element API Design
Guide the design of a custom element's public API, ensuring consistency with existing elements and CEM conventions.
## Workflow
### Phase 1: Understand the Element
Ask the user (if not already provided):
1. What is the element's purpose?
2. What content does it render or contain?
3. What interactions does it support?
4. Are there existing elements it should be consistent with?
### Phase 2: Survey Existing Conventions
Read the existing elements to understand naming patterns:
```text
cem://elements
```
For elements the user mentions as related or similar, read their full APIs:
```text
cem://element/{tagName}
```
Also read any project-level guidelines:
```text
cem://guidelines
```
Note existing patterns for:
- **Tag naming**: prefix conventions, naming style
- **Attribute naming**: kebab-case patterns, boolean naming (e.g. `disabled` vs `is-disabled`)
- **Event naming**: prefix patterns, past tense vs present
- **Slot naming**: `header`, `footer`, `actions` patterns
- **CSS part naming**: conventions for internal structure
- **CSS custom property naming**: `--element-property` patterns
### Phase 3: Design the API
Work through each API surface systematically:
#### Tag Name
- Follow the project's tag prefix convention
- Name should describe what the element *is*, not what it *does*
- Avoid overly generic names
#### Attributes & Properties
- Use kebab-case for attribute names
- Use camelCase for corresponding property names
- Boolean attributes should be positive (`disabled`, not `enabled`)
- Enum attributes should list all valid values
- Consider which attributes reflect to properties and vice versa
- Provide sensible defaults
- Document type constraints
- Prefer CSS states to reflected state attributes
#### Slots
- Use the default slot for primary content
- Name slots by their semantic role (`header`, `actions`), not position (`top`, `bottom`)
- Write content guidelines for each slot
- Consider what content types are appropriate
#### Events
- Name events in past tense for state changes (`opened`, `closed`)
- Name events in present tense for ongoing actions (`input`, `scroll`)
- Use the element prefix if events could conflict with native events
- Design event detail types with the minimum necessary data
- Document what triggers each event
- Prefer to subclass `Event` for type safety, rather than to ship `CustomEvent`
#### CSS Custom Properties
- Follow `--element-name-property` naming convention
- Provide defaults that work in both light and dark themes
- Group related properties (color, spacing, typography)
- Consider which properties consumers will most likely want to override
- Prefer to use existing design tokens rather than to add element-specific props
#### CSS Nesting
- Use native CSS nesting for descendant selectors within shadow DOM
- Don't nest `:host` attribute selectors with `&` -- `&([attr])` inside `:host {}` is invalid because `&` substitutes `:host` literally, making `&([attr])` parse as a function call rather than an attribute selector
- Keep `:host([variant="..."])` blocks flat at the top level; nesting is valid for descendants within those blocks
```css
/* WRONG: &([attr]) is invalid */
:host {
&([variant="primary"]) { ... }
}
/* RIGHT: flat :host selectors, nested descendants */
:host([variant="primary"]) {
--_color: blue;
}
:host([variant="primary"]) button {
&:hover { --_color: darkblue; }
&:active { --_color: navy; }
}
```
#### CSS Parts
- Name parts after the internal element they expose (`button`, `label`, `icon`)
- Only expose parts that consumers need to style
- Don't expose implementation details that may change
#### CSS States
- Use custom states for element-specific states (`:state(loading)`, `:state(empty)`)
- Map to existing CSS pseudo-classes where appropriate
- Document state transitions
### Phase 4: Source Documentation
When presenting the designed API, show how each part should be documented
in source code.
!`cat ${CLAUDE_SKILL_DIR}/html-comment-syntax.md`
### Phase 5: Consistency Check
Compare the proposed API against existing elements:
- Are similar concepts named the same way?
- Do shared attribute names have compatible types?
- Are event patterns consistent?
- Do CSS property names follow the same scheme?
### Phase 6: Output
Present the designed API as a structured summary:
```markdown
## `<prefix-element-name>` API Design
### Description
[One-paragraph purpose statement]
### Attributes
| Name | Type | Default | Description |
|------|------|---------|-------------|
| `variant` | `'primary' \| 'secondary'` | `'primary'` | Visual style variant |
### Slots
| Name | Description | Content Guidelines |
|------|-------------|--------------------|
| (default) | Primary content | Text or inline elements |
### Events
| Name | Type | Description |
|------|-------------|-------------|
| `change` | `MyChangeEvent` | Fired when value changes |
### CSS Custom Properties
| Name | Default | Description |
|------|---------|-------------|
| `--prefix-element-color` | `light-dark(#000, #fff)` | Primary text color |
### CSS Parts
| Name | Description |
|------|-------------|
| `button` | The internal button element |
### CSS States
| Name | Description |
|------|-------------|
| `loading` | Applied while async content loads |
```
Optionally, generate a skeleton class definition or manifest snippet if the user wants to start implementing.
## Design Principles
- **Minimal API surface**: Don't add attributes "just in case" — each should serve a clear purpose
- **Consistency over novelty**: Match existing patterns in the project, even if you'd name things differently in isolation
- **Attributes for HTML, properties for JS**: Attributes should be serializable; complex data goes through properties only
- **Slots over attributes for rich content**: If content could be more than a plain string, use a slot
- **CSS custom properties for theming, parts for structure**: Properties for colors/spacing, parts for layout overrides
- **Clarify**: If an API can't be clearly and succinctly described in plain English, that likely indicates a design flaw.
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.