ds-skill-extraction-workshop / primer-react
AGENTS.md10 starsChanged 6 months agoMITView on GitHub
Any agent touching this skill reads SKILL.md first, then the per-domain files in references/. The routing table in SKILL.md is the dispatch contract; do not skip it. The Primer React surface is large (78 components in @primer/react@38.26.0), but this skill covers a pinned 19-component slate chosen to support the two wow prompts (form/status surfaces). If a screen the user asks for needs a component outside the slate (PageHeader, DataTable, SelectPanel, ActionMenu, ActionList, Dialog, …), say so — do not invent…
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/extract-ds-skill/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- do-workSkill
- extract-ds-skillSkill
- primer-reactSkill
The file
Files
AGENTS — primer-react
Any agent touching this skill reads SKILL.md first, then the per-domain files in references/. The routing table in SKILL.md is the dispatch contract; do not skip it.
Letter to future agents
The Primer React surface is large (78 components in @primer/react@38.26.0), but this skill covers a pinned 19-component slate chosen to support the two wow prompts (form/status surfaces). If a screen the user asks for needs a component outside the slate (PageHeader, DataTable, SelectPanel, ActionMenu, ActionList, Dialog, …), say so — do not invent a substitute from inside the slate. Coverage gaps land via the harvest convergence loop (workshop issue #33) before the final extraction run, not by hallucinating inside individual screens.
The d.ts files in node_modules/@primer/react/dist/**/*.d.ts are the canonical source. Whenever a references/components/*.md claim feels uncertain, read the d.ts line cited in the bullet and confirm. Docs sites lag; the types do not.
Primer's theming is unusual:
- The trio
data-color-mode/data-light-theme/data-dark-themelives on<html>. - The attribute values use underscores (
dark_dimmed) while the matching theme CSS file names use dashes (dark-dimmed.css). Mixing them produces a silent fallback to the default theme. - Mode attributes only set the resolution context. The actual values come from theme CSS files. Both
light.cssANDdark.cssmust be@import-ed inglobals.csswhendata-color-mode="auto"is set.
<BaseStyles> is the body-painting wrapper. <ThemeProvider> is the React-context provider that drives useTheme() and the colorMode="auto" runtime preference detection. They wrap together — the provider on the outside, BaseStyles inside, children inside BaseStyles.
Common agent failure modes
- Painting a card with
var(--bgColor-default)while the body stays browser-default white. Token-painted component on an unpainted shell — the canonical mode-mismatch bug. Seereferences/anti-patterns.mdshell/unpainted-body. - Copy-pasting the Setup shell with
height: "100vh"into a content app. The reference project is a single-screen showcase; a fixed height clips any page taller than the viewport and kills scrolling. UseminHeightfor the fill-the-viewport intent. Seeshell/fixed-viewport-height. - Setting
data-color-mode="auto"without importingdark.css. The mode attribute toggles but functional tokens never resolve in dark mode. Seeshell/mode-attribute-without-theme-import. - Treating Label as a lifecycle pill. Label is metadata (
accent,success,attention,danger,done, …). For PR/issue open/closed/merged states, use StateLabel — its requiredstatusis keyed to the lifecycle octicon map. Seereferences/components/state-label.md. - Wrapping BranchName around a
<span>by passingchildren={<span>main</span>}. BranchName already renders an<a>(as: Component = 'a'). For a non-link branch chip, passas="span"directly on BranchName. Seereferences/components/branch-name.md. - Adding a tooltip to an IconButton with a
descriptionprop and a visible label. IconButton'saria-labelIS the accessible name AND the tooltip — duplicating it asdescriptionproduces a redundant ARIA announcement. Usedescriptiononly for additional context beyond the label. Seereferences/components/icon-button.md. - Passing
styleto an octicon to color it. OcticonIconPropsis a closed surface (aria-label/className/fill/size/verticalAlign) —stylefails typecheck. Wrap in a parent that setscolor; the SVG inherits viafill="currentColor". Seereferences/foundations/octicons.mdasset/closed-prop-surface. - Treating a Select
placeholderas non-selectable. The placeholder doubles as the implicit default (defaultValue ?? placeholder) and its empty option is onlydisabled/hiddenwhenrequiredis set. Seereferences/components/select.md. - Lining up two form controls with
Stack align="end"when only one has a caption. Stack aligns boxes, not baselines — the captioned control's label rides up. Seereferences/components/stack.mdandreferences/components/form-control.md. - Importing from
@primer/react/lib-esm/<Component>because it "feels more direct". Only@primer/react(root barrel) is public — internal paths break across version bumps. See SKILL.md "Import rules". - Adding a Flash
variant="info"because most banner systems have one. Primer Flash has onlydefault | warning | success | danger. If the source d.ts does not export it, it does not exist. Seereferences/components/flash.md. - Reaching for
Stack direction="row". The Primer scale useshorizontal | vertical, not the CSS flexbox vocabulary. Seereferences/components/stack.md. - Setting
Stack gap="xs"orStack justify="around". Primer Stack has a named scale (none | tight | condensed | cozy | normal | spaciousfor gap;start | center | end | space-between | space-evenlyfor justify). The Tailwind/CSS shortcuts do not exist on this surface.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

