# Contributing to the design system

> Choose ownership, preserve Astryx contracts, and document reusable UI changes.

This page covers changes to `packages/ui`. Follow the
[UI workflow](/design-system/workflow) and the execution policy in `AGENTS.md`.

## Choose the owner

Keep domain logic, services, and product messages in the app. Shared product
compositions such as `FilterBar`, `CalmEmpty`, and `GuidedSection` live in
`apps/app/shared/components/`. Generic visual behavior belongs in `packages/ui`
when at least two features need it and no existing primitive covers the case.

## Preserve the contract

1. Inspect the local export and installed Astryx API before adding a component.
2. Prefer a typed re-export. Add an adapter only for a named missing contract,
   such as Hugeicons data, native form attributes, or portal theme propagation.
3. Preserve upstream props, callback values, keyboard behavior, and accessibility.
4. Prefer component props and layout primitives. For necessary custom styles,
   use official tokens and raw StyleX values through `xstyle`.
5. Record wrapper ownership and exceptions in the applicable
   `packages/ui/scripts/*-registry.json` or `*-exceptions.json` file.
6. Update the affected component or pattern guidance and remove dead code.

Keep named exports stable. Do not add generic `className` / `render` bridges,
shadcn compound slots, feature messages, or an Agata token alias layer.

## Verification and review

Run the static checks required for the changed files. StyleX/token changes need
`bun run lint:stylex`; changed wrappers also need their applicable contract and
registry checks. Inspect source for labels, focus behavior, theme propagation,
semantic structure, and loading/empty/error states.

Paper, Storybook, browsers, screenshots, tests, and builds are optional work
that requires an explicit user request. When Storybook is requested, add or
update the relevant component or pattern stories with English fixtures and
meaningful variants. Report any runtime checks that were not performed.

Pushes, PR creation, and deployment also require a user request. A requested
PR should explain the behavior change, ownership, and verification performed.

## Related

- [Components](/design-system/components)
- [Patterns](/design-system/patterns)
- [Principles](/design-system/principles)
- [Feature lifecycle](/architecture/feature-lifecycle)
