--- name: ui-doctor description: Audit and validate that an application correctly uses IDS (Iress Design System) components, follows IDS principles, and meets compliance requirements. This skill helps AI agents perform comprehensive UI reviews, identify areas where native HTML or third-party elements should be replaced with IDS components, assess adherence to IDS design principles, and produce actionable reports with recommendations. --- # Skill: UI Doctor Audit and validate that an application correctly uses IDS (Iress Design System) components, follows IDS principles, and meets compliance requirements. This skill helps AI agents perform comprehensive UI reviews, identify areas where native HTML or third-party elements should be replaced with IDS components, assess adherence to IDS design principles, and produce actionable reports with recommendations. ## When to Use - Reviewing an application's UI code for IDS compliance - Validating that IDS components are used where possible instead of raw HTML or custom implementations - Assessing design token usage and consistency - Generating a UI health report with an IDS compliance score - Providing recommendations to improve IDS adoption and consistency ## Audit Scope Before starting the audit, determine which files to scan and which to exclude. ### Files to Scan - All `.tsx`, `.jsx`, `.ts`, `.js` files in `src/` (or the application source directory) - CSS/SCSS/styled-component files for hardcoded design values - Application entry point(s) for Provider and CSS import checks ### Files to Exclude - **Test files** (`*.test.tsx`, `*.spec.tsx`, `__tests__/`) — test mocks and utilities may legitimately use raw HTML - **Storybook stories** (`*.stories.tsx`) — stories may intentionally demonstrate raw HTML for comparison - **Configuration files** (`*.config.ts`, `*.config.js`) — not UI code - **Type definition files** (`*.d.ts`) — no runtime UI code - **Third-party code** (`node_modules/`, vendored libraries) — outside the application's control - **Build output** (`dist/`, `build/`) — generated code ### Version-Aware Auditing IDS is currently on **version 6**. When auditing applications: - **Check the installed IDS version** — Look at `package.json` for `@iress-oss/ids-components` version - **v6 applications** — Apply all rules in this skill as-is - **v5 applications** — Some patterns differ (e.g., `IressForm` API changes between v5 and v6). Flag v5-specific patterns as "migration opportunities" rather than "non-compliant". Key v5→v6 differences include: - `IressForm` now uses `rules` prop for validation instead of built-in validation props - `react-hook-form` is now a peer dependency - Form state management moved from `useState` to React Hook Form's `useWatch`/`ref` - **Pre-v5 applications** — Flag as requiring a major migration and prioritise Provider/CSS setup first - **Always note the version** in the audit report header ## Audit Process ### 1. Validate IDS Component Usage Scan the application code for raw HTML elements, third-party UI components, and custom implementations that have IDS equivalents. Flag instances where IDS components should be used instead. #### Third-Party UI Library Detection Check for imports from third-party UI libraries that overlap with IDS. Common libraries to flag: | Third-Party Library | Common Imports to Flag | IDS Replacement | | ----------------------------------- | --------------------------------------------------------- | ------------------------------ | | Material UI (`@mui/*`) | `Button`, `TextField`, `Select`, `Modal`, `Table`, `Tabs` | Equivalent `Iress*` components | | Ant Design (`antd`) | `Button`, `Input`, `Select`, `Modal`, `Table`, `Tabs` | Equivalent `Iress*` components | | Chakra UI (`@chakra-ui/*`) | `Button`, `Input`, `Select`, `Modal`, `Table` | Equivalent `Iress*` components | | React Bootstrap (`react-bootstrap`) | `Button`, `Form`, `Modal`, `Table`, `Nav` | Equivalent `Iress*` components | | Radix UI (`@radix-ui/*`) | `Dialog`, `Popover`, `Tooltip`, `Tabs`, `Select` | Equivalent `Iress*` components | | Headless UI (`@headlessui/react`) | `Dialog`, `Popover`, `Menu`, `Tab`, `Switch` | Equivalent `Iress*` components | **How to detect:** Search for import statements matching these package names. Any UI component imported from a third-party library that has an IDS equivalent should be flagged as a **High** priority replacement. ```typescript // ❌ Third-party UI component — should use IDS import { Button } from '@mui/material'; import { Modal } from 'antd'; import { Dialog } from '@radix-ui/react-dialog'; // ✅ IDS components import { IressButton, IressModal } from '@iress-oss/ids-components'; ``` #### HTML Element → IDS Component Replacement Map | Raw HTML / Custom Code | IDS Replacement | Priority | | --------------------------------------- | ----------------------------------------------------- | -------- | | `