npm package: @soleri/domain-design
Description: Design system intelligence domain pack for Soleri agents — WCAG contrast, token validation, design rules, and patterns.
Latest version: 1.0.0

# @soleri/domain-design

Design system intelligence domain pack for Soleri agents -- WCAG contrast, token validation, design rules, and patterns.

## What it does

Registers three facades with 45 ops total (8 algorithmic, 36 data-serving, 1 LLM-dependent).

### `design` facade (20 ops)

| Op | Type | Description |
|----|------|-------------|
| `check_contrast` | algorithmic | WCAG 2.1 contrast ratio between two colors |
| `get_color_pairs` | algorithmic | Accessible foreground suggestions for a background |
| `validate_token` | algorithmic | Validate token name against schema rules |
| `validate_component_code` | algorithmic | Design system compliance check (score, grade, violations) |
| `check_button_semantics` | algorithmic | Button variant vs. action intent check |
| `check_action_overflow` | algorithmic | Buttons vs. dropdown menu recommendation |
| `get_typography_guidance` | data | Typography guidance |
| `get_spacing_guidance` | data | Spacing guidance |
| `get_icon_guidance` | data | Icon guidance |
| `get_animation_patterns` | data | Animation patterns |
| `get_dark_mode_colors` | data | Dark mode color mappings |
| `get_responsive_patterns` | data | Responsive patterns |
| `get_ux_law` | data | UX laws |
| `get_guidance` | data | General design guidance |
| `recommend_style` | data | Style recommendations |
| `recommend_palette` | data | Palette recommendations |
| `recommend_typography` | data | Typography recommendations |
| `recommend_design_system` | data | Design system recommendations |
| `get_stack_guidelines` | data | Stack guidelines |
| `generate_image` | LLM | Image generation via Google Gemini API |

### `design_rules` facade (15 ops)

| Op | Description |
|----|-------------|
| `get_clean_code_rules` | Clean code rules |
| `get_architecture_patterns` | Architecture patterns |
| `get_variant_philosophy` | Variant philosophy |
| `get_api_constraints` | API constraints |
| `get_stabilization_patterns` | Stabilization patterns |
| `get_delivery_workflow` | Delivery workflow |
| `get_ux_writing_rules` | UX writing rules |
| `get_performance_constraints` | Performance constraints |
| `get_component_dev_rules` | Component development rules |
| `get_defensive_design_rules` | Defensive design rules |
| `get_dialog_pattern_rules` | Dialog pattern rules |
| `get_component_usage_patterns` | Component usage patterns |
| `get_ui_patterns` | UI patterns |
| `get_operational_expertise` | Operational expertise |
| `get_error_handling_patterns` | Error handling patterns |

### `design_patterns` facade (10 ops)

| Op | Type | Description |
|----|------|-------------|
| `check_container_pattern` | algorithmic | Recommend container (Dialog/Sheet/Page/Wizard) by field count |
| `get_radius_guidance` | data | Border radius guidance |
| `get_depth_layering` | data | Depth/elevation layering |
| `get_component_workflow` | data | Component development workflow |
| `get_storybook_patterns` | data | Storybook patterns |
| `get_testing_patterns` | data | Testing patterns |
| `get_font_requirements` | data | Font requirements |
| `get_shadcn_components` | data | shadcn/ui component intelligence |
| `fix` | orchestration | Structured fix checklist for design issues |
| `theme` | orchestration | Structured theming checklist |

## Install

```bash
npm install @soleri/domain-design
```

Requires `@soleri/core` ^9.0.0 as a peer dependency.

## Add to agent.yaml

```yaml
packs:
  - name: design
    package: "@soleri/domain-design"
```

## Development

```bash
npm install
npm run build
npm test
npm run typecheck
```

### Pack structure

```
src/
  index.ts          # Pack definition (default export)
  lib/              # Color science, code validator, data loader
  __tests__/        # Tests
data/               # Static data files (JSON)
knowledge/          # Tiered knowledge (canonical, curated)
```

## Publishing

Tag and push -- the release workflow handles npm publish:

```bash
git tag v<version>
git push origin main --follow-tags
```

## License

Apache-2.0