本文へ移動
cccskills
GitHub Copilot 公式無料GitHub で公開

css-styling

CSS Modules conventions, design tokens, container queries, and CSS-vs-component boundaries. USE WHEN: editing any `*.css` / `*.module.css` file in this repo, or writing styles for a new component.

日本語の概要は準備中です。原文の説明を表示しています。

github/replicaスター 49(GitHub 49 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md10.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

CSS Editing Instructions

CRITICAL: Before Editing Any CSS File

REQUIRED STEP: Before making any changes to a .css file, you MUST read the corresponding .tsx file(s) that use it:

  1. Look for .tsx files with the same base name (e.g., ComponentName.tsx for ComponentName.module.css)
  2. Search for imports of the CSS file using grep with pattern: import.*from.*'\.\/.*\.module\.css'
  3. Read ALL .tsx files that import the CSS file before proceeding with edits

You may also need to edit the matching .tsx file and its structure to properly edit CSS.

CSS Architecture

This project uses CSS Modules. Component CSS files should be named *.module.css and placed alongside their corresponding .tsx component files. App-level stylesheets in app/styles/ provide foundational styles such as resets and font registration; do not put component styles there.

Do not write inline css in the style attribute (unless there is a javascript value being attached).

Custom Fluent Components

Do not use CSS to recreate components that already exist in CoreAI or Fluent. Before editing components, invoke the react-components skill for proper component usage guidelines. Most appearance and interaction styles are already handled by documented CoreAI components and props. If an appropriate prop is available, use it instead of writing CSS.

CSS @layers

There are 3 named CSS @layers in this app, ordered base, griffel, and common, plus unlayered CSS (which is not a named layer). The base layer contains the foundational box-sizing reset in app/styles/globals.css. The griffel layer encapsulates Fluent's styles through the app-owned layered renderer - NEVER write CSS into the griffel layer. The common layer is for common components inside the app/components/common folder and app-level resets; all components in this folder should use this layer, and component styles outside it should not. All other component styles should be written outside of these layers.

General Guidelines

No Global CSS: Do not write global CSS selectors (e.g., body, h1) outside of a scoped CSS class for component styling. All component styles must be scoped using CSS Modules. App-level stylesheets in app/styles/ provide foundational resets, font registration, and app-wide variable defaults, not component styling. Use Nested Classes: Scope styles to specific elements within the component using nested class selectors. Avoid !important: Do not use !important in CSS rules. Instead, refactor the CSS or component structure to achieve the desired specificity.

Responsive Breakpoints — Container Queries

CRITICAL: Do NOT use @media (width ...) for responsive width breakpoints. Use @container app (width ...) instead.

This app uses CSS container queries so that responsive behavior responds to the actual available content width, not the viewport. Panels that reduce the content container's available width affect its breakpoints; the app-local floating feature selector is fixed-position and does not consume layout width.

The ContainerQueryProvider component (wrapping the app children with styles.fullscreenContainer in app/components/shell/AppContent.tsx) establishes container-type: inline-size with container-name: app.

Correct — Container Query

@container app (width <= 768px) {
  .sidebar {
    display: none;
  }
}

Wrong — Viewport Media Query

/* ❌ DO NOT use @media for width breakpoints */
@media (width <= 768px) {
  .sidebar {
    display: none;
  }
}

When to still use @media

  • Height queries: @media (height <= 480px) — container queries only support inline-size
  • User preferences: @media (prefers-color-scheme: dark), @media (prefers-reduced-motion: reduce)
  • Accessibility: @media (forced-colors: active)
  • Elements in portals/top-layer: Dialogs, popovers, and other portal-rendered elements that exist outside the container tree (these still need viewport @media queries)

Layout

CSS should primarily be used for layout, spacing, borders, and backgrounds. Avoid using CSS for text styles, component styles, or interaction styles. Most of these are handled by React components and props. Prefer using flexbox with gap for most layouts instead of block with margin. Grid is acceptable for more complex layouts.

Reduce nesting of HTML elements where possible - prefer a flatter structure.

Text Styling

Text Properties: Avoid writing these CSS properties directly in CSS files. The components handle most of these by default.

  • font-size
  • font-weight
  • font-family
  • line-height
  • color (for text color)

EXCEPTION: Text properties inside @container queries for responsive typography (e.g., scaling a heading on mobile) should be kept in CSS — the Text component doesn't handle container-based sizing.

INSTEAD: Where these properties are applied to a Text, span, or other text element, refactor to use the documented Text component from @coreai-ds/react-components and replace any text CSS properties with preset and foreground props.

import { Text } from '@coreai-ds/react-components';

<Text preset="body" foreground={3}>
  Your text here
</Text>;

Text Component Presets & Foreground

Presets (size from smallest to largest):

  • bodyXS (10px) / bodyXSStrong (10px semibold)
  • bodyS (12px) / bodySStrong (12px semibold); heading6 is an alias of bodySStrong
  • body (14px) / bodyStrong (14px semibold); heading5 is an alias of bodyStrong
  • heading4 (16px semibold)
  • heading3 (20px semibold)
  • heading2 (28px semibold)
  • heading1 (40px semibold)

Foreground (text color intensity):

  • 1 - Headings
  • 2 - Body text
  • 3 - Subtle/muted/secondary
  • 4 - Disabled/placeholder
  • 'disabled' - Disabled text

Additional properties:

  • block - makes the text a block element
  • italic - makes the text italic
  • font - sets the font family - base | monospace
  • as - html element to render as (e.g., 'p', 'span', 'h1', etc.)

Don't use Fluent's fixed typography components (like <Body1> or <Title2>) directly. Always use CoreAI <Text> with preset and foreground props.

When you encounter these properties in existing CSS: Refactor the code to remove them from CSS and use the Text component in the .tsx file instead.

Combining CSS Classes

When applying multiple CSS classes, use the clsx utility:

import clsx from 'clsx';
import styles from './Component.module.css';

<div
  className={clsx(
    styles.class1,
    condition && styles.class2,
    className, // props.className mapped on to root element
  )}
/>;

CSS Variables

Use Fluent semantic color tokens directly.

Background

  • --colorNeutralBackground1 - Lighter primary background
  • --colorNeutralBackground2 - Middle background (uncommon)
  • --colorNeutralBackground3 - Darker background
  • --colorNeutralBackground4 - Very dark background (rarely used)

Border/Stroke

  • --colorNeutralBackground4 - Existing panel-divider color
  • --colorNeutralStroke1 - Standard border color for elements

Usage: border: 1px solid var(--colorNeutralStroke1);

Foreground/Text

Prefer using the Text component's foreground prop instead of setting text color in CSS.

  • --colorNeutralForeground1 - Intense (primary text/headings)
  • --colorNeutralForeground2 - Default body text color
  • --colorNeutralForeground3 - Subtle/muted (secondary text)
  • --colorNeutralForeground4 - Dim (disabled/placeholder text)
  • --colorBrandForeground1 - Brand color
  • --colorBrandForegroundLink - Link color

Interactive/States

Components own their hover, pressed, and selected states. Use the component API instead of introducing application-level interaction-color aliases.

Spacing - REQUIRED

NEVER use hardcoded pixel values or rem values for spacing values less than 32px. Always use these CSS variables:

  • --spacingNone (0)
  • --spacingXXS (2px)
  • --spacingXS (4px)
  • --spacingSNudge (6px)
  • --spacingS (8px)
  • --spacingMNudge (10px)
  • --spacingM (12px)
  • --spacingL (16px)
  • --spacingXL (20px)
  • --spacingXXL (24px)
  • --spacingXXXL (32px)
  • --spacingPagePadding - Special variable for horizontal page padding (adjusts by app container width, with a viewport-based fallback in the global stylesheet)

DO NOT use Fluent spacing variables that include "Horizontal" or "Vertical" in their names.

For pixel values 32px and above, you may use hardcoded values if necessary, but prefer using spacing variables where possible for consistency.

Border Radius

  • --borderRadiusNone (0)
  • --borderRadiusSmall (2px)
  • --borderRadiusMedium (4px)
  • --borderRadiusLarge (6px)
  • --borderRadiusXLarge (8px)
  • --borderRadius2XLarge (12px)
  • --borderRadius3XLarge (16px)
  • --borderRadius4XLarge (24px)
  • --borderRadius5XLarge (32px)
  • --borderRadius6XLarge (40px)
  • --borderRadiusCircular (9999px)

Example CSS Patterns

Good - Uses Variables

.container {
  padding: var(--spacingL);
  background-color: var(--colorNeutralBackground1);
  border: 1px solid var(--colorNeutralStroke1);
  gap: var(--spacingM);
}

Bad - Hardcoded Values

.container {
  padding: 16px; /* WRONG - use var(--spacingL) */
  background-color: #f5f5f5; /* WRONG - use var(--colorNeutralBackground1) */
  font-size: 14px; /* WRONG - use Text component instead */
  color: #333; /* WRONG - use Text component instead */
}

Summary Checklist

Before submitting CSS edits, verify:

  • Read corresponding .tsx file(s) that use this CSS
  • No text-styling properties (font-*, color) in CSS
  • All colors use Fluent semantic tokens
  • All spacing uses --spacing* variables
  • Width breakpoints use @container app (width ...) not @media (width ...)
  • Component CSS file is named *.module.css; any app-level stylesheet edit stays within the foundational-style exception
  • Classes combined with clsx when multiple are needed

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

accessibility-audit

GitHub Copilot 公式無料

Audits actual components and routes against applicable WCAG 2.2 A/AA criteria using consumer-owned design-system evidence and repository tools. Use when asked for an accessibility audit, a11y check, keyboard or focus review, contrast check, or screen-reader verification.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

add-seed-data

GitHub Copilot 公式無料

Creates or updates believable deterministic raw fixture scenarios without breaking an existing prototype. Use when asked to add or change fixtures, seed data, sample data, scenarios, or cross-record relationships. Not for UI redesign, live-data infrastructure, or unrelated commands.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

agent-browser

GitHub Copilot 公式無料

Use for explicit agent-browser CLI checks or a named browser capability neither the Copilot canvas nor configured Playwright MCP can supply. Ordinary rendered checks and browser selection belong to browser-canvas-validation.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

browser-canvas-validation

GitHub Copilot 公式無料

Use the Copilot browser canvas first for rendered route checks, interaction tests, screenshots and visual, responsive or accessibility evidence. Use configured isolated Playwright MCP only when the canvas is unavailable for a required check.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

code-review

GitHub Copilot 公式無料

Review Replica pull requests using the same shared conventions and project guides as implementation agents. Use when reviewing changes to code, tests, workflows, or documentation in this repository.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

component-design-system-review

GitHub Copilot 公式無料

Reviews existing UI components for design-system consistency, states, responsiveness and accessibility using consumer-owned context. Use when asked to review component quality, check design-system adherence or audit component consistency.

日本語の概要は準備中です。原文の説明を表示しています。

github/replica492026年10月29日 更新

github のスキルをすべて見る

このスキルの問題を報告する