Bricks design systems
Use when creating or updating design tokens: global classes, variables, color palettes, theme styles, components. Enforces uniqueness, scale-generator usage, and conditions on theme styles. Prevents system fragmentation.From its SKILL.md
npx -y skills add codeerhq/bricks-skills --skill bricks-design-systemsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 24 stars24 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
12.7 KB, as published. Nobody here has run it
Requires: Bricks 2.4+ with the Abilities API enabled
Bricks: design system authoring
If a
bricks/*ability is not available as a direct tool: first check whether it is outside the fast path and call it throughmcp-adapter-execute-abilitywithability_name: "bricks/<name>". If the dispatcher also rejects it, callbricks-list-ability-statusto check whether a site admin disabled it under Bricks > AI.
Before you write anything
Call bricks/get-design-context. You are looking for three answers:
- Does a matching resource already exist? Reuse it.
- Is there a convention to follow? (kebab-case classes,
--space-{size}variable naming, t-shirt or numeric scale: match it.) - Are there empty slots? (Palette exists but one color is missing, scale exists but one step is missing.) Fill the slot instead of creating a new parallel resource.
Also inspect variableCategories. If a category already has a scale config, use that category ID and prefix. Do not create fs-* variables when the typography category prefix is text-, and do not hand-author static spacing/type values when a scale category exists.
A fresh Bricks install can have no saved design-system resources: no custom theme style, classes, components, or saved variables. Bricks still exposes a built-in default color palette fallback in the builder and in list-color-palettes; do not tell users Bricks has no default palette. If get-design-context returns empty, treat the editable design system as greenfield and seed it deliberately (see bricks-seed-design-system skill).
Current write preconditions
Global design writes no longer share one coarse version precondition. Immediately before a focused write, call the matching focused read and pass its complete returned ownership data unchanged:
- Global classes: single
create-global-classhas no resource ownership parameter; passexpectedCategoryOwnershiponly when assigning a category.batch-create-global-classesrequires resourceexpectedOwnershipand category ownership when categorized. Updates/deletes require the target row'sitemOwnershipasexpectedOwnershippluslockOwnership. - Variables/categories: both
variableOwnershipandcategoryOwnership; category writes replace the complete category list and must preserve opaque fields. - Palettes/colors: resource
ownershipfor creates and targetitemOwnershipfor updates/deletes. Chain each successful response's newownershipinto sequential palette mutations. - Theme styles: use the target
itemOwnershipfor update/delete. Fetch the specific style when editing settings; a summary digest still covers the complete hidden row. - Components: update/delete still require
expectedDesignSystemVersionand now also the complete currentexpectedComponentDigest.
Deletion acknowledgement flags (allowOrphans) are mandatory where documented and
do not replace ownership. On any stale precondition, re-read and rebase; do not
manufacture ownership data from get-design-context.version.
Global classes
- Names must be unique across all classes. The write aborts with
bricks_conflict_duplicate_global_class_nameif the name is taken. Read the existing one before retrying. - Keep names kebab-case, lowercase, no vendor prefixes.
.button,.card,.hero-text. Notbtn_v2,Button,--hero-text. - Don't create modifier classes like
.button-red: create a base class and a modifier class that sets only the color. Bricks supports class combinations natively. - Class settings follow the same shape as element settings: call
bricks/render-elementson a minimal element using the class to verify CSS output before committing settings programmatically.
Global variables
- Use the scale generator (
bricks/generate-scale-variables) for typography and spacing. Do not hand-author static spacing or type variables that match a configured scale prefix. The same generator handles both typography and spacing: it's one math model (fluidclamp()with slope) driven by the category config. There is no separate typography-scale tool. - When
get-design-context.variableCategoriesincludes spacing or typography categories withscale, pass the existingcategoryIdtogenerate-scale-variables. The generated names inherit the configured prefix, such asspace-ortext-. - The scale generator resolves the html base font-size from three sources in order: style manager value -> theme styles ->
10pxdefault. If your scale outputs unexpected pixel values, that order is why. - Variable names must be unique at save time, but the builder UI does not validate this on create: call
list-global-variablesfirst and guard against duplicates before writing. Conflict returnsbricks_conflict_duplicate_global_variable_nameon save. - Variables are referenced in CSS as
var(--{name}). Use the bare name (space-m, not--space-m) when creating: Bricks adds the--prefix when emitting CSS. - When building a fluid scale, use the Bricks scale shape.
category.scalehas four keys the builder cannot work without, plus the math knobs:scaleScope:"typography"or"spacing", nothing else. Style Manager has one fixed tab per scope and lists a category only whenscale.scaleScopematches the open tab. Omit it and the scale still shows a "scale" badge in the Variable Manager, still blocks hand-authored values for its prefix, and still gets cascade-deleted with the category — but Style Manager > Typography/Spacing will be empty and the user can never edit or regenerate it.scaleNames: the ordered step names, e.g.["2xs","xs","s","m","l","xl","2xl"]. This list is the scale's extent.regenerateVariables()(fires when the html font size or min/max screen width changes, and on import) derives each variable's step from its index in this list. Omit it and the baseline index collapses to0, silently rewriting every variable at the wrong step.baseline: must be one of thescaleNamesentries. Default t-shirt baseline ism.prefix: e.g.text-,space-.- Math knobs:
scaleType(tshirt|numeric|custom),minFontSize,maxFontSize,minScaleRatio/minScaleRatioSelect,maxScaleRatio/maxScaleRatioSelect. Note:*ScaleRatioSelectwins unless it is the literal string"custom", in which case*ScaleRatiois used.
- Keep
scaleRangeandscaleNamesin agreement. The builder generates exactly one variable perscaleNamesentry.generate-scale-variablesinstead takes ascaleRange: { from, to }, so it is possible to generate 11 variables against a 7-entryscaleNames— after which the Style Manager preview andregenerateVariables()both map variables onto the wrong steps.scaleRange: { from: -2, to: 4 }matches a 7-name list with baseline at index 2. generate-scale-variableswithsave: falsereturns the generated variables for review; show these to the user and wait for approval before saving.generate-scale-variablesdoes not support saving withsave: true. Persist the previewed rows withset-global-variables, using one freshlist-global-variablesresponse'svariableOwnershipandcategoryOwnership. If the category itself must change, first send the complete preserved category list toset-global-variable-categorieswith both current ownership values, then re-read before saving variables.- Global variables are stored in a global option, not post revisions. Use
delete-global-variablefor cleanup of individual variables; it returns abeforeDeletesnapshot. set-global-variablesis an upsert, not a full replacement. Pass both current variable/category ownership values.set-global-variable-categoriesis a full category replacement and also requires both current values.delete-global-variablerequires the row'sitemOwnershipplus literalallowOrphans: trueafter review.
Color palettes
- Palettes are ordered arrays of colors. Each color has an id,
lightand optionaldarkvalue, plus arawCSS-variable reference; individual colors do not have a separate display-name field. - Formats usually round-trip. Light and dark shades preserve the parsed base format. Transparent shades are emitted as HSL/HSLA because the builder's transparent-shade path changes alpha directly.
- Before creating a new palette, check whether the existing primary palette has the color. Fragmented palettes are the most common design-system mess.
- Generating shades. Use
bricks/generate-color-shadesto produce light, dark, or transparent ramps from a base color. The ability uses Bricks' PHP color helper, ported from the builder Color Shades popup, so previews should match the builder math. Shaderawnames becomevar(--{base-variable}-{l|d|t}-{index})only when the base color has arawvalue such asvar(--brand-primary)or whenbaseVariableis passed. Without that variable reference, each generated shade keeps the base raw value. Preview withsave: false, then pass that exact preview'ssaveOwnershipasexpectedOwnershipwhen saving; the save replaces existing shades of the same type, parent, and mode. - A color ramp is two-step: create the base color with a
var(--name)reference, then callgenerate-color-shadesforlightanddark(typically 4-5 steps each).transparentis optional for tint overlays. - Palette/color deletes require target item ownership. Deleting named CSS-variable
colors or palettes also requires
allowOrphans: true; run the reference audit but treat its bounded evidence as non-exhaustive.
Theme styles
- Theme styles do not apply without conditions. A style with an empty conditions array is ignored by the normal theme-style matcher. Always set
conditionswhen creating: use[{ main: "any" }]for a site-wide base, or a more specific condition such aspostType,ids,terms, orarchiveType. - By default, Bricks applies the highest-scoring matching theme style. More specific conditions beat broad ones:
postTypebeatsany, and exactidsbeatspostType. - If the Theme styles loading method setting is enabled, Bricks loads every matching theme style in score order. In that mode, broad styles load earlier and more specific styles load later.
- The first theme style on a fresh site should almost always be
conditions: [{ main: "any" }]so defaults actually render. - Theme styles are stored in a global option, not post revisions. Use
delete-theme-stylefor cleanup; it returns the removed style inbeforeDelete. - Updates and deletes require the target style's current
itemOwnership. Fetch the exact style withget-theme-styles({ style: id })before changing settings. - Deleting a style that has settings or conditions additionally requires
acknowledgeStyleRemoval: trueafter reviewing the returned bounded impact evidence. This acknowledgement belongs to delete, not update.
Components
- Labels are unique across all components.
bricks_conflict_duplicate_component_nameon collision. - Components carry their own element tree. External references to global classes and CSS variables inside that tree are preserved: if a component uses
.buttonandvar(--space-m), those references follow it wherever it's instanced. - Deleting a component with non-zero
usageCountleaves orphan pointers. The builder renders missing components as a placeholder. Either replace the usages first or explicitly accept the orphans with the user. - Prefer
extract-component-from-elementsover copying element trees. The extraction rewrites ids cleanly and swaps the source subtree to a component instance in one write, with a revision snapshot.
See the bricks-components skill for slots, nested components, and property binding specifics.
Workflows
Add a color ramp to an existing palette
list-color-palettes, thencreate-colorwith its resource ownership and the intendedrawvariable reference.- Preview
generate-color-shadeswithsave: false; re-run withsave: trueand the preview'ssaveOwnershipasexpectedOwnership. - Repeat for
dark(and optionaltransparentfor tints). list-color-palettesto verify.
Add or replace a scale
- Pick the naming first (t-shirt or numeric) and stick to it across typography + spacing.
generate-scale-variableswithsave: false: review output with user.- Once approved, pass the returned rows to ownership-guarded
set-global-variables. list-global-variablesto verify.
For building a full design system from an empty site, use the bricks-seed-design-system skill. For cleanup of an existing one, use bricks-audit-design-system.