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

tailwind-css-patterns

Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.

インストール方法を見る

含まれるファイル(9)

  • SKILL.md6.2 KB
  • references/accessibility.md3.9 KB
  • references/animations.md3.3 KB
  • references/component-patterns.md4.3 KB
  • references/configuration.md3.0 KB
  • references/layout-patterns.md3.7 KB
  • references/performance.md2.4 KB
  • references/reference.md9.7 KB
  • references/responsive-design.md3.5 KB

SKILL.md(原文)

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

Tailwind CSS Development Patterns

Expert guide for building modern, responsive user interfaces with Tailwind CSS utility-first framework. Covers v4.1+ features including CSS-first configuration, custom utilities, and enhanced developer experience.

Overview

Provides actionable patterns for responsive, accessible UIs with Tailwind CSS v4.1+. Covers utility composition, dark mode, component patterns, and performance optimization.

When to Use

  • Styling React/Vue/Svelte components
  • Building responsive layouts and grids
  • Implementing design systems
  • Adding dark mode support
  • Optimizing CSS workflow

Quick Reference

Responsive Breakpoints

PrefixMin WidthDescription
sm:640pxSmall screens
md:768pxTablets
lg:1024pxDesktops
xl:1280pxLarge screens
2xl:1536pxExtra large

Common Patterns

<!-- Center content -->
<div class="flex min-h-screen items-center justify-center">Content</div>

<!-- Responsive grid -->
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
	<!-- Items -->
</div>

<!-- Card component -->
<div class="rounded-lg bg-white p-6 shadow-lg">
	<h3 class="text-xl font-bold">Title</h3>
	<p class="text-gray-600">Description</p>
</div>

Instructions

  1. Start Mobile-First: Write base styles for mobile, add responsive prefixes (sm:, md:, lg:) for larger screens
  2. Use Design Tokens: Leverage Tailwind's spacing, color, and typography scales
  3. Compose Utilities: Combine multiple utilities for complex styles
  4. Extract Components: Create reusable component classes for repeated patterns
  5. Configure Theme: Customize design tokens in tailwind.config.js or using @theme
  6. Verify Changes: Test at each breakpoint using DevTools responsive mode. Check for visual regressions and accessibility issues before committing.

Examples

Responsive Card Component

function ProductCard({ product }: { product: Product }) {
	return (
		<div className="overflow-hidden rounded-lg bg-white shadow-lg sm:flex">
			<img className="h-48 w-full object-cover sm:h-auto sm:w-48" src={product.image} />
			<div className="p-6">
				<h3 className="text-lg font-semibold">{product.name}</h3>
				<button className="mt-4 rounded-lg bg-indigo-600 px-4 py-2 text-white hover:bg-indigo-700">Add to Cart</button>
			</div>
		</div>
	)
}

Dark Mode Toggle

<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
	<h1 class="dark:text-white">Title</h1>
</div>

Form Input

<input
	class="w-full rounded-lg border border-gray-300 px-4 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500"
	placeholder="you@example.com"
/>

Best Practices

  1. Consistent Spacing: Use Tailwind's spacing scale (4, 8, 12, 16, etc.)
  2. Color Palette: Stick to Tailwind's color system for consistency
  3. Component Extraction: Extract repeated patterns into reusable components
  4. Utility Composition: Prefer utility classes over @apply for maintainability
  5. Semantic HTML: Use proper HTML elements with Tailwind classes
  6. Performance: Ensure content paths include all template files for optimal purging
  7. Accessibility: Include focus styles, ARIA labels, and respect user preferences (reduced-motion)

Troubleshooting

Classes Not Applying

  • Check content paths: Ensure all template files are included in content: [] in config
  • Verify build: Run npm run build to regenerate purged CSS
  • Dev mode: Use npx tailwindcss -o with --watch flag for live updates

Responsive Styles Not Working

  • Order matters: Responsive prefixes must come before non-responsive (e.g., md:flex not flex md:flex)
  • Check breakpoint values: Verify breakpoints match your design requirements
  • DevTools: Use browser DevTools responsive mode to test at each breakpoint

Dark Mode Issues

  • Verify config: Ensure darkMode: 'class' or 'media' is set correctly
  • Toggle implementation: Use document.documentElement.classList.toggle('dark') for class strategy
  • Initial flash: Add dark class to <html> before body renders

Constraints and Warnings

  • Class Proliferation: Long class strings reduce readability; extract into components
  • Content Paths: Misconfigured paths cause classes to be purged in production
  • Arbitrary Values: Use sparingly; prefer design tokens for consistency
  • Specificity Issues: Avoid @apply with complex selectors
  • Dark Mode: Requires correct configuration (class or media strategy)
  • Browser Support: Check Tailwind docs for compatibility notes

References

External Resources

レビュー

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

同じリポジトリのスキル

概要と使いどころ

Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

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

Jannael/Glinter162026年8月11日 更新

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

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

Jannael/Glinter162026年8月11日 更新

astro

無料

Skill for building with the Astro web framework. Helps create Astro components and pages, configure SSR adapters, set up content collections, deploy static sites, and manage project structure and CLI commands. Use when the user needs to work with Astro, mentions .astro files, asks about static site generation (SSG), islands architecture, content collections, or deploying an Astro project.

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

Jannael/Glinter162026年8月11日 更新

Bun

無料

Use when building, testing, or deploying JavaScript/TypeScript applications. Reach for Bun when you need to run scripts, manage packages, bundle code, or test applications with a single unified toolkit.

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

Jannael/Glinter162026年8月11日 更新

caveman

無料

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

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

Jannael/Glinter162026年8月11日 更新

Ultra-compressed commit message generator. Cuts noise from commit messages while preserving intent and reasoning. Conventional Commits format. Subject ≤50 chars, body only when "why" isn't obvious. Use when user says "write a commit", "commit message", "generate commit", "/commit", or invokes /caveman-commit. Auto-triggers when staging changes.

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

Jannael/Glinter162026年8月11日 更新

Jannael のスキルをすべて見る

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