css-coder
CSS authoring guidance emphasizing web standards, accessibility, and performance. Use when writing, reviewing, or refactoring CSS. Provides patterns, snippets, and conventions that prioritize native CSS over frameworks, semantic structure, and maintainable code. Refer to references/patterns.md for specific patterns and snippets.
What this skill does
# CSS Coder Guidance for writing CSS that prioritizes web standards, accessibility, performance, and maintainability. ## Core Principles 1. **Web standards first** — Use native CSS features before reaching for libraries or frameworks. No Tailwind, no CSS-in-JS unless explicitly requested. 2. **Accessibility as a requirement** — Ensure styles support, never hinder, assistive technologies. Respect user preferences (motion, color scheme, contrast). 3. **Performance matters** — Minimize repaints, avoid layout thrashing, use efficient selectors. 4. **Readable over clever** — Future maintainers (including the author) should understand the code at a glance. 5. **Explicit over implicit** — Avoid magic numbers and unexplained values. Use custom properties for shared values. ## Workflow 1. **Check references first** — Before writing CSS, consult `references/patterns.md` for established patterns and snippets. 2. **Validate against specs** — When uncertain, reference MDN Web Docs or CSS specifications. 3. **Suggest alternatives** — Offer ideas beyond the skill's patterns when appropriate, but always aligned with the core principles above. ## Writing Guidelines ### Selectors - Prefer class selectors over element or ID selectors for styling. - Keep specificity low and predictable. - Avoid deep nesting (aim for 2-3 levels maximum). ### Custom Properties - Use `--` prefixed custom properties for colors, spacing, typography, and other repeated values. - Define at `:root` or appropriate scope. - Name descriptively: `--color-primary`, `--spacing-md`, `--font-size-body`. ### Logical Properties - Always use logical properties (`margin-inline`, `padding-block`, `inset-inline-start`, `block-size`, etc.) instead of physical properties (`margin-left`, `padding-top`, `left`, `height`, etc.). - Logical properties support internationalization and different writing modes automatically. - Only fall back to physical properties where logical equivalents do not yet exist. ### Units - Use `rem` for typography and spacing (respects user font-size preferences). - Use `em` for component-relative sizing when appropriate. - Use viewport units (`vw`, `vh`, `dvh`) thoughtfully, with fallbacks where needed. - Avoid `px` for font sizes; acceptable for borders, shadows, and fine details. ### Colors - Use modern space-separated syntax for all color functions (`rgb()`, `hsl()`, `oklch()`). - Recommend `oklch()` for vibrant or wide-gamut colors. - Use relative color syntax to derive hover states or transparent variants from existing variables. - See `references/patterns.md` for syntax examples. ### Layout - Use CSS Grid for two-dimensional layouts, or when vertical flow is needed without extra declarations. - Use Flexbox for one-dimensional alignment, noting it defaults to `row` direction. - Avoid floats for layout (legacy use only). ### Media Queries - Use modern range syntax: `@media (width < 48rem)`, `@media (width >= 48rem)`. - Prefer **Shared First** over mobile-first: define shared styles outside queries, scope viewport-specific styles with bounded queries. - Keep breakpoints to a minimum — add more only when there's a clear need. - See `references/patterns.md` for detailed examples. ### Accessibility - Never use `display: none` or `visibility: hidden` to hide content that should remain accessible to screen readers. Use appropriate techniques from the references. - Respect `prefers-reduced-motion`, `prefers-color-scheme`, and `prefers-contrast`. - Ensure sufficient color contrast (WCAG AA minimum, AAA preferred). - Maintain visible focus indicators — never remove `:focus` styles without replacement. ### Performance - Avoid expensive properties in animations (prefer `transform` and `opacity`). - Use `will-change` sparingly and only when needed. - Minimize use of `*` selectors. - Prefer `@layer` for managing cascade when working with larger codebases. ## References Consult `references/patterns.md` for: - Visually-hidden utility - User preference queries (motion, color scheme, contrast) - Modern color syntax and relative colors - Shared First responsive patterns - Any project-specific conventions This file will grow as patterns are added. If a needed pattern doesn't exist, suggest one aligned with the core principles.
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.