Install
$ agentstack add skill-xobotyi-cc-foundry-css ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
CSS
Predictability is the highest CSS virtue. If your styles require !important to work, restructure the cascade.
CSS rewards explicit, low-specificity selectors and intentional cascade ordering. Prefer boring, readable patterns over clever one-liners.
References
- Layout — [
${CLAUDE_SKILL_DIR}/references/layout.md]: Flex shorthand values, grid details (subgrid, implicit
rows, alignment), layout patterns
- Modern CSS — [
${CLAUDE_SKILL_DIR}/references/modern-css.md]: Extended modern CSS patterns and examples - SCSS — [
${CLAUDE_SKILL_DIR}/references/scss.md]:@forwardpatterns, module configuration, built-in modules,
file organization
- Responsive — [
${CLAUDE_SKILL_DIR}/references/responsive.md]: Extended responsive design patterns and examples - Methodologies — [
${CLAUDE_SKILL_DIR}/references/methodologies.md]: Methodology patterns and architecture details
Selectors and Specificity
- Single class selectors by default — keep specificity flat at 0-1-0
- Never use ID selectors for styling — IDs are for anchors and JS hooks
- Never qualify classes with elements —
.errornotdiv.error - Max nesting depth: 3 levels — deeper nesting couples CSS to DOM structure
- Avoid
!important— use cascade layers or restructure selectors instead; only valid use is in a low-priority reset
layer for truly essential styles
- Use
:where()to zero-out specificity when needed —:where(.card) .titlehas 0-0-1 specificity - Use
:is()with awareness — it takes the highest specificity of its arguments - Flatten nested selectors in SCSS — ability to nest does not mean you should
Layout Systems
Choosing Flexbox vs Grid
| Use Case | System | | --------------------------------------------- | ------- | | One-dimensional flow (row or column) | Flexbox | | Two-dimensional layout (rows AND columns) | Grid | | Content-driven sizing | Flexbox | | Layout-driven sizing | Grid | | Component internals (nav items, card content) | Flexbox | | Page-level structure, complex arrangements | Grid | | Items need to wrap naturally | Flexbox | | Precise placement on named lines/areas | Grid |
Both work together — a grid item can be a flex container and vice versa.
Flexbox
- Always use the
flexshorthand — it sets intelligent defaults. See${CLAUDE_SKILL_DIR}/references/layout.mdfor the
full shorthand value table
flex-flow: row wrapcombinesflex-directionandflex-wrap- Use
flex-wrapwith aflexbasis for responsive layouts without media queries:flex: 1 1 300pxwraps items when
they can't maintain 300px minimum
- Centering:
display: flex; align-items: center; justify-content: centerormargin: autoon a flex child gapover margin hacks — works in both flexbox and grid- Avoid
justify-content: space-betweenwith wrap — causes orphan gaps; prefergap+flex-wrap
CSS Grid
repeat(auto-fit, minmax(250px, 1fr))is the canonical responsive grid — no media queries needed- Prefer
auto-fitoverauto-fill—auto-fitexpands columns to fill space;auto-fillkeeps empty tracks - Use named grid areas for page-level layouts — they auto-create named lines
- Never hardcode
pxwidths on grid items — usefr,minmax(), orauto grid-auto-flow: densefills visual holes — use carefully, it breaks visual/source order alignment (a11y concern)- Never use
orderin ways that break logical reading order - See
${CLAUDE_SKILL_DIR}/references/layout.mdfor subgrid, implicit rows, alignment shorthands, and negative line
numbers
General Layout Rules
- Never use
floatfor layout — floats are for wrapping text around images - Intrinsic sizing first — use
flex-wrap,min(),max(),clamp()before reaching for media queries
CSS Nesting
- Use
&for pseudo-classes/elements and compound selectors —&:hover,&::before,&.active - Omit
&for descendant selectors —.card { .title {} }works &is required when the nested selector starts with a type selector —& p {}notp {}- Nesting at-rules (
@media,@supports,@container) nest directly inside rules - Specificity:
:is()wrapping applies in nesting — be aware that specificity may differ from the equivalent unnested
selector
- Max depth: 3 levels — same rule as flat CSS
Cascade Layers (@layer)
- Declare all layers at the top of the stylesheet in a single statement:
@layer reset, defaults, themes, components, utilities;
- First declared = lowest priority; un-layered styles always beat layered styles
!importantreverses layer order —!importantin the lowest layer wins over!importantin higher layers- Import third-party CSS into sub-layers:
@import url('vendor.css') layer(vendor.bootstrap); - Use
revert-layerto roll back to the previous layer's value !importantin low layers is intentional — it means "this style is essential, don't override"- Don't create layers per-component — layers manage cascade priority between categories (reset vs component vs utility),
not scope
- Nested layers:
@layer components { @layer buttons, cards; }— access via@layer components.buttons - Anonymous layers (
@layer { }) can't be appended to later
Container Queries
- Define containment:
container-type: inline-sizeon the wrapper - Name containers for targeting:
container: card / inline-size - Query by name:
@container card (width > 400px) { } - Unnamed queries hit the nearest ancestor container
Container Query Units
cqw/cqh— 1% of container width / heightcqi/cqb— 1% of container inline / block sizecqmin/cqmax— smaller / larger ofcqiorcqb
Use cqi instead of vw for container-scoped fluid values: font-size: clamp(1rem, 2.5cqi + 0.5rem, 2rem)
Responsive Design
Responsive Hierarchy
Design from the inside out — use the right tool for each level:
- Content-driven — Flexbox wrapping,
min()/max()/clamp(): always — baseline - Container-driven — Container queries,
cqi/cqwunits: component adapts to parent - Viewport-driven — Media queries,
vw/vh/dvh: page-level layout changes - User preference —
prefers-*media queries: color scheme, motion, contrast
Core Rules
- Mobile-first — default styles for small screens, enhance upward
- Content-driven breakpoints — let content decide, not device sizes
remfor breakpoints:@media (width >= 45rem)not(min-width: 768px)- Use modern range syntax:
@media (768px) or sibling (+,~) combinators inside:has()to limit traversal scope - Cannot nest
:has()inside:has() - Pseudo-elements are not valid inside
:has() .layout:has(> .sidebar-open)(good) notbody:has(.sidebar-open)(bad)
Custom Properties
- Define design tokens on
:root— scope overrides to components - Semantic naming:
--color-text-primarynot--dark-gray - Use kebab-case; prefix with category:
--color-,--spacing-,--font- - Provide fallbacks for component-level variables:
var(--button-bg, var(--color-primary)) - Custom properties are case-sensitive —
--my-colordiffers from--My-Color - Custom properties inherit by default (unlike most CSS properties)
- Use
@propertyfor typed, animatable custom properties — enables type checking (invalid values fall back to
initial-value), controlled inheritance (inherits: false), and transitions on custom properties
View Transitions
view-transition-namemust be unique per page at transition time- Keep transitions short — 200-400ms for UI, longer for page-level
- Always respect
prefers-reduced-motion: reducefor view transitions - Same-document (SPA):
document.startViewTransition(() => { /* update DOM */ }) - Cross-document (MPA):
@view-transition { navigation: auto; } - Named transitions target specific elements via
::view-transition-group(name)
Box Model and Sizing
- Always set
box-sizing: border-boxglobally via reset remfor font sizes and breakpoints — respects user preferencesemfor component-relative spacing (padding that scales with font size)- Fluid sizing with
clamp()— replace manual breakpoint ladders aspect-ratioover padding hacks for maintaining proportions- No units on zero values —
margin: 0notmargin: 0px(except where required:flex: 0 0 0px) - Leading zero on decimals:
opacity: 0.5notopacity: .5 - Shorthand hex where possible:
#ebcnot#eebbcc
SCSS / Dart Sass
Module System
@useand@forwardonly —@importis deprecated (Dart Sass 1.80.0), removed in 3.0.0@usemust appear before any rules except@forward- Namespace defaults to the last component of the URL (without extension)
- Members are scoped to the loading file — not globally available
- Each module loaded exactly once — no duplicate CSS output
- Namespace access:
variables.$primarynot global$primary - No-namespace
@use 'variables' as *— use sparingly, only for own files math.div()for division — the/operator is deprecated- Prefix private members with
-or_ - Prefer mixins over
@extend— more predictable output;@extendproduces unexpected selectors and doesn't work
across media queries
- Max nesting: 3 levels
@forward re-exports modules, supports prefixing and visibility control. Module configuration uses !default variables and @use ... with (). See ${CLAUDE_SKILL_DIR}/references/scss.md for @forward patterns, configuration passthrough, built-in module usage, and file organization conventions.
Migration
Use the official migrator: sass-migrator module --migrate-deps entrypoint.scss. For built-in functions only: sass-migrator module --built-in-only entrypoint.scss.
CSS Methodologies
BEM (Block Element Modifier)
- Blocks are standalone components:
.card,.nav,.form - Elements are parts of a block (double underscore):
.card__title,.card__image - Modifiers are variations (double hyphen):
.card--featured,.card__title--bold - Never nest elements:
.card__header__titleis wrong — flatten to.card__titleor create a new block - Modifiers don't exist alone — always pair with base class:
class="card card--featured" - Use BEM in team projects, large codebases, projects without scoped styles
- Skip BEM when using CSS Modules, utility-first CSS, or small projects
CSS Modules
- Use simple, descriptive class names — scoping eliminates conflict risk
- One module per component
- Compose shared styles:
composes: resetButton from './shared.module.css' - Global escape hatch:
:global(.utility-class)when needed - Pair with custom properties for theming (variables aren't scoped)
Architecture (ITCSS)
Organize styles by specificity, low to high: Settings → Tools → Generic → Elements → Objects → Components → Utilities. Maps naturally to cascade layers: @layer settings, generic, elements, objects, components, utilities;
Formatting
- 2-space indentation, no tabs
- One declaration per line
- Semicolon after every declaration including the last
- Space after colon:
color: rednotcolor:red - Opening brace on same line as selector
- Blank line between rules
- Lowercase everything (selectors, properties, values, hex colors)
- Single quotes for attribute selectors and font names
- Group declarations by category: layout → box model → typography → visual → interaction
Application
When writing CSS:
- Apply all conventions silently — don't narrate each rule being followed.
- Use intrinsic sizing and fluid techniques before media queries.
- If an existing codebase contradicts a convention, follow the codebase and flag the divergence once.
When reviewing CSS:
- Cite the specific violation and show the fix inline.
- Don't lecture or quote the rule — state what's wrong and how to fix it.
Bad review comment:
"According to CSS best practices, you should avoid using ID selectors
for styling because they have high specificity."
Good review comment:
"`#header` -> `.header` -- IDs create specificity 1-0-0, difficult to override."
Integration
The coding skill governs workflow; this skill governs CSS implementation choices. For SCSS, this single skill covers both CSS and SCSS conventions.
Predictability is the highest CSS virtue. When in doubt, keep specificity low and cascade explicit.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: xobotyi
- Source: xobotyi/cc-foundry
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.