Stylecheat

The skill that teaches AI agents to write Stylecheat, shown as it is: SKILL.md first, then its four reference files.

skill.md

Stylecheat

Classless/hybrid CSS component library. Docs: https://stylecheat.korte.kim/ | Downloads: https://stylecheat.korte.kim/download

Setup

First time in a project without stylecheat: ask which variant to use:

  • class-less (recommended): custom elements and attributes (<crow>, button[primary])
  • class-based: traditional classes (.button.primary)
  • hybrid: both, mixed freely in one project
index.html

Direct Download URLs

  • Class-less: https://stylecheat.korte.kim/download/class-less/stylecheat.css
  • Class-based: https://stylecheat.korte.kim/download/class-based/stylecheat.css
  • Hybrid: https://stylecheat.korte.kim/download/hybrid/stylecheat.css

Each folder also has stylecheat-stable.css, which leaves out ChromeOnlyModifiers.css.

Critical: Turn Stylecheat On

Every build scopes its styles under .stylecheat, [stylecheat] - mark the element that should get Stylecheat, usually <body>:

index.html

Both forms work in every build. Without one of them, no component styles will apply.

Core Concepts

Unit System

--unit: 4px - all spacing uses calc(var(--unit) * N)

Conversion rule: Values ≤32px (N ≤ 8) use units. Larger values stay as literal px.

styles.css

Size Modifiers

sm, md, lg on any element set --unit and --unit-size, which children inherit:

index.html
Attr--unit--unit-size
sm2.67px12px
md4px16px
lg5.33px21.33px

sm never sets text below 12px. lg scales with the parent's font size (values shown at 16px). On buttons, selects and text inputs, sm and lg change --unit only, so the control gets shorter or taller while its text keeps its size.

Display Preference

When choosing between block, grid, or flex, prioritize flex.

Theme Variables

Always use theme variables for dark/light mode support. The full list is in references/theming.md.

Elements, Layout, Typography and Theming

Icons

Icons use attribute syntax:

index.html

For icons beyond the built-in ones, download them as icon CSS in the same icon[name] format.

Utilities

Spacing

Gap, margin, padding — g-1 to g-8 (plus g-10, g-12, g-16), p-1 to p-8, m-1 to m-8, plus directional variants (mt-, mb-, ml-, mr-, mx-, my-, px-, py-, pt-, pb-, pl-, pr-). Negative margins take a double dash: mt--4, mx--2:

index.html

Flex and size modifiers are in references/layout.md.

Display

index.html

Surface

index.html

Color

index.html

bg-* uses 20% opacity: oklch(from var(--color) l c h / 0.2)

Responsive Modifiers

Breakpoints: sm (≤768px), md (768–1024px), lg (>1024px)

index.html

Available responsive modifiers: sm:hide, sm:flex, sm:block, sm:vertical, sm:order-first, sm:sm, sm:md, sm:lg, and every flex, gap, size and spacing modifier — sm:f-1, sm:g-4, sm:w-full, sm:h-0, sm:max-w-96, sm:p-4, sm:px-0, sm:mx--4 (and md:*, lg:* equivalents). sm:vertical switches a <crow> to flex-direction: column on mobile. Carousels switch axis on mobile with sm:x, sm:y or sm:z on <slides>.

Layout

Crow

Flexbox layout component. Default: display: flex; align-items: center; justify-content: center.

Basic Usage

index.html

Alignment Attributes

Horizontal
AttributeEffect
leftjustify-content: flex-start
rightjustify-content: flex-end
(none)justify-content: center
Vertical
AttributeEffect
upalign-items: flex-start + height: 100%
downalign-items: flex-end + height: 100%
(none)align-items: center

Vertical Mode

Add vertical to stack items in a column:

index.html

In vertical mode, up/down swap to justify-content and left/right swap to align-items.

Class-based Variant

index.html

Common Patterns

Navbar

index.html

Space Between

index.html

Card Grid

index.html

Form Layout

index.html

Full-height Sidebar

index.html

Flex Utilities

Use f-1 through f-8 to set flex ratios, f-0 for flex: none:

index.html

Size Utilities

index.html

Sizes run 0–8, then 10, 12, 16, 18, 20, 24, 32, 36, 40, 48, 60, 64, 72, 96, 128 and 160.

Typed w/h attributes multiply by --unit (Chrome 133+):

index.html

Responsive Modifiers

Breakpoints: sm (≤768px), md (768–1024px), lg (>1024px)

index.html

Available per breakpoint: hide, flex, block, vertical, order-first, sm, md, lg, plus every flex, gap, size and spacing modifier (sm:f-1, sm:g-4, sm:w-full, sm:p-4, sm:mx--4)

Example: sm:vertical switches a <crow> to flex-direction: column on mobile.

Components

Variant is mandatory on button and a. Stylecheat only styles these elements when they carry a variant: primary, secondary, or tertiary on buttons, primary or secondary on links (selector: a:is([primary],[secondary])). A bare <button>/<a href> matches nothing in Stylecheat and falls back to raw browser defaults (a bare link renders blue and underlined, which always reads as a bug) — there is no such thing as a "plain Stylecheat link/button". Always pick a variant; when emphasis is unclear, default to secondary.

Button

Three variants: primary, secondary, tertiary. Default to secondary when adding new buttons.

index.html

Icon goes directly inside — no crow wrapper needed (line-height: 1em):

index.html

Link

primary/secondary are inline text links (accent vs. muted). For inline links in body text, default to primary. When writing or reviewing markup, treat a variant-less <a> as an error and fix it (custom-styled exceptions like a logo link need their own selector).

A link that should look like a button needs class="button" plus a button variant — that combination is what gives an <a> the button styling:

index.html

Badge

Pill-shaped label. Default variant uses --primary. Combine bg-* + text-* for color variants:

index.html

Card

Container with border, padding, and theme colors:

index.html

Card has built-in padding, so there's no need to add p-*.

Accordion

Expandable content via CSS grid animation. Toggle open attribute to expand:

index.html

Icon flip on open — CSS only via :has():

styles.css

class-based: .accordion, .accordion.open, .accordion-content

Carousel

Full-size scroll container. Wrap in <carousel>, then use <slides> with an axis attribute:

index.html
<slides> attrBehaviour
xHorizontal scroll-snap
yVertical scroll-snap
zZ-axis fade/scale transition (scroll-driven animation)
sm:x / sm:y / sm:zSwitch axis at ≤768px, e.g. <slides z sm:y> — z's pinned slides can't be swiped on touch screens, so give phones y
scrollbarShow scrollbar (hidden by default)

<slide> is the snap target; content goes inside it. Carousel sets container-type: size.

Stack

All children occupy the same grid cell — layered on top of each other:

index.html

Circle

Circular element. Size via a size modifier (or the typed w="N" attr, if the project is using ChromeOnlyModifiers.css):

index.html

width: 100%; aspect-ratio: 1; border-radius: 100%

HR

Full-width fading divider line:

index.html

Gradient from transparent → --border → transparent.

Grid

Background grid pattern for design/layout previews. --grid-size defaults to calc(var(--unit) * 12):

index.html

[locked] fixes the grid position; without it the grid scrolls with content. When used on <slides grid> with x/y/z, the grid animates to match scroll position.

Text Input

index.html

Styled automatically for all text-like input types (text, email, password, number).

TextArea

index.html

Select

index.html

Checkbox

index.html

Switch

Toggle switch — checkbox with role="switch":

index.html

Radio

index.html

Range

index.html

Theming

Dark/Light Mode

Toggle with .dark class on a parent element (typically html or body):

index.html script.js

Theme Variables

All colors use OKLCH format for consistent manipulation:

Semantic Colors

VariableLightDarkUsage
--backgroundLight grayDark bluePage background
--foregroundDark grayLight grayText color
--primaryOrangeOrangePrimary actions
--secondaryLight grayDark graySecondary elements
--mutedVery lightDarkSubdued backgrounds
--accentLight blueDark blueHighlights
--destructiveRedRedDelete/danger actions

Each color has a -foreground variant for text on that background.

Component-specific

  • --card, --card-foreground - Card backgrounds
  • --popover, --popover-foreground - Dropdowns, tooltips
  • --border - Border color
  • --input - Form input backgrounds
  • --ring - Focus rings

Sidebar

Separate variables for sidebar theming:

  • --sidebar, --sidebar-foreground
  • --sidebar-primary, --sidebar-accent
  • --sidebar-border, --sidebar-ring

Color Manipulation with OKLCH

Use oklch(from var(...)) for color variants:

styles.css

Fonts

styles.css

Radius & Shadows

styles.css

Customizing Theme

Override variables in your CSS:

styles.css

Typography

Typography Wrapper

Visual heading styles (size, color, weight) apply globally. Sibling spacing requires a [typography] or .typography wrapper — use the <typography> custom element:

index.html

Spacing is automatic inside the wrapper — no manual margin classes needed for prose.

Heading Sizes

All headings: font-weight: 600, color: var(--primary)

ElementSizeLine-height
h1calc(var(--unit) * 10) = 40pxcalc(var(--unit) * 12)
h2calc(var(--unit) * 7) = 28pxcalc(var(--unit) * 8)
h3calc(var(--unit) * 6) = 24pxcalc(var(--unit) * 8)
h4calc(var(--unit) * 5) = 20pxcalc(var(--unit) * 8)
h5calc(var(--unit) * 4) = 16pxcalc(var(--unit) * 4)
h6calc(var(--unit) * 3.5) = 14pxcalc(var(--unit) * 4)

Class equivalents: .h1 through .h6

Body Text

Paragraphs: line-height: 1.6, no default margins.

Lists

  • padding-inline-start: calc(var(--unit) * 6) (24px)
  • Marker color: slightly lighter than foreground

Inline Elements

ElementStyling
codeMono font, 14px, secondary background, rounded
preBlock code, 14px, padding, secondary background, rounded
markAccent background
smallcalc(var(--unit) * 3.5) = 14px
blockquote / quoteLeft border, italic, muted color
strong / bfont-weight: 600, slightly lighter foreground

Sibling-Aware Spacing (inside [typography])

After Elements

ElementMargin-top on next sibling
h1, h2calc(var(--unit) * 3) = 12px
h3–h6calc(var(--unit) * 2) = 8px
pcalc(var(--unit) * 3) = 12px
ul, olcalc(var(--unit) * 3) = 12px
blockquote, quote, precalc(var(--unit) * 4) = 16px

Before Headings (Section Breaks)

ElementMargin-top
* + h1calc(var(--unit) * 8) = 32px
* + h2calc(var(--unit) * 7) = 28px
* + h3calc(var(--unit) * 6) = 24px
* + h4calc(var(--unit) * 5) = 20px
* + h5, * + h6calc(var(--unit) * 4) = 16px

Horizontal Rules

hr + * and * + hr: calc(var(--unit) * 6) = 24px

AI skill


Stylecheat Introduction Context CardCircleCrowGridSidebarStackSticky AccordionBadgeBreadcrumbCarouselCodeHrIconLinkTableTabsTooltipTypography ButtonSwitchCheckboxRadioRangeProgressSelectTextinputTextarea Modifiers LoginCarouselElementsContent flowIcons Download v1.0.0
Stylecheat