css-craft
CSS mechanics — use when a declaration silently does nothing (var() not resolving, shorthand wiping the longhands it omits, an unregistered custom property refusing to interpolate, a logical property flipping under RTL while its border-radius does not), or when writing custom properties, fluid clamp() values, shorthand, intrinsic layout and centering, container queries, @layer, or value functions like calc-size()/color-mix(). Not motion — duration, easing, and whether to animate are motion-craft; not review — css-audit.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- css-craft
- description
- CSS mechanics — use when a declaration silently does nothing (var() not resolving, shorthand wiping the longhands it omits, an unregistered custom property refusing to interpolate, a logical property flipping under RTL while its border-radius does not), or when writing custom properties, fluid clamp() values, shorthand, intrinsic layout and centering, container queries, @layer, or value functions like calc-size()/color-mix(). Not motion — duration, easing, and whether to animate are motion-craft; not review — css-audit.
02 资源文件 4
- 参考文档FUNCTIONS.md4.8 KB
- 参考文档LAYOUT.md6.3 KB
- 参考文档PROPERTIES.md7.1 KB
- 参考文档SHORTHAND.md9.8 KB
03 SKILL.md 正文
CSS Craft
How CSS actually behave, in place it behave surprising. Several of below checked rather than remembered — per-edit hook refuse a write carrying one, css-audit re-run same table over whole file.
Reference bodies
- Writing or debugging a custom property →
PROPERTIES.md: scope and cascade,@propertytyping and animation, fallback rules, the computation gotchas behind "why is my value missing", re-pointing values per media query, fluidclamp()recipes, theming, JS read and write. - Writing a shorthand, or a longhand sitting near one →
SHORTHAND.md: the reset trap in full, value counts for sides (TRBL) and corners, the logical box-side twins and theborder-radiuscorners that do not follow them, value order per shorthand. - Building layout, or about to write a media query →
LAYOUT.md: intrinsic grid, grid-area stacking, sidebar, sticky footer, centering; container and style queries; one-line upgrades retiring old hacks;:where()/:is()/:has()/@layer/ owl spacing. - Picking a value function, or feature-detecting one →
FUNCTIONS.md:calc-size(),progress(),color-mix(),contrast-color(),if(),image-set(),linear(), the shape functions behindclip-path/offset-path, each with the support trap it still carries;@supportsandCSS.supports()syntax; fallback ordering.
What bites
Before a declaration ships, confirm none of these apply to it.
Shorthand resets what it omits. background: red clears background-image, background-position, rest. Longhand set before its shorthand is discarded — move it after. Per-property detail in SHORTHAND.md.
Invalid var() cannot fall back to earlier declaration. color: blue; color: var(--broken) gives inherited colour, not blue. Give every var() a fallback of the right type — it rescues the missing token only, and var(--foo, red, blue) is one fallback of red, blue, everything after first comma. Gotchas in PROPERTIES.md.
Untyped custom property cannot be interpolated. Plain --stop: red snaps between values; same property registered with @property and syntax: '<color>' transitions smooth. Register anything you put in transition or @keyframes — with one exemption: component API prop meant to stay undefined keeps var(--button-bg, var(--color-primary)) fallthrough only while unregistered, because registration fills initial-value.
Computed values frozen on inheritance. --size-lg: calc(2 * var(--size)) on :root computes once; redefining --size on descendant won't recompute it. Do arithmetic where value consumed.
Unlayered styles beat every layer. One stray rule outside @layer outranks your whole layered design system, and !important inverts the order on top of that. Full ordering in LAYOUT.md.
minmax(20ch, 1fr) overflows. The memorised intrinsic-grid line needs the inner min(), else any container narrower than 20ch overflows. Recipe in LAYOUT.md.
Logical edge, physical corner. border-inline-start flips under direction: rtl; border-radius: 0 1em 1em 0 does not, so the rail and the square corners end up on opposite sides. Per-corner logical longhands (border-start-end-radius) in SHORTHAND.md.
@supports cannot detect at-rules cross-engine. @supports at-rule(@container) is Chromium 148+ only; probe API presence from JS — window.CSSContainerRule for @container, window.CSSLayerBlockRule for @layer. And a pass proves only the form you tested — partial implementations accept the function name and fail the call, so test the exact call you ship.
04 同仓库更多 Skills
unslop
Use when writing or editing prose a person will read, or when text sounds AI-generated.
show-me
Use when asked to show, diagram, or walk through how code fits together or what a change does, or before explaining a multi-file flow in prose.
pr
Use when writing or updating a pull request description, or before running `gh pr create`.
commit
Use when writing a commit message, or before running `git commit`.
write-specs
Spec a feature's observable behavior. Use when asked for requirements, when a request says what the system should do but not how, or to capture what a built system already guarantees. Not for how to build it (write-plan).
write-skills
Write, fix, or audit a skill's frontmatter, trigger description, and body. Use when a skill is asked for, never fires, or fires at the wrong moment. Not for a hook (write-hooks) or the plugin manifest and catalog.