@appdirect/design-system 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +21 -0
  2. package/bin/ad-sync-agents.mjs +542 -0
  3. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.js +15 -51
  4. package/dist/ComplexComponents/DashboardWidget/DashboardWidget.tsx +91 -139
  5. package/dist/ComplexComponents/KeyInsight/index.ts +1 -1
  6. package/dist/DESIGN.md +49 -7
  7. package/dist/agent-kit/README.md +11 -0
  8. package/dist/agent-kit/manifest.json +81 -0
  9. package/dist/agent-kit/micro-ui/CLAUDE.md +1 -0
  10. package/dist/agent-kit/micro-ui/micro-ui.AGENTS.md +62 -0
  11. package/dist/agent-kit/rules/accessibility.mdc +46 -0
  12. package/dist/agent-kit/rules/module-federation.mdc +30 -0
  13. package/dist/agent-kit/rules/react-stack.mdc +73 -0
  14. package/dist/agent-kit/rules/testing.mdc +44 -0
  15. package/dist/agent-kit/skills/design-feature/SKILL.md +205 -0
  16. package/dist/agent-kit/skills/developer-handoff/SKILL.md +192 -0
  17. package/dist/agent-kit/skills/figma-mcp-integration/SKILL.md +134 -0
  18. package/dist/agent-kit/skills/figma-to-page/SKILL.md +24 -0
  19. package/dist/agent-kit/skills/mantine-combobox/SKILL.md +73 -0
  20. package/dist/agent-kit/skills/mantine-combobox/references/api.md +199 -0
  21. package/dist/agent-kit/skills/mantine-combobox/references/patterns.md +279 -0
  22. package/dist/agent-kit/skills/mantine-custom-components/SKILL.md +112 -0
  23. package/dist/agent-kit/skills/mantine-custom-components/references/api.md +407 -0
  24. package/dist/agent-kit/skills/mantine-custom-components/references/patterns.md +431 -0
  25. package/dist/agent-kit/skills/mantine-form/SKILL.md +103 -0
  26. package/dist/agent-kit/skills/mantine-form/references/api.md +313 -0
  27. package/dist/agent-kit/skills/mantine-form/references/patterns.md +310 -0
  28. package/dist/agent-kit/skills/prototype-page/SKILL.md +82 -0
  29. package/dist/contracts/DashboardWidget.json +92 -0
  30. package/dist/contracts/index.json +6 -1
  31. package/dist/css/mantine.css +172 -6
  32. package/dist/css/tokens.css +54 -4
  33. package/dist/skills/design-feature/SKILL.md +205 -0
  34. package/dist/stories/ComplexComponents/DashboardWidget/DashboardWidget.stories.tsx +76 -1
  35. package/dist/stories/index.json +4 -1
  36. package/package.json +8 -4
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Accessibility rules for micro-UI React/Mantine components (WCAG 2.1 AA) — input labels, accessible names, overlays, headings, status announcements, tables, focus. Covers only what lint cannot catch.
3
+ globs: src/**/*.tsx,src/**/*.module.css
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Accessibility (WCAG 2.1 AA)
8
+
9
+ Target: text contrast 4.5:1 (3:1 large, 1.4.3); UI components and focus indicators 3:1 (1.4.11); async results announced (4.1.3).
10
+ Contrast is owned by the `--ad-*` tokens and DS variants (checked by cypress-axe, `__e2e__/AGENTS.md`). Never override a colour "for contrast" — raise it with design.
11
+ Colours, variants, allowlist → root `AGENTS.md`. `translate`, routing → `react-stack.mdc`. Tests → `testing.mdc`.
12
+
13
+ ## Names and labels
14
+ - Every accessible name (`aria-label`, `alt`, `title`, `closeButtonLabel`, …) is a `translate(...)` call — never an English literal.
15
+ - Inputs: visible `label` by default. `aria-label` only when the Figma design has no visible label (e.g. table search); then it is translated and the PR says "no visible label per design". Placeholder is never a label. Helper text in `description`, errors in `error` — Mantine wires both to `aria-describedby`.
16
+ - Icon-only controls: `<ActionIcon variant="default" size="md" aria-label={translate("x.delete")}><RiDeleteBinLine size={18} aria-hidden /></ActionIcon>`. Icons are always `aria-hidden`; the control carries the name.
17
+ - Link text says where it goes ("View invoice #123"), never "Click here" / "Read more".
18
+
19
+ ## Overlays
20
+ - `Modal`/`Drawer`: always pass `title`. With no visible title, use `Modal.Root` + `Modal.Content aria-label={...}` — `aria-label` on `<Modal>` lands on the wrapper, not the `role="dialog"` element. Test it with `getByRole('dialog', { name })`.
21
+ - Always `closeButtonProps={{ 'aria-label': translate("common.close") }}`. `data-autofocus` on the element that should get initial focus. Never disable `trapFocus`, `closeOnEscape` or `returnFocus`.
22
+ - `Alert withCloseButton` always has `closeButtonLabel={translate(...)}`.
23
+ - `Menu`: never `trigger="hover"`. Click is the default; `trigger="click-hover"` if hover is required.
24
+
25
+ ## Headings (owned here)
26
+ - A page micro UI (one routed in `src/navigation/router.tsx`) renders exactly one `<Title order={1}>` — the page title, matching `usePageTitle`. The host header has no page heading.
27
+ - A widget micro UI embedded in someone else's page starts at `order={2}`.
28
+ - Never skip levels. Change the look with `size` (`<Title order={3} size="h5">`), never with a wrong `order`.
29
+
30
+ ## Status announcements
31
+ - Status visuals follow the root `AGENTS.md` design system (DS variant + Remix icon + text).
32
+ - Async results (saved, failed, N results) are announced: `Alert` (renders `role="alert"`) for errors, a `role="status"` region for non-urgent updates.
33
+
34
+ ## Tables
35
+ - Every data table has an accessible name: `DataTableGrid` must forward a translated `aria-label` (or `aria-labelledby` pointing at the visible title) to Mantine `<Table>`. The reference implementation doesn't yet — add the prop when you build a table.
36
+ - Sortable headers: the `<Table.Th>` carries `aria-sort` (`ascending`/`descending`/`none`) and wraps the label in an `UnstyledButton`. The reference `SortableHeaderCell` is a clickable `Flex` with neither — fix it when you touch it.
37
+ - Scroll container, only when it actually scrolls: `role="region"` + `aria-labelledby` (or `aria-label`) + `tabIndex={0}`. Never `aria-label` on a plain `div`.
38
+
39
+ ## Interaction and focus
40
+ - No clickable `div`/`span`/`Box`/`Flex`, not even with `role="button"`. A clickable card is `Card component={Link} to=…` (in-app), `Card component="a" href=…` (external) or `Card component="button"` (action).
41
+ - Never `outline: none` / `outline: 0` without an equivalent visible focus style. Focus rings come from the theme and the DS adapter — don't restyle them.
42
+
43
+ ## Lint boundary
44
+ - Enforced by eslint-plugin-jsx-a11y in `eslint.config.cjs` (the config `npm run lint` loads), don't restate: `alt-text`, `no-autofocus`, `tabindex-no-positive`, `click-events-have-key-events`, `no-static-element-interactions`, `interactive-supports-focus`, `anchor-is-valid`, `anchor-has-content`, `heading-has-content`, `aria-props`, `role-has-required-aria-props`.
45
+ - `eslint.config.cjs` must set `settings['jsx-a11y']: { polymorphicPropName: 'component', components: { Anchor: 'a', Button: 'button', ActionIcon: 'button', UnstyledButton: 'button' } }` and `'jsx-a11y/anchor-is-valid': ['error', { components: ['Link'], specialLink: ['to'], aspects: ['noHref', 'invalidHref', 'preferButton'] }]`.
46
+ - NOT enforced by lint: `aria-label` on `ActionIcon`/`CloseButton` (airbnb turns `control-has-associated-label` off) — that check lives here and in Bugbot.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Module Federation, Shadow DOM and provider setup for micro UIs — rspack.config.js, src/index.tsx, src/components/Root, src/providers (MantineProviderWrapper, DatesProviderWrapper), CSS injection, portals, DOM access. Read before touching any of these.
3
+ globs: rspack.config.js,src/index.tsx,src/components/Root/**,src/providers/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Module Federation + Shadow DOM
8
+
9
+ ## How a micro UI is loaded
10
+ - The host loads `./Root` from `remoteEntry.js` (rspack `ModuleFederationPlugin`, name from `APPNAME`). `./RemoteReact` and `./RemoteReactDom` are exposed so the host renders `Root` with this remote's own React. There is no `shared` config — do not add one.
11
+ - In the monolith, `src/index.tsx` defines `window.startMicroUI`, which mounts `Root` into `#app` (inside a shadow root when `SHADOW_ROOT` is true).
12
+ - `bypassReactIntlGlobalContext` must stay the FIRST import in both `src/index.tsx` and `src/components/Root`.
13
+
14
+ ## Provider stack (only in Root — components never create their own)
15
+ `AppDirectContextProvider` → `MantineProviderWrapper` (includes `DatesProviderWrapper`) → `QueryClientProvider` → `AppDirectI18nProvider` → `RouterProvider`.
16
+ - The Mantine theme is built in `src/providers/MantineProviderWrapper`: it starts from the host's `window.mantineTheme` and adds overrides in `getMantineExtendedComponents()`. Put DS component defaults there (e.g. `Button.extend({ defaultProps: { variant: 'default', size: 'sm' } })`). Never call `createTheme` elsewhere.
17
+ - Colour scheme comes from the host (`window.mantineColorSchemeManager`, `window.mantineDefaultColorScheme`). Never force one.
18
+
19
+ ## CSS
20
+ - Light DOM (default, `useShadowRoot = false` in rspack.config.js): styles are injected into `#microui-app-styles` / `#microui-app-styles-modules`; the host provides `--ad-*` variables at `:root`. Never import `@appdirect/design-tokens/css/*` from components.
21
+ - Shadow DOM (`useShadowRoot = true`): styles are tagged `data-shadow-style` and copied into the shadow root by `src/index.tsx`; PostCSS rewrites `:root` → `:host`; `foundations.css` is required by `MantineProviderWrapper` because the shadow root can't inherit the host's variables.
22
+ - Mantine component CSS is imported per component in `MantineProviderWrapper/index.tsx`. Using a new allowlisted component → add its `@mantine/core/styles/<Component>.css` import there.
23
+ - Global CSS only in `MantineProviderWrapper/global.css`; rspack ignores global CSS elsewhere in `src/` on purpose (it would break host header branding). Everything else is a `.module.css`.
24
+
25
+ ## Portals in Shadow DOM
26
+ - Mantine portals default to `document.body`, outside the shadow root, so overlays lose their styles. In Shadow DOM mode, set a portal target once in `getMantineExtendedComponents()`: `Portal.extend({ defaultProps: { target: shadowPortalEl } })`, where `shadowPortalEl` is an `HTMLElement` created inside the shadow root. Never a selector string, never per component.
27
+
28
+ ## DOM access
29
+ - `document` is the host page. Never `document.querySelector`/`getElementById` for app elements; use refs. Global listeners only through Mantine hooks (`useWindowEvent`, `useClickOutside`) or with cleanup.
30
+ - Breakpoints (`visibleFrom`, `hiddenFrom`) follow the host viewport. Prefer `Grid type="container"` / `SimpleGrid type="container"` for layout that must adapt to its slot.
@@ -0,0 +1,73 @@
1
+ ---
2
+ description: React 19.2 + React Compiler, TanStack Query 5, React Router 7, fe-tools translate/marketplace context, dates, folder layout, component size and composition, and Mantine doc sources for micro-ui-ts. Styling and colours live in the root AGENTS.md.
3
+ globs: src/**/*.ts,src/**/*.tsx
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # React stack (micro-ui-ts)
8
+
9
+ Styling, colours, components → root `AGENTS.md`. Figma → `figma-mcp-integration` skill. Accessible names, headings, overlays → `accessibility.mdc`. Tests → `testing.mdc`. Providers, Shadow DOM → `module-federation.mdc`.
10
+
11
+ ## React 19.2 + React Compiler 1.0
12
+ - `ref` is a regular prop. Never write `forwardRef`.
13
+ - The compiler memoizes. No new `useMemo`/`useCallback`/`memo` unless an identity-sensitive API needs it; say why in a comment. A component that must opt out uses `"use no memo"` (see `src/components/Table`).
14
+ - `use(Context)` is fine. Never `use()` a promise created in render; server data comes from TanStack Query. Context providers are `<Ctx value>`.
15
+ - Type every prop object and exported function's return type. No `React.FC`.
16
+
17
+ ## Marketplace context and i18n (fe-tools)
18
+ - Tenant and locale: `useMarketplaceContext()` from `fe-tools`. Bootstrap data: `useBootstrapData()` from `src/hooks/useBootstrapData`. Never read them from `window`.
19
+ - Every user-visible string, including `aria-label`, `alt`, `title`, `placeholder`, `label`, `description`, `error`: `translate("namespace.key", values)` from `fe-tools/lib/api/translate`. Add each key to the micro UI's namespace in the Localization Service.
20
+ - Page titles: `usePageTitle(translate(...), companyName)` from `src/hooks/usePageTitle`.
21
+ - Never concatenate translated fragments; pass values as the second argument.
22
+ - French and German run 20–30% longer: no fixed widths on buttons, labels, tabs, badges; let text wrap.
23
+
24
+ ## Data: TanStack Query 5
25
+ - One hook per endpoint in `src/hooks/`, built on a `queryOptions()` factory that co-locates `queryKey` + `queryFn`.
26
+ - Object signature only: `useQuery(xQueryOptions(id))`, `useMutation({ mutationFn, onSuccess })`.
27
+ - v5 names: `isPending` (not `isLoading` for first load), `gcTime` (not `cacheTime`), `throwOnError`.
28
+ - `useSuspenseQuery` only under an existing `<Suspense>` + error boundary.
29
+ - Mutations invalidate with the factory's key: `queryClient.invalidateQueries({ queryKey: xQueryOptions(id).queryKey })`.
30
+ - The single `QueryClient` lives in `src/components/Root`; never create another.
31
+
32
+ ## Routing: React Router 7
33
+ - The data router is `createBrowserRouter` in `src/navigation/router.tsx`; every route element is a page in `src/pages/`.
34
+ - New code imports from `react-router` (in v7 `react-router-dom` is a re-export). Migrate `router.tsx` and `Root` when you touch them.
35
+ - Route loaders may prefetch with `queryClient.ensureQueryData(xQueryOptions(id))`.
36
+ - Internal navigation: `component={Link} to="/path"` on Anchor, Card or Button. Never `href` or `<a href>` for in-app routes — it reloads the host page.
37
+
38
+ ## Dates
39
+ - Inputs: `DatePickerInput` from `@mantine/dates`; values are `YYYY-MM-DD` strings. Locale is already set by `src/providers/DatesProviderWrapper`.
40
+ - Manipulate with `dayjs`; no `moment`, no manual `Date` arithmetic.
41
+
42
+ ## Folder layout
43
+ - `src/components/<Name>/index.tsx` + `<Name>.module.css` + `__tests__/`: reusable across pages.
44
+ - `src/pages/<Route>/<Route>.tsx` + `components/` (page-only) + `__tests__/`. A page composes sections; it does not implement them inline.
45
+ - `src/hooks/`: query hooks and shared hooks. `src/navigation/`: router. `src/providers/`: Mantine/Dates providers. `src/config/`: runtime config.
46
+
47
+ ## Component size and composition
48
+ React's model is composition: a parent arranges children, and content is passed as `children` (or one named slot prop when there are several holes). Follow that. A component does one job.
49
+
50
+ Do not use a line-count threshold. React defines boundaries through composition, not file size, and line count does not measure how hard control flow is to understand. A large table, form, toolbar, provider or orchestration component is acceptable when its code describes one feature, its sections are easy to follow, and extracting them would add prop plumbing or hide the workflow. Use judgement and explain a non-obvious boundary in the PR.
51
+
52
+ Split when one or more of these are true:
53
+ - The return has more than one region (toolbar, filters, grid, empty, error, footer). Each region is its own component file, the way `Table` renders `CustomTopToolbar`, `DataTableGrid`, and `ErrorOverlay`.
54
+ - Props include boolean flags that swap a whole tree (`isEmpty`, `isError`, `isEditing`). Those are separate components, not branches.
55
+ - The component both fetches and renders a large view. Keep the hook in `src/hooks/` (or beside the feature) and let the view compose the result.
56
+ - A section has its own state/effects, can be named by its user-facing purpose, is reused, or can be tested independently.
57
+
58
+ Keep it together when extraction would only move lines, create a wide prop interface, separate tightly coupled state from its UI, or turn a readable workflow into file-hopping. `Table/index.tsx` and `CustomTopToolbar` are valid examples of larger orchestrators whose size alone is not a reason to split.
59
+
60
+ How to split:
61
+ - Used by one page → `src/pages/<Route>/components/<Section>/`. Used by more than one page → `src/components/<Name>/`. Do not promote a component on its first use.
62
+ - One level of child components under the parent. A grandchild is only for a real sub-feature (a filter inside a toolbar). No deeper.
63
+ - Pass markup with `children`. A second hole is a named prop (`footer={<Footer />}`), not a `renderFooter` callback and not a new component defined inside the parent.
64
+ - Do not split a short component just to lower the line count, and do not extract a helper that is a few lines of JSX used once.
65
+ - Do not define a component inside another component. It remounts every render.
66
+
67
+ ## Tables
68
+ - Always `src/components/Table` (`useTable` + `dataTableFeatures`, TanStack Table v9, `DataTableGrid`). Never another table library.
69
+
70
+ ## Mantine 9 reference
71
+ - Look up props with the `mantine` MCP server (`search_docs`, `get_item_doc`, `get_item_props`) before writing Mantine code.
72
+ - Combobox, form, custom components: the `mantine-combobox`, `mantine-form`, `mantine-custom-components` skills in `.claude/skills/`.
73
+ - v9 renames: Grid `gutter` → `gap`; Collapse `in` → `expanded`; Text/Anchor `color` prop removed.
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Unit and component tests — Jest 30, Testing Library 16, user-event 14, jest-axe 10, React 19, Mantine 9, fe-tools mocks. Use when writing or editing tests under src/.
3
+ globs: src/**/__tests__/**,src/**/*.test.ts,src/**/*.test.tsx
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Unit & component tests
8
+
9
+ ## Placement
10
+ - `__tests__/` beside the code: `Table/__tests__/Table.test.tsx`. Jest only picks up `src/**/__tests__/**/*.ts(x)` and `src/**/*.test.tsx` (`jest-unit.config.js`).
11
+ - `describe('<Component>')` → `it('does X when Y')`. Test behaviour a user or caller can observe.
12
+
13
+ ## Render
14
+ - `render(<X />, { wrapper: createWrapper() })` with `createWrapper` from `__setup__/utils.tsx`. It provides `QueryClientProvider` (fresh client, `retry: false`) and `MantineProvider theme={mantineTestTheme}` (all transitions at 0 ms). Never render Mantine components without it.
15
+ - `__setup__/setupTests.ts` already mocks `matchMedia`, `ResizeObserver`, `fe-tools` (`translate` returns the key, `useMarketplaceContext` returns `locale: "en-US"`) and loads jest-dom. Don't re-mock these per test.
16
+ - Routed components: wrap in `createMemoryRouter([{ path, element }], { initialEntries })` + `RouterProvider` inside the wrapper. `createWrapper` has no router. jsdom's `window.location` can't be mocked.
17
+ - Tabler icons and `.svg` imports are mocked by `moduleNameMapper`; don't assert on icon markup.
18
+
19
+ ## Interact & query
20
+ - `const user = userEvent.setup()` before render, then `await user.click()/type()/keyboard()`. No `fireEvent` for user interactions.
21
+ - Query through `screen`: `getByRole` (with `name`) → `getByLabelText` → `getByText`. `getByTestId` only when nothing accessible exists.
22
+ - `translate` is mocked to return its key, so assert on keys: `getByRole('button', { name: 'table.overlay.error.state.button' })`.
23
+ - Async UI: `await screen.findBy*`. `waitFor` holds assertions only. Absence: `queryBy*` + `not.toBeInTheDocument()`.
24
+ - `act` from `react`; `renderHook` from `@testing-library/react` with `{ wrapper: createWrapper() }`. Never `react-dom/test-utils` or `react-test-renderer`.
25
+
26
+ ## Jest 30
27
+ - Alias matchers are removed: `toHaveBeenCalled*`, `toHaveReturned*`, `toHaveBeenLastCalledWith`, `toThrow` (not `toBeCalledWith`, `toThrowError`, `lastCalledWith`).
28
+ - Use the global `expect`. Never `import { expect } from 'expect'`. Jest 30 provides `expect`; this package does not depend on the `expect` npm package.
29
+ - Types: `jest.Mocked<T>` / `jest.MockedFunction<typeof fn>`, `jest.Spied<typeof fn>`.
30
+
31
+ ## Data
32
+ - Mock our own data hooks at the module boundary, as the reference tests do: `jest.mock("../useFetchMockData")` then `(useFetchMockData as jest.Mock).mockReturnValue({ data, isPending: false, isError: false, refetch: jest.fn() })`.
33
+ - To exercise a real query hook, seed the wrapper's client: `queryClient.setQueryData(xQueryOptions(id).queryKey, data)`.
34
+
35
+ ## Accessibility
36
+ - `__setup__/setupTests.ts` must contain `import { toHaveNoViolations } from 'jest-axe'; expect.extend(toHaveNoViolations);` — add it if missing.
37
+ - One axe test per component for the default state AND each open/error state (open Modal/Menu, submitted invalid form): `const { baseElement } = render(<X />, { wrapper: createWrapper() }); expect(await axe(baseElement)).toHaveNoViolations();`. `baseElement` covers portalled overlays.
38
+ - Assert names by role: `getByRole('dialog', { name })`, `getByRole('table', { name })`, `getByRole('columnheader', { name })` has `aria-sort`, async results via `getByRole('status' | 'alert')`, page heading `getByRole('heading', { level: 1 })`.
39
+ - `color-contrast` doesn't work in jsdom; contrast is checked in Cypress (`__e2e__/AGENTS.md`).
40
+
41
+ ## Don't test
42
+ - Mantine/TanStack internals, class names, `data-*` styling attributes.
43
+ - DOM snapshots (`toMatchSnapshot` of markup).
44
+ - Implementation details: component state, hook call counts, private functions.
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: design-feature
3
+ description: >-
4
+ Designs or reviews an AppDirect admin screen as a product designer, read-only.
5
+ Produces a design spec (flow, layout, button hierarchy, states, copy, data)
6
+ checked against AGENTS.md, DESIGN.md and ds-enforce, or severity-ranked review
7
+ findings. Use when asked to design, plan, or critique a feature, screen, form,
8
+ table, or flow; to choose a pattern, overlay, or button hierarchy; or before
9
+ add-feature builds from a written description (add-feature is optional — only
10
+ in the prototype platform). Not for Figma-to-code (use figma-to-page), bug
11
+ fixes, or small styling tweaks to existing code.
12
+ ---
13
+
14
+ # Design a feature (AppDirect UX)
15
+
16
+ You are a senior product designer on AppDirect admin UIs: operators doing real work on dense data. Own the UX decisions. Propose the primary action, placement, hierarchy, states, and copy. Cite the source behind each call: an `AGENTS.md` or DESIGN.md section, a precedent path, or "designer call" when no rule exists. Never invent a DESIGN.md section. Push back when a request needs two primary actions, a modal for a non-blocking task, a pattern the design system lacks, or a colour with no `--ad-*` token: name the rule and offer the closest supported pattern. Never write code or edit files.
17
+
18
+ Two skill modes: **design** (default) and **review**. Design ends with a spec the user must approve before anyone builds. Review ends with severity-ranked findings and no edits. If the request covers several screens, list them and design the first only.
19
+
20
+ ## Stay read-only (required)
21
+
22
+ This skill never writes code or files. Stay read-only for the whole run.
23
+
24
+ - Cursor, top-level chat, Agent mode: call `SwitchMode` with `target_mode_id: "plan"` and say design-feature is read-only. If the user declines or the tool is missing, continue read-only in the current mode. Do not stop.
25
+ - Already in Plan mode, running as a subagent, or in a host without `SwitchMode` (Claude Code, Codex): do not switch. Stay read-only.
26
+ - Do not create, edit, or delete any file while this skill runs, including scaffolding, spec files, or mocks.
27
+ - The skill ends when the user approves the spec. If a calling skill (for example `add-feature`) continues, that skill switches to Agent mode before it edits files. If nothing called you, wait for the user to ask for implementation. Reply "approved" (or your changes) — do not start the build from the plan UI; `add-feature` or a separate Agent request handles implementation.
28
+
29
+ ## Product facts
30
+
31
+ Read before asking: the request, `standalone/standalone.config.ts` (persona, edition, namespace, menus) when present, `prototype.json`, and the target page if it exists. Valid personas and editions are in `src/mocks/bootstrap/personas.ts` when that file exists.
32
+
33
+ Then send one message that states what you found and asks only for what is missing, multiple choice where possible (`AskQuestion` when available). Allow at most one follow-up round. Needed:
34
+
35
+ - The job and what is out of scope
36
+ - The entity and its main fields, or "unknown — propose them"
37
+ - Destructive or bulk actions
38
+ - Who must not do this (permissions), and whether they should see it disabled or not at all
39
+
40
+ Persona, edition, and menu default to the config values when present. Say so and move on. If the user answers "you decide", assume, label the assumption, and continue.
41
+
42
+ ## Research (in this order — do not skip ahead)
43
+
44
+ Work the ladder top-down. Prefer an earlier step when it answers the job. Later steps inform gaps; they do not override AppDirect rules.
45
+
46
+ ### 1. Established AppDirect pattern (first)
47
+
48
+ Stop here when a clear in-house pattern exists. Write why later steps were skipped under Sources.
49
+
50
+ 1. **Rules.** `AGENTS.md` wins in app and prototype repos. Then DESIGN.md: `docs/DESIGN.md` or repo-root `DESIGN.md` in consumers; `apps/design-system/DESIGN.md` in this repo. Read: `Components › Buttons` (and ActionIcon), `Components › Overlays`, `Components › Combobox`, Alert vs Notification under `Components › DataDisplay`, `DataTable patterns`, `List page composition`, `Components › Navigation` (Stepper, BackBreadcrumb), `Layout & Spacing`, and Do's and Don'ts. DESIGN.md "Consumption rules" are for package authors; in apps, imports follow `AGENTS.md`. Adoption is decided by `@appdirect/ds-enforce` (`mantineDisallowed` in `eslint/contracts.json`), not by a list in `AGENTS.md`.
51
+ 2. **Precedent.** How AppDirect already solves the same job: pages in the current micro UI or prototype, neighbouring items in the same menu (`standalone/mocks/navigation/<namespace>.json`) for label wording, Title Case, and placement. Other prototypes (`prototypes/*/*/prototype.json`) only when that tree is in the workspace; if not, say so and rely on this app's pages and menu. Match precedent unless it breaks DESIGN.md; say when it does.
52
+ 3. **Stories.** `@appdirect/design-system` `dist/stories/index.json` (or stories source in this repo), for composition only.
53
+ 4. **Figma.** Load the `figma-mcp-integration` skill before any Figma MCP call. ADDS Admin Mantine Core (file key `rXvD5jPC1i02ZIma87Qcbl`), read-only, when 1–3 are silent. Prefer marker annotations and the Table Control Panel page. Ignore generic `utilities/doc-section` prose.
54
+
55
+ Record what you found (or that AppDirect has no established pattern for this job).
56
+
57
+ ### 2. Mantine patterns
58
+
59
+ When AppDirect has no established pattern, or to validate composition details:
60
+
61
+ - Mantine docs / `@mantine/mcp-server` (`search_docs`, `get_item_props`) for the relevant components and recipes.
62
+ - Note the Mantine default (variants, layout, overlay choice). Prefer Mantine patterns that map cleanly onto adopted design-system components.
63
+
64
+ Do **not** adopt Mantine `filled` / `light` / `subtle` / `transparent` / `white` / `gradient` button styles, palette props, or anything `ds-enforce` / `AGENTS.md` forbids — map to AppDirect variants instead.
65
+
66
+ ### 3. Industry patterns (only for a named gap)
67
+
68
+ Skip when steps 1–2 answer the job. Write "Industry: not needed — \<reason\>" under Sources.
69
+
70
+ Otherwise, first name the gap in one line (for example "how to report partial failure of a bulk action"). Then find up to three comparable sources for that gap:
71
+
72
+ - Prefer published design-system guidance (Shopify Polaris, Atlassian, IBM Carbon, GOV.UK, Material) over memories of product screens.
73
+ - Cite a URL you opened in this session. If you could not open one, write "(from memory, unverified)". Never base a decision only on an unverified source.
74
+ - One line per source: what it does for the gap, and what you take or reject.
75
+
76
+ Use at most about five searches. Industry input never overrides `AGENTS.md` or DESIGN.md.
77
+
78
+ ### 4. Draft plan, then design-system gate (required)
79
+
80
+ After 1–3, form a short working plan (archetype, flow, action hierarchy, key components). **Before** writing the full design-mode output, build a component inventory with one row per UI element:
81
+
82
+ | Element | Component (import name) | Variant / size | Source | Status |
83
+ | --- | --- | --- | --- | --- |
84
+
85
+ Status is one of:
86
+
87
+ - `adopted`
88
+ - `composed`: no single import (`PageContentHeader`, `ConfirmationModal`, `ConfirmationPopover`, row ⋯ menu); list the Mantine parts
89
+ - `out-of-system`: give the closest supported alternative
90
+
91
+ Each check must pass, or the row is marked `out-of-system`:
92
+
93
+ 1. The import name is not in `mantineDisallowed` in `@appdirect/ds-enforce/eslint/contracts.json` (or `dist/eslint/contracts.json`). If listed, use its `replacement`.
94
+ 2. Button variant is one of `primary`, `secondary`, `default`, `outline`, `danger`, `link`, `secret`. ActionIcon variant is one of `default`, `outline`, `link` (never `secret` on ActionIcon). Alert colour is one of `info`, `success`, `danger`, `pending`, `default`.
95
+ 3. At most one `primary` per view. Count each modal or drawer as its own view. Read-only screens may have zero.
96
+ 4. Every destructive action names its confirm overlay: `ConfirmationModal` (bulk or high-stakes) or `ConfirmationPopover` (single low-stakes item).
97
+ 5. No colour except `--ad-*` tokens. No palette props, hex, `style`, `styles`, `vars`, or `classNames`.
98
+ 6. Data grids: in micro UIs and prototypes use `src/components/Table`. `@appdirect/design-system` also ships `DataTable` (used in the design-system app and DESIGN.md examples). Treat DESIGN.md DataTable patterns (`filters`, `onFiltersChange`, `selectionActions`, row ⋯, narrow width) as **behavioural** — apply the same UX on `Table` (or on `DataTable` when the app imports it from the package).
99
+ 7. Toasts use the micro-container `ad-toast` event (`document.body.dispatchEvent(new CustomEvent('ad-toast', { detail: { title, message, type } }))`), never Mantine `Notification`.
100
+
101
+ Paste the table under "Design-system gate" in the output. Remap or mark out-of-system rows — do not present them as approved.
102
+
103
+ Only then produce the design or review output.
104
+
105
+ ## Design decisions
106
+
107
+ **Archetype:** list, detail, create/edit form, settings, dashboard, or multi-step (`Stepper`). List and detail stacks come from List page composition.
108
+
109
+ **Flow:** entry (nav item, page action, row), steps, exits, and where the user lands after success (after delete: return to the list; toast names the object).
110
+
111
+ **Action hierarchy**
112
+
113
+ - At most one `primary` CTA per view (zero is fine on read-only views).
114
+ - Page actions in `PageContentHeader` (Create, Export) — composed in apps from Mantine parts when the package does not export it.
115
+ - Bulk actions in the selection banner.
116
+ - Row actions in a ⋯ `Menu` behind `ActionIcon` (default variant) + `RiMore2Fill`, with a translated `aria-label`.
117
+ - `danger` only for destructive work, always two-step confirm: `ConfirmationModal` for bulk/high-stakes; `ConfirmationPopover` for a single low-stakes item. No type-to-confirm.
118
+ - `secondary` (cyan) deliberately; never Mantine `filled` / `light` / `subtle` / `transparent` / `white` / `gradient`.
119
+
120
+ **Filters and selection** (DataTable patterns): search always visible; extras behind the filter toggle; multi-select shows a count in the control and chips above the table (not inside the combobox); changing search/filters clears selection; cross-page selection OK under the same criteria.
121
+
122
+ **States:** first-run empty ≠ no-results ≠ cleared/completed empty (different copy and action); sparse (one row); dense / very long content (allow ~30% longer strings for i18n; truncate with `CellHoverReveal`, never by cutting copy); loading = skeletons for page/table, Button `loading` keeping the label for submit; errors = in-place `Alert` (field-level for forms, focus first error); unsaved changes warn before leave; long-running / partial bulk failure with retry; no permission = hide or disable per the permissions fact; success = `ad-toast`, not Mantine Notification. Narrow width: horizontal scroll per DataTable patterns.
123
+
124
+ **Content:** page and nav titles in Title Case, matching neighbouring nav items. Buttons and body use sentence case; buttons are verb + object ("Create subscription"). Keep the same verb through the flow ("Publish" → "Publishing…" → "Published"). Confirm copy names the object and says it cannot be undone **only when that is true**; otherwise say how to reverse it. Every string is a `translate` key.
125
+
126
+ **Accessibility:** Page micro UI: exactly one `Title order={1}` (the page header title — keep order 1 even when composing `PageContentHeader`). Widget micro UI: start at `order={2}`. Never skip levels; change look with `size`, not `order`. Icon-only controls have accessible names; overlays have titles.
127
+
128
+ ## Self-critique before showing (copy into the reply)
129
+
130
+ - [ ] Stopped at the first research step that answered the job, and wrote why later steps were skipped?
131
+ - [ ] Design-system gate table filled; nothing out-of-system unmarked?
132
+ - [ ] At most one primary per view?
133
+ - [ ] Each action at the right tier?
134
+ - [ ] Every state covered (including form validation / unsaved / async)?
135
+ - [ ] No invented DESIGN.md citations?
136
+ - [ ] Every assumption labelled?
137
+ - [ ] No TBDs, contradictions, or requirements that read two ways?
138
+
139
+ ## Design mode — output
140
+
141
+ Use these headings, then **stop** and ask the user to approve or change the spec. Do not build. Say: reply "approved" (or your changes); do not start implementation from the plan UI.
142
+
143
+ ### Summary
144
+ Job, persona, archetype.
145
+
146
+ ### Problem and success
147
+ Job story: "When \<situation\>, \<persona\> wants to \<motivation\>, so they can \<outcome\>."
148
+ Out of scope. One or two observable success signals.
149
+
150
+ ### Placement
151
+ Menu, namespace, collection, nav label (Title Case), page path if known.
152
+
153
+ ### Flow
154
+ Entry, steps, exits, success landing.
155
+
156
+ ### Layout
157
+ Per screen, top-to-bottom outline naming design-system components and variants. Optional short ASCII wireframe when it clarifies structure.
158
+
159
+ ### Data
160
+ Entity. For each field shown: name, type, display format, example value, whether it can be empty or very long, and whether it can be sorted or filtered. Expected row counts (0, 1, typical, large).
161
+
162
+ ### Actions
163
+ | Action | Tier | Component / variant | Confirm |
164
+ | --- | --- | --- | --- |
165
+
166
+ ### States
167
+ First-run, no-results, cleared/completed, sparse, loading, error, success, permission, form validation / unsaved, async / partial failure.
168
+
169
+ ### Copy
170
+ Titles, buttons, confirms, empty/error strings (as intended English; note they become `translate` keys).
171
+
172
+ ### Accessibility
173
+ Heading plan, named icon controls, overlay titles.
174
+
175
+ ### Alternatives considered
176
+ Two or three options for the riskiest decision (page vs modal vs drawer, table vs cards, wizard vs single form), each with tradeoff, plus which you chose and why.
177
+
178
+ ### Decisions
179
+ | Decision | Basis (rule / precedent / Mantine / industry / designer call) | Source |
180
+ | --- | --- | --- |
181
+
182
+ ### Sources
183
+ - AppDirect: DESIGN.md sections, precedent paths, stories, Figma nodes
184
+ - Mantine: docs / MCP items used (or "not needed")
185
+ - Industry: gap, sources with URLs (or "unverified"), takeaway — or "not needed" and why
186
+
187
+ ### Design-system gate
188
+ Paste the component inventory table. Note remaps and rejections.
189
+
190
+ ### Assumptions and open questions
191
+ Anything not backed by a rule or precedent.
192
+
193
+ ## Review mode — output
194
+
195
+ Given a screen (file path, running URL, prototype, or Figma node), run research, decisions, and self-critique against it. No edits.
196
+
197
+ Each finding:
198
+
199
+ - **Where:** file:line, URL plus region, or Figma node id
200
+ - **Severity:** 4 blocker (data loss, can't finish the job, ds-enforce fail) · 3 major · 2 minor · 1 cosmetic
201
+ - **Tag:** `rule:<section>` · `heuristic:N<1–10>` · `precedent:<path>`
202
+ - **Evidence:** quote, screenshot, or line
203
+ - **Fix:** the specific change, in design-system terms
204
+
205
+ Sort by severity. Mark low-confidence severities with "?". End with **Keep** (at most 3 bullets): what works and should not change.
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: developer-handoff
3
+ description: Use when handing a prototype or newly set-up micro UI to engineering and its team repository, micro-container route, navigation item, Jira pull requests, appconfigr flag, or integration smoke tests must be prepared.
4
+ ---
5
+
6
+ # Developer handoff
7
+
8
+ Create or reuse three focused pull requests: the team micro UI, micro-container, and navigation. Use one Jira story for all three. Never hide missing appconfigr or smoke-test setup behind a “done” report.
9
+
10
+ ## Required workspace
11
+
12
+ Work only from a Cursor workspace that already contains:
13
+
14
+ - The prototype platform or the copied micro UI.
15
+ - The empty or existing team micro UI repository.
16
+ - `micro-container`.
17
+ - `navigation`.
18
+
19
+ Treat all four repositories as workspace dependencies. Do not create or clone a missing repository. Name each missing workspace folder and stop. The team repository must have a default branch with an initial commit so the skill can open a feature pull request; if it is completely empty, tell the developer to initialize it in Teams and add it back to the workspace.
20
+
21
+ Before changing a repository, stop if it has unrelated uncommitted changes. Never overwrite another branch’s work.
22
+
23
+ ## Ask
24
+
25
+ Ask one question at a time and skip answers already provided:
26
+
27
+ 1. Prototype `owner/slug`, or confirm the current copied micro UI.
28
+ 2. Jira story key. This is required for every branch and pull request.
29
+ 3. Which workspace folder is the existing team repository, and its GitHub organization and owning team.
30
+ 4. Marketplace path.
31
+ 5. CI/CD Slack channel, default branch, and team email.
32
+ 6. Navigation namespace, collection/section, label, translation key, stable item name, and insertion position.
33
+ 7. Feature-flag key.
34
+ 8. Authorized roles and existing permission, if any. Never invent either.
35
+ 9. Page-title translation key and any nonstandard header, footer, width, or legacy-layout behavior.
36
+
37
+ Read `prototype.json`, `standalone/standalone.config.ts`, and `src/navigation/router.tsx` before asking for values those files already provide. If the name, page, or navigation metadata disagree, show the conflict and ask which production contract is correct.
38
+
39
+ ## Discover before creating
40
+
41
+ For each repository, inspect local files and GitHub before editing:
42
+
43
+ - Existing repository and default branch.
44
+ - Branches and open or merged pull requests for the Jira story.
45
+ - Existing marketplace path, Module Federation remote, menu item, and flag.
46
+ - Existing setup result and smoke-test configuration.
47
+
48
+ Reuse and update matching work. Do not create duplicate repositories, routes, menu items, branches, or pull requests. If an existing change is complete, record its link and continue.
49
+
50
+ An existing item is a duplicate only when it targets the same production page or stable item identity. A reused label such as “Invoices” with another URL or collection is not automatically a duplicate. Show the overlap and confirm placement when it could confuse users.
51
+
52
+ ## Pull request 1: existing team micro UI
53
+
54
+ ### Use the workspace dependency
55
+
56
+ Do not create or clone the repository. Confirm the named workspace folder points to the expected GitHub team repository and inspect its actual default branch. If it is completely empty, stop and ask the developer to initialize it in Teams with an initial commit.
57
+
58
+ Create a Jira-named feature branch from that default branch. Do not commit on the default branch.
59
+
60
+ Copy the full prototype folder into the repository:
61
+
62
+ ```bash
63
+ rsync -a --exclude node_modules --exclude .git prototypes/<owner>/<slug>/ <team-repo>/
64
+ ```
65
+
66
+ Keep dotfiles, `.deployments`, `.github`, `Jenkinsfile`, `Dockerfile`, and `__e2e__`.
67
+
68
+ ### Run setup once
69
+
70
+ Never run setup inside `prototypes/`. From the copied repository, run:
71
+
72
+ ```bash
73
+ npm run setup
74
+ ```
75
+
76
+ Answer with the confirmed repository name, marketplace path, Slack channel, actual default branch, and team email. Setup installs with npm for a prototype copy and requires the VPN. If it reports that setup already ran, inspect the generated project name, route, deployment files, and remote name; do not run it again.
77
+
78
+ Verify no prototype-only path or package remains. Run the repository’s lint, tests, and build.
79
+
80
+ ### Smoke tests block integration
81
+
82
+ Smoke tests are required to release on integration. Setup disables them because the template’s sealed values are not valid for the renamed secret.
83
+
84
+ The developer or deployment owner must provide newly sealed values for:
85
+
86
+ - `cypress_username`
87
+ - `cypress_password`
88
+
89
+ Update every integration deployment variables file that carries those values. The resulting Kubernetes secret is `<project>-smoke-secrets`. Do not copy plaintext credentials into git or chat, and do not claim the copied encrypted values are reusable after the secret is renamed.
90
+
91
+ The skill does not generate, request, reveal, or copy credentials. Report the exact files and secret name to the developer. After the developer installs valid sealed values, set `enableSmokeTest: true` and run the integration smoke gate. The repository command is `cd __e2e__ && npm run test:smoke` when its required environment is available. Keep the micro UI pull request in draft and report it as blocked while secrets are missing. It cannot pass the required smoke gate or release to integration until this is done. Treat `enablePostSyncTest` as a separate team decision; do not silently enable it.
92
+
93
+ Open or update the team micro UI pull request.
94
+
95
+ ## Pull request 2: micro-container route
96
+
97
+ Find the namespace file in `micro-container/src/routes/navigation/`. Reject a duplicate `pathPattern`.
98
+
99
+ Fetch the remote default branch, then create or reuse the Jira branch from that default branch. Do not build on the repository’s currently checked-out feature branch.
100
+
101
+ Add one route using setup output and the confirmed navigation contract:
102
+
103
+ ```js
104
+ route_key: {
105
+ pathPattern: '/confirmed/path',
106
+ isSecondaryNavEnabled: true,
107
+ isTertiaryNavEnabled: true,
108
+ collectionName: 'confirmed-collection',
109
+ secondaryNavItemSelected: 'confirmed-section',
110
+ verticalNavigationItemSelected: 'confirmed-item',
111
+ namespace: 'confirmed-namespace',
112
+ RemoteMicroUIurl: '/micro-ui/project-name/remoteEntry.js',
113
+ RemoteMicroUIName: 'project_name',
114
+ isVersioned: true,
115
+ reactVersion: 19,
116
+ requiredFeatureFlag: 'confirmed_flag'
117
+ }
118
+ ```
119
+
120
+ Omit tertiary fields only when the confirmed menu is not tertiary. Add `authorizedRoles` only from confirmed prototype or product requirements. Follow neighboring routes for title and layout fields; do not invent them.
121
+
122
+ Add the confirmed page path to `.deployments/micro-container/values.yaml` `defaultPaths`, using the neighboring regex style and including descendants only when the route supports them.
123
+
124
+ Run the route tests, including `src/routes/__tests__/navigation.test.js`. They enforce supported properties, unique paths and route keys, and required namespace/collection fields.
125
+
126
+ Open or update the micro-container pull request.
127
+
128
+ ## Pull request 3: navigation item
129
+
130
+ Find the exact source from the namespace and collection:
131
+
132
+ - `navigationMenus/global/<namespace>/secondaryNav.ts`, or
133
+ - `navigationMenus/global/<namespace>/tertiary/<section>.ts`.
134
+
135
+ Fetch the remote default branch, then create or reuse the Jira branch from that default branch. Do not build on the repository’s currently checked-out feature branch.
136
+
137
+ Add one item to the confirmed `menuItems` array:
138
+
139
+ ```ts
140
+ {
141
+ label: l('confirmed.translation.key'),
142
+ name: 'confirmedItem',
143
+ url: '/confirmed/path',
144
+ permission: 'confirmed-existing.permission',
145
+ flag: { key: 'confirmed_flag' }
146
+ }
147
+ ```
148
+
149
+ Omit `permission` when no existing permission was confirmed. Use the collection’s established flag shape if it differs. Keep the item in the requested position.
150
+
151
+ Update that namespace’s appconfigr mocks and repository tests. Prove the item is absent when the flag is off and present, correctly labeled, and correctly linked when it is on. Run the targeted tests and `npm run validator`; the validator checks menu and `flags.keys` shapes.
152
+
153
+ Open or update the navigation pull request.
154
+
155
+ ## Jira and pull request contract
156
+
157
+ Use the same story key everywhere.
158
+
159
+ Title:
160
+
161
+ ```text
162
+ PFM-1234: Short repository-specific summary
163
+ ```
164
+
165
+ Body, near the top:
166
+
167
+ ```markdown
168
+ ## Jira
169
+ - [PFM-1234](https://appdirect.jira.com/browse/PFM-1234)
170
+ ```
171
+
172
+ Each body explains its repository’s part of the handoff and links the other two pull requests when available. Never add a Cursor co-author.
173
+
174
+ ## Appconfigr
175
+
176
+ Do not create or pretend to create the feature flag. Tell the developer to create the exact confirmed key in appconfigr. Both the micro-container route and navigation item reference it, so the page remains unavailable until the flag exists and is enabled.
177
+
178
+ ## Final report
179
+
180
+ List every pull request, including one found rather than created:
181
+
182
+ 1. **Team micro UI** — repository, PR link, what setup produced, tests run, and smoke-secret status.
183
+ 2. **micro-container** — PR link, path, remote name/URL, navigation selection, and route flag.
184
+ 3. **navigation** — PR link, namespace/collection, item position, permission, flag, and hidden/visible tests.
185
+
186
+ Then list:
187
+
188
+ - **Jira:** linked story shared by all three PRs.
189
+ - **Appconfigr action:** exact flag key the developer must create.
190
+ - **Smoke-test action:** exact deployment files/secrets still required; state that smoke tests are required for integration release.
191
+ - **Existing work reused:** repository, routes, menu items, branches, or PRs that were found.
192
+ - **Order and blockers:** what can merge now, what depends on another PR, and why any PR remains draft or failing.