.agents/skills/plate-ui/rules/ownership.md
Extract to a package when the code owns a durable contract:
Good examples in this repo:
packages/media/src/react/media/useMediaState.tspackages/toc/src/react/hooks/useTocElement.tspackages/footnote/src/lib/transforms/createFootnoteDefinition.tsKeep it in apps/www/src/registry/ui when it is mostly:
Bad reason to extract: "the file feels long"
Bad reason to extract: "the types are annoying"
Do not extract when most of the return value is:
If the hook name effectively means "the private state for this one renderer", keep it local.
Incorrect:
// Package hook only used by one component and mostly returns UI glue.
const state = useSingleComponentOnlyState();
Correct:
// Package owns stable semantics.
const { activeContentId, headingList } = useTocElementState();
// App owns local composition.
return headingList.map((item) => (
<Button key={item.id}>{item.title}</Button>
));