Gamut component first

From Codecademy/gamut · View interactive version

Gamut component first is an AI agent skill from the GitHub repository Codecademy/gamut. Use this skill BEFORE writing any new custom UI component, control, overlay, or interactive pattern in a codebase that depends on `@codecademy/gamut` — check whether Gamut already provides it before building bespoke markup/CSS. Triggers on requests to build/add a modal, dialog, dropdown, select, too

How to use this skill

Skill file

Gamut Component-First

Before writing a new component, control, or interactive pattern from scratch, check whether @codecademy/gamut already provides it. Building a parallel bespoke version costs more than the one-time effort: it silently bypasses ColorMode/dark-mode support, the variance/system-props styling model, the focus-trap and dismiss conventions, and the accessibility work already done in the library — and it has to be independently maintained forever after.

Source: packages/gamut/src/* (component export surface). See also: CODE1 — Check 6 audits existing code for this same problem after the fact.


The rule

  1. Name the UI need in plain language (e.g. "a way to confirm a destructive action," "a floating options list under a text input").
  2. Check the decision table below. If it names a component, use that — don't rebuild it, even partially.
  3. If the need isn't in the table, check the full component index below, or the Storybook navigation / packages/gamut/src directory listing directly.
  4. Only after a genuine miss, build custom — and prefer _composing_ existing primitives (Box/FlexBox, Overlay, FocusTrap, PopoverContainer, system props, css()/variant()/states() from @codecademy/gamut-styles) over raw markup/CSS. Composing primitives is the intended pattern, not a violation of this rule.
  5. If what you just built feels like it could be needed again elsewhere in the app (not a one-off), say so — it's a candidate for becoming a real Gamut component upstream instead of living as a silently duplicated pattern.

Decision table (common needs)

| You need... | Use | Skill / reference |

| --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |

| Confirm/cancel dialog, free-form modal, multi-step wizard | Modal, Dialog | CODE2 |

| Floating panel anchored to a trigger element | PopoverContainer | CODE1 (usage pattern) · CODE2 (stacking) |

| Action list / context menu / nav menu | Menu, MenuItem, MenuSeparator | CODE3 |

| Dropdown / combobox inside a form | SelectDropdown | Storybook: Molecules / SelectDropdown — no dedicated skill yet |

| Hover/focus tooltip, rich hover preview, inline info icon | ToolTip, PreviewTip, InfoTip (all built on Tip) | CODE4 — no dedicated Tip skill yet |

| Tabbed content switch | Tabs, Tab, TabList, TabPanel | CODE4 |

| On/off switch | Toggle | CODE1 |

| Radio button / radio group | Radio, RadioGroup | CODE2 |

| Checkbox | Checkbox | CODE1 |

| Expand/collapse section, accordion-style item list | Disclosure; a _list_ of them → List's expandable-row pattern, not repeated Disclosure | CODE3 |

| Side panel / drawer | Drawer, Flyout | CODE2 — no dedicated skill yet |

| Avatar / user image | check packages/gamut/src — search before assuming absence | Storybook — no dedicated skill yet |

| Badge / status pill / tag / chip | Badge, Tag | Storybook — no dedicated skill yet |

| Page-through control | Pagination | CODE1 |

| Toast / snackbar notification | Toast, Toaster | CODE2 |

| Date input / calendar picker | DatePicker, DatePickerInput | CODE2 |

| Progress bar / radial/circular progress | ProgressBar, RadialProgress | Storybook — no dedicated skill yet |

| Loading state / skeleton placeholder | Loading, FeatureShimmer | Storybook — no dedicated skill yet |

| Bulk-comparison table | DataTable for pure comparison; DataList if rows also need selection or expansion | CODE2 · CODE3 |

| Item list with expand/select | DataList for data-driven lists (query, selection, expansion together); List (ListRow's expanded/renderExpanded) for a small, static set of custom expandable rows | CODE5 · CODE6 |

| Fully custom repeating rows/columns | List, ListRow, ListCol, TableHeader | CODE4 |

| Alert / inline banner message | Alert | CODE1 |

| Breadcrumb trail | Breadcrumbs | Storybook — no dedicated skill yet |

| Card surface / clickable card | Card | Storybook — no dedicated skill yet |

| Button (any kind) | FillButton, StrokeButton, TextButton, CTAButton, IconButton | CODE5 |

| Page/section backdrop scrim, generic dismissable overlay | Overlay, FocusTrap, BodyPortal | CODE3 (usage pattern) · CODE4 |

| Grid/flex layout, responsive spacing | Box, FlexBox, GridBox, LayoutGrid | CODE4 · CODE5 |

| Coach mark / onboarding callout | Coachmark | Storybook — no dedicated skill yet |

| Video embed/player | Video | Storybook — no dedicated skill yet |

| Chart / bar chart | BarChart | Storybook — no dedicated skill yet |

| Skip-navigation link | SkipToContent | CODE1 |


Full component index

Every top-level directory in packages/gamut/src — check here before concluding "Gamut doesn't have this":

Alert · Anchor · Animation · Badge · BarChart · Breadcrumbs · Button/ButtonBase · Card · Coachmark · ConnectedForm · ContentContainer · DataList (includes DataTable) · DatePicker · Disclosure · Drawer · FeatureShimmer · Flyout · Form · GridForm · Layout · List · Loading · Markdown · Menu · Modals (Modal, Dialog) · Overlay · Pagination · PatternBackdrop · Popover/PopoverContainer · ProgressBar · RadialProgress · SkipToContent · Tabs · Tag · Tip (ToolTip, PreviewTip, InfoTip) · Toast/Toaster · Toggle · Typography (Text, Anchor) · Video.

If the need still isn't covered by any of these, it's a genuine gap — proceed with a custom implementation.


Signals you're about to reinvent something

Treat any of these as a prompt to stop and check the table above, even mid-implementation:


When custom actually is fine

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.