agentleFS
komlukkomluk/scaffolding/skills/mui-styling/SKILL.md

mui-styling

Skill16 starsChanged 5 days agoMITView on GitHub

Material-UI (MUI) styling standards: sx-prop priority, theme tokens, spacing scale, responsive design, and accessibility. TRIGGER when: styling MUI components, defining theme tokens, or building responsive layouts. SKIP: component logic and hooks (use react-patterns); cross-stack UX/design decisions (use ui-ux-pro-max).

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use sx prop for one-off styles

    line 199
  2. Very specific:

    Use styled() for reusable styled components

    line 200
  3. Distinctive:

    Use responsive object syntax

    line 202
  4. Distinctive:

    Create inline style objects (new reference each render)

    line 205
  5. Distinctive:

    Use CSS-in-JS libraries alongside MUI

    line 207
  6. Very specific:

    Do NOT use raw hex colors - use colors.* tokens

    line 315
  7. Very specific:

    Do NOT write inline boxShadow - use glows.* presets

    line 316
  8. Very specific:

    Do NOT create new button styles - use componentStyles.*Button

    line 317
  9. Very specific:

    Do NOT hardcode font families - use fonts.mono / fonts.monoExtended

    line 318

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

MUI Styling Skill

Material-UI styling standards and best practices.

When to Apply

  • Creating styled components
  • Implementing responsive design
  • Theme customization
  • UI consistency review

Styling Approach Priority

PriorityApproachUse When
1stsx propMost styling needs
2ndstyled() APIReusable styled components
3rdTheme overridesGlobal component defaults
AvoidInline CSS / CSS filesNever use in MUI projects

Spacing System

Spacing Scale

ValuePixelsUsage
0.54pxTight spacing
18pxDefault small
216pxDefault medium
324pxSection spacing
432pxLarge spacing

Spacing Props

PropCSS Property
mmargin
ppadding
mt, mr, mb, mlmargin-top/right/bottom/left
pt, pr, pb, plpadding-top/right/bottom/left
mx, mymargin x/y axis
px, pypadding x/y axis
gapflex/grid gap

Color System

Theme Colors

CategoryValues
Primaryprimary.main, primary.light, primary.dark, primary.contrastText
Secondarysecondary.main, secondary.light, secondary.dark
Statuserror.main, warning.main, info.main, success.main
Greygrey.100 through grey.900
Backgroundbackground.default, background.paper
Texttext.primary, text.secondary, text.disabled

Color Usage Guidelines

Use CaseColor
Primary actionsprimary.main
Secondary actionssecondary.main
Error stateserror.main
Success feedbacksuccess.main
Backgroundsbackground.paper or background.default
Body texttext.primary
Helper texttext.secondary

Responsive Design

Breakpoints

KeyMin WidthTarget
xs0pxMobile phones
sm600pxTablets portrait
md900pxTablets landscape
lg1200pxDesktops
xl1536pxLarge screens

Responsive Syntax

SyntaxDescription
{ xs: value }Mobile first, applies to xs and up
{ sm: value }Applies to sm and up
Object syntax{ xs: '100%', sm: 400, md: 600 }

Responsive Guidelines

GuidelineDescription
Mobile firstStart with xs, override for larger
Test all breakpointsVerify layout at each breakpoint
Use relative unitsPrefer %, vh, vw over fixed px
Hide/show elementsUse display: { xs: 'none', md: 'block' }

Layout Components

Component Selection

ComponentUse When
BoxGeneric container, flexbox layouts
StackVertical/horizontal lists with spacing
Grid12-column grid layouts
ContainerCentered max-width wrapper

Flexbox with Box

PropertyValues
display'flex', 'inline-flex'
flexDirection'row', 'column'
justifyContent'flex-start', 'center', 'space-between'
alignItems'flex-start', 'center', 'stretch'
gapSpacing value (1, 2, 3...)

Grid System

PropDescription
containerDefines grid container
itemDefines grid item
xs, sm, md, lgColumns at breakpoint (1-12)
spacingGap between items

Typography Standards

Variant Usage

VariantUse For
h1 - h6Headings (use semantic hierarchy)
body1Primary body text
body2Secondary body text
captionSmall helper text
buttonButton text

Typography Guidelines

GuidelineDescription
Semantic hierarchyh1 > h2 > h3 (don't skip levels)
Color for emphasisUse text.secondary for less important
Consistent variantsSame content type = same variant

Component Styling Standards

Button Styling

VariantUse When
containedPrimary actions
outlinedSecondary actions
textTertiary actions, links

Card Styling

ElementStandard
Paddingp: 2 or p: 3
Border radiusUse theme default
ShadowUse theme shadows (1-24)

Form Styling

ElementStandard
TextFieldfullWidth for forms
SpacingStack spacing={2} between fields
LabelsAlways provide label prop

Anti-Patterns

AvoidUse Instead
Inline CSS objectssx prop with theme values
!importantIncrease specificity via sx
Fixed pixel valuestheme.spacing() values
Hardcoded colorstheme.palette colors
CSS classessx prop or styled()
External CSS filesMUI styling system

Performance Guidelines

DO

  • Use sx prop for one-off styles
  • Use styled() for reusable styled components
  • Leverage theme values for consistency
  • Use responsive object syntax

DON'T

  • Create inline style objects (new reference each render)
  • Override theme styles unnecessarily
  • Use CSS-in-JS libraries alongside MUI
  • Nest sx props deeply

Accessibility Standards

StandardImplementation
Color contrastUse theme colors (WCAG compliant)
Focus indicatorsDon't remove, customize if needed
Touch targetsMinimum 44x44px for buttons
Semantic HTMLUse correct MUI component for purpose

Code Review Checklist

  • Uses sx prop or styled(), not inline CSS
  • Colors from theme palette
  • Spacing from theme scale
  • Responsive breakpoints applied
  • No hardcoded pixel values
  • Typography variants used correctly
  • Accessibility standards met

Example: Centralized Theme Module (illustrative)

Illustrative — this is one team's convention shown as a concrete example. Substitute your project's own theme tokens, palette, and component-style helpers. The pattern (centralize colors/shadows/component styles in a theme module and reference tokens instead of raw values) is the reusable part; the specific neon-cyberpunk values below are just an example.

Theme: Neon Cyberpunk (Dark Mode Only)

Font: "Ubuntu" (UI), "Ubuntu Mono" (code/terminal). Theme at <your-theme-module>/index.ts.

Color Palette (<your-theme-module>/colors.ts)

colors.background.primary   // '#0D0D0D' - page background
colors.background.secondary // '#121212' - AppBar, Drawer
colors.background.surface   // '#1E1E1E' - cards, paper
colors.background.elevated  // '#252525' - hover states
colors.background.input     // '#1A1A1A' - text fields

colors.neon.cyan     // '#00FFFF' - primary actions, focus rings
colors.neon.lime     // '#39FF14' - secondary actions, success
colors.neon.red      // '#FF1744' - errors, danger
colors.neon.yellow   // '#FFEA00' - warnings
colors.neon.orange   // '#FF9100' - cancelled status
colors.neon.purple   // '#E040FB' - accents
colors.neon.green    // '#00E676' - success variant

colors.text.primary   // '#F0F0F0'
colors.text.secondary // '#888888'
colors.text.muted     // '#666666'
colors.border.primary // '#2A2A2A'

Alpha Helpers (<your-theme-module>/colors.ts)

alpha.cyan(0.08)   // hover backgrounds
alpha.cyan(0.16)   // selected backgrounds
alpha.red(0.1)     // error backgrounds
alpha.lime(0.1)    // success backgrounds

Glow Effects (<your-theme-module>/glows.ts)

glows.cyan         // '0 0 15px rgba(0,255,255,0.4)' - standard
glows.cyanLight    // '0 0 10px rgba(0,255,255,0.2)' - subtle (buttons, inputs)
glows.cyanStrong   // dual shadow for hover emphasis
glows.terminalInset// inset shadow for terminal containers
statusGlows[status]// per-TaskStatus glow effects

componentStyles (<your-theme-module>/componentStyles.ts)

Pre-built SxProps<Theme> objects. Apply via spread in sx prop:

import { componentStyles } from '../theme';

<Button sx={componentStyles.primaryButton}>Submit</Button>
<Button sx={componentStyles.dangerButton}>Delete</Button>
<IconButton sx={componentStyles.iconButtonDanger}>...</IconButton>
<TextField sx={componentStyles.textField} />
<Box sx={componentStyles.terminal}>output here</Box>
<Box sx={componentStyles.statusBadge('running')}>Running</Box>
<Alert sx={componentStyles.alertError}>Error msg</Alert>
<Typography sx={componentStyles.sectionHeader}>SECTION</Typography>

Available styles: primaryButton, secondaryButton, dangerButton, ghostButton, iconButton, iconButtonDanger, iconButtonSuccess, iconButtonPrimary, selectorButtonSidebar, selectorButtonHeader, textField, textFieldSmall, dialog, terminal, statusBadge(status), alertError, alertSuccess, dangerButtonContained, sectionHeader, menuHeader, scrollbar, alertBackendOffline, resizeHandle(isResizing), liveBadge, collapsibleSection(expanded), pulsingDot.

Animations (global keyframes in theme)

  • pulse - opacity fade for running indicators
  • neonPulse - scale+opacity for status dots
  • neonBlink - cursor blink
  • liveGlow - streaming indicator glow
  • subtleBgPulse - running task row background

Usage: animation: 'liveGlow 2s ease-in-out infinite'

Example Anti-Patterns (for the theme module above)

  • Do NOT use raw hex colors - use colors.* tokens
  • Do NOT write inline boxShadow - use glows.* presets
  • Do NOT create new button styles - use componentStyles.*Button
  • Do NOT hardcode font families - use fonts.mono / fonts.monoExtended

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.