|
| 1 | +--- |
| 2 | +name: component-audit |
| 3 | +description: > |
| 4 | + Audit page files to find custom UI elements that could be replaced with existing shared |
| 5 | + components from the AzureStorybook library or Fluent UI. Use this skill whenever the user |
| 6 | + asks to "audit components", "find custom components", "check for missing shared components", |
| 7 | + "what components am I not using from storybook", or after building/editing a page to verify |
| 8 | + nothing was re-invented. Also use when the user says "component check", "storybook audit", |
| 9 | + or "what did I build that already exists". |
| 10 | +--- |
| 11 | + |
| 12 | +# Component Audit |
| 13 | + |
| 14 | +Scan page `.tsx` files for custom HTML/CSS patterns that duplicate functionality already |
| 15 | +provided by the **@azure-fluent-storybook/components** shared component library or **Fluent UI v9**. The goal |
| 16 | +is to surface every piece of hand-rolled UI that has a ready-made replacement so the |
| 17 | +developer can decide whether to swap it in. |
| 18 | + |
| 19 | +## When to run |
| 20 | + |
| 21 | +- After building or significantly editing a page (post-build review step) |
| 22 | +- On demand when the user asks to check component coverage |
| 23 | +- As part of a broader UI verification pass |
| 24 | + |
| 25 | +## How it works |
| 26 | + |
| 27 | +### Step 1 — Load the component registry |
| 28 | + |
| 29 | +Read the AzureStorybook component registry to get the authoritative list of shared |
| 30 | +components and their capabilities. Call `getComponentList` and `getComponentsProps` from |
| 31 | +Storybook MCP to get the latest component information. |
| 32 | + |
| 33 | +Also reference the component catalog doc for props and usage patterns: |
| 34 | + |
| 35 | +``` |
| 36 | +.github/skills/page-builder/references/component-catalog.md |
| 37 | +``` |
| 38 | + |
| 39 | +### Step 2 — Read the target page file(s) |
| 40 | + |
| 41 | +If the user specifies a file, audit that file. Otherwise, audit all `.tsx` files under |
| 42 | +`src/pages/`. |
| 43 | + |
| 44 | +For each file, extract: |
| 45 | +1. **Imports** — which `@azure-fluent-storybook/components` and `@fluentui/react-components` |
| 46 | + are already being used |
| 47 | +2. **Style definitions** — all keys inside `makeStyles({...})` |
| 48 | +3. **JSX markup** — the rendered component tree |
| 49 | + |
| 50 | +### Step 3 — Detect custom UI patterns |
| 51 | + |
| 52 | +Look for these categories of re-invention: |
| 53 | + |
| 54 | +#### A. Custom HTML elements that map to shared components |
| 55 | + |
| 56 | +| Custom pattern | Likely replacement | |
| 57 | +|---|---| |
| 58 | +| `<button>` with icon + label styled as a card | `CardButton` | |
| 59 | +| `<nav>` or `<div>` with list of links/items | `SideNavigation` | |
| 60 | +| `<div>` with key-value pairs in two columns | `EssentialsPanel` | |
| 61 | +| `<div>` acting as a toolbar with icon buttons | `CommandBar` | |
| 62 | +| `<div>` styled as breadcrumbs with `>` separators | `AzureBreadcrumb` | |
| 63 | +| `<div>` with title + icon + pin/star/more actions | `PageHeader` / `PageTitleBar` | |
| 64 | +| `<div>` styled as tabs with click handlers | `PageTabs` (or Fluent `TabList`) | |
| 65 | +| `<div>` styled as a tag/chip/pill | `FilterPill` (or Fluent `Badge`) | |
| 66 | +| `<div>` styled as a step wizard | `WizardNav` | |
| 67 | +| `<div>` styled as a flyout/panel overlay | `ServiceFlyout` (or Fluent `Dialog`) | |
| 68 | +| `<div>` with metric/status card layout | `HealthStatusCard` | |
| 69 | +| `<div>` with "no data" illustration + message | `NullState` | |
| 70 | +| `<div>` with search box + hero banner | `SearchBanner` | |
| 71 | +| `<img>` loading from `public/azure-icons/` directly | `AzureServiceIcon` | |
| 72 | + |
| 73 | +#### B. Custom styles that duplicate Fluent UI capabilities |
| 74 | + |
| 75 | +| Custom style pattern | Likely replacement | |
| 76 | +|---|---| |
| 77 | +| Hardcoded `color`, `background-color` hex values | Fluent `tokens.*` | |
| 78 | +| Hardcoded `font-size`, `font-weight` values | Fluent typography tokens | |
| 79 | +| Custom `box-shadow` values | Fluent shadow tokens | |
| 80 | +| Custom border-radius values | Fluent `tokens.borderRadius*` | |
| 81 | +| Manual `display: grid/flex` for data tables | Fluent `DataGrid` | |
| 82 | +| Manual `display: flex` toggle/switch | Fluent `Switch` | |
| 83 | +| Custom `<input>` styling | Fluent `Input` / `Field` | |
| 84 | +| Custom `<a>` link styling | Fluent `Link` | |
| 85 | + |
| 86 | +#### C. Inline styles on shared components |
| 87 | + |
| 88 | +Look for `style={{...}}` props applied to shared components that override their |
| 89 | +built-in styling. These often indicate the component isn't being used correctly, or |
| 90 | +that a variant/prop exists for the desired behavior. |
| 91 | + |
| 92 | +### Step 4 — Generate the audit report |
| 93 | + |
| 94 | +Output a structured report in this format: |
| 95 | + |
| 96 | +``` |
| 97 | +# Component Audit Report — [FileName] |
| 98 | +
|
| 99 | +## Summary |
| 100 | +- Components from Storybook: N used |
| 101 | +- Custom UI patterns found: N |
| 102 | +- Potential replacements: N |
| 103 | +
|
| 104 | +## Custom Patterns Found |
| 105 | +
|
| 106 | +### 1. [Description of custom element] |
| 107 | +- **Location:** Lines X–Y |
| 108 | +- **What it does:** [brief description] |
| 109 | +- **Suggested replacement:** `ComponentName` from `@azure-fluent-storybook/components` |
| 110 | +- **Confidence:** High / Medium / Low |
| 111 | +- **Notes:** [why this is or isn't a clear swap] |
| 112 | +
|
| 113 | +### 2. [Next pattern] |
| 114 | +... |
| 115 | +
|
| 116 | +## Already Using (✓) |
| 117 | +- `AzureGlobalHeader` — top nav |
| 118 | +- `CardButton` — service shortcuts |
| 119 | +- ... |
| 120 | +
|
| 121 | +## Not Applicable |
| 122 | +List any Storybook components that exist but aren't relevant for this page type |
| 123 | +(e.g., `WizardNav` isn't needed on a home page). |
| 124 | +``` |
| 125 | + |
| 126 | +### Confidence levels |
| 127 | + |
| 128 | +- **High** — The custom markup is a near-exact replica of what the shared component |
| 129 | + renders. Straightforward swap. |
| 130 | +- **Medium** — The custom markup serves the same purpose but has minor differences |
| 131 | + (extra props, different layout). Would require checking the shared component's props |
| 132 | + to confirm feasibility. |
| 133 | +- **Low** — The custom markup is in the same "family" but may be intentionally |
| 134 | + different. Flagged for awareness rather than as a hard recommendation. |
| 135 | + |
| 136 | +## Important constraints |
| 137 | + |
| 138 | +- Do NOT modify any files — this skill is read-only / diagnostic |
| 139 | +- Do NOT suggest replacements that would lose functionality the custom code has |
| 140 | +- Fluent UI v9 components (`@fluentui/react-components`) are also valid — not |
| 141 | + everything needs to come from AzureStorybook |
| 142 | +- AzureStorybook wraps Fluent in many cases, so prefer AzureStorybook when both exist |
| 143 | + (e.g., prefer `PageTabs` over raw `TabList` if `PageTabs` covers the use case) |
| 144 | +- If a custom component is genuinely novel (no shared equivalent exists), say so |
| 145 | + explicitly and suggest it as a candidate for extraction into AzureStorybook |
0 commit comments