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

css

Guides styling implementation using TailwindCSS + CSS Modules. Triggered when handling component styles, layout design, or CSS patterns.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.9 KB

SKILL.md(原文)

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

CSS Styling Guide

This skill provides mandatory specifications for combining TailwindCSS + CSS Modules for styling implementation in this project.

1. Architecture Overview

This project adopts a hybrid styling strategy:

  • TailwindCSS: For simple, utility-first styles and layouts.
  • CSS Modules: For complex state management, component-specific styles, and high maintainability needs.
  • Rsbuild + Lightning CSS: Provides modern CSS processing with PostCSS support.

2. Styling Strategy Decision Tree

When to Use TailwindCSS

// ✅ Use TailwindCSS:
// - Simple layouts (flex, grid, positioning)
// - Basic spacing (margin, padding)
// - Basic colors and typography
// - One-off styles
// - Rapid prototyping

<div className='flex items-center gap-3 p-4'>
  <span className='text-std-600'>Content</span>
</div>

When to Use CSS Modules

// ✅ Use CSS Modules:
// - Complex state transitions (hover, active, focus state combinations)
// - Component-specific animations
// - Nested selector patterns
// - Repeated complex styles
// - Dark mode switching logic
// - Style combinations that would make TailwindCSS class strings too long

import styles from './index.module.css'

<div className={`w_100 border_box relative${styles._local}`}>
  <button className='btn_copy'></button>
</div>

3. TailwindCSS Patterns

3.1 Multi-line Class Naming

// ✅ Recommended: multi-line for readability
<div
	className='
		flex
		items-center justify-center
		w-18 h-screen
		is_drag
	'
>
	<Icon size={20}></Icon>
</div>

// ❌ Avoid: still writing on single line when styles are complex
<div className='flex items-center justify-center w-18 h-screen is_drag'>

3.2 Conditional Styles with Template Strings

// ✅ Use template strings for conditional class names
const Index = ({ fold }: { fold: boolean }) => {
	return (
		<nav
			className={`
				relative
				flex flex-col
				h-full
				${fold ? 'w-18 items-center justify-center' : 'border-std-900/8 w-60 border-r py-2'}
			`}
		>
		</nav>
	)
}

3.3 Global Utilities

// Electron window dragging
<div className='is_drag'></div>        // Allow dragging
<div className='no_drag clickable'></div> // Disallow dragging, allow clicking

// Lucide icon borders
<svg className='lucide'></svg>         // Apply 1.8px line width

// Custom utilities
<div className='clickable'></div>      // cursor pointer
<div className='border_box'></div>     // box-sizing: border-box
<div className='w_100'></div>          // width: 100%

4. CSS Modules Patterns

4.1 File Structure

/* index.module.css */
@reference '../../../styles/index.css'; /* For importing Tailwind base */

._local {
	/* Component-specific styles */

	&:hover {
		/* Hover state */
	}

	:global {
		/* Global class styles (skip hashing) */
	}
}

4.2 Nested States and :global

/* index.module.css */
._local {
	padding: 16px 0;

	&:hover {
		:global {
			.btn_copy {
				opacity: 1;
			}
		}
	}
}

:global {
	.btn_copy {
		opacity: 0;
		transition-property: opacity;

		&:hover {
			@apply bg-std-300;
		}
	}
}

4.3 Using @apply

._local {
	/* ✅ Use @apply to include TailwindCSS utilities */
	@apply rounded-xl;

	/* ✅ Mix custom CSS with @apply */
	padding: 16px 0;

	/* ✅ Use @apply for colors */
	:global {
		.lang {
			@apply text-std-400;
		}
	}
}

4.4 CSS Variables

/* ✅ Use snake_case for CSS variables */
._local {
	--margin_y: 1.2em;

	p {
		margin-block: var(--margin_y);
	}
}

5. Color System

The project uses semantic color names:

// TailwindCSS color classes
'text-std-800' // Primary text
'text-std-600' // Secondary text
'text-std-400' // Muted text
'text-std-white' // White text
'text-std-black' // Black text

'bg-std-100' // Primary background
'bg-std-200' // Secondary background
'bg-std-300' // Hover background
'bg-std-800' // Dark background

'border-std-200' // Light border
'border-std-900/8' // Dark border with opacity

6. Constraints and Best Practices

6.1 Naming Conventions

  • TailwindCSS: Use standard utility class names.
  • CSS Modules: Class names must use snake_case.
  • CSS Variables: Use snake_case with -- prefix.
  • Component Container: Always use _local for the main container class name.

6.2 Code Style

  • TailwindCSS: Use line breaks for better readability.
  • CSS Modules: No comments. Use Tab indentation.
  • Blank Lines: Separate different logical areas with blank lines.

6.3 Performance and Maintenance

  • Avoid Long Strings: Don't create TailwindCSS strings exceeding 100 characters. Use CSS Modules instead.
  • No Inline Styles: Avoid inline style props unless absolutely necessary.
  • No !important: Absolutely never use !important in CSS Modules.

レビュー

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

同じリポジトリのスキル

概要と使いどころ

Maintain package-level `agentmap.md` files as outline-level maps of the real file tree and core responsibilities. Use when package structure or responsibility boundaries change and the corresponding `agentmap.md` must be created or updated.

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

MatrixAges/polywise6632026年6月11日 更新

Guides the generation, reading, and updating of agentmap.md files. This skill ensures a consistent and up-to-date codebase map for AI Agents.

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

MatrixAges/polywise6632026年6月11日 更新

Interacts with local browser via Chrome DevTools Protocol (only triggered after user explicitly requests to inspect, debug, or interact with pages open in Chrome)

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

MatrixAges/polywise6632026年6月11日 更新

Specialized for translating document files and their content into English. Triggered when localization, translation, or converting Chinese documents to English is requested.

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

MatrixAges/polywise6632026年6月11日 更新

Guides using eRPC (electron-tRPC) for inter-process communication (IPC) between Electron main and renderer processes. Triggered when handling Electron IPC or tRPC-based systems.

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

MatrixAges/polywise6632026年6月11日 更新

i18n

無料

Guides internationalization (i18n) implementation using i18next with TypeScript. Triggered when handling localization, translation files, or multilingual support.

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

MatrixAges/polywise6632026年6月11日 更新

MatrixAges のスキルをすべて見る

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