tailwindcss-core
Configuration and directives Tailwind CSS v4.1. @theme, @import, @source, @utility, @variant, @apply, @config. CSS-first mode without tailwind.config.js.
What this skill does
# Tailwind CSS Core v4.1
## Overview
Tailwind CSS v4.1 introduces a **CSS-first** approach that eliminates the need for a traditional `tailwind.config.js` file. All configuration is now done directly in your CSS files via specialized directives.
## Key Concepts
### 1. @import "tailwindcss"
Entry point to load Tailwind CSS. Place at the beginning of your main CSS file.
```css
@import "tailwindcss";
```
This directive automatically loads:
- Base utilities
- Responsive variants
- Layers (theme, base, components, utilities)
### 2. @theme
Directive to define or customize theme values via CSS custom properties.
```css
@theme {
--color-primary: #3b82f6;
--color-secondary: #ef4444;
--spacing-custom: 2.5rem;
--radius-lg: 1rem;
}
```
Variables are accessible in generated utilities:
- `--color-*` → classes `bg-primary`, `text-primary`, etc.
- `--spacing-*` → classes `p-custom`, `m-custom`, etc.
- `--radius-*` → classes `rounded-lg`, etc.
### 3. @source
Directive to include additional source files with glob patterns.
```css
@source "./routes/**/*.{ts,tsx}";
@source "./components/**/*.{tsx,jsx}";
@source "../packages/ui/src/**/*.{ts,tsx}";
```
Tailwind will scan these files to generate utilities used in your project.
### 4. @utility and @variant
Directives to create custom utilities and variants.
```css
@utility truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@variant group-hover {
.group:hover &
}
```
### 5. @apply
Directive to apply Tailwind classes in your custom CSS rules.
```css
.btn {
@apply px-4 py-2 rounded-lg font-semibold;
}
.btn-primary {
@apply bg-blue-500 text-white hover:bg-blue-600;
}
```
### 6. @config
Directive to load external configuration if needed.
```css
@config "./tailwind.config.js";
```
(Optional in v4.1, mainly used for backward compatibility)
## Dark Mode
Dark mode configuration in Tailwind v4.1:
```css
@import "tailwindcss";
/* Use system preference */
@variant dark (&:is(.dark *));
```
Or via manual class:
```css
@variant dark (&.dark);
```
## Responsive Breakpoints
Breakpoints are defined via `@theme`:
```css
@theme {
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;
}
```
Responsive variants are used with utilities:
```html
<div class="text-sm md:text-base lg:text-lg"></div>
```
## Layer Hierarchy
```css
@layer theme, base, components, utilities;
@import "tailwindcss";
/* Your customizations */
@layer components {
.btn { @apply px-4 py-2 rounded; }
}
@layer utilities {
.text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
}
```
## Plugin Integration
Load Tailwind plugins:
```css
@import "tailwindcss";
@plugin "flowbite/plugin";
@source "../node_modules/flowbite";
```
## Specificity Order
In CSS-first, import and declaration order determines specificity:
1. `@import "tailwindcss"` - Base utilities
2. `@theme { ... }` - Theme variables
3. `@layer components { ... }` - Custom components
4. `@layer utilities { ... }` - Custom utilities
## CSS-first Mode Benefits
- No complex JavaScript config file
- Type-safe via CSS variables
- Declarative and readable configuration
- Better integration with CSS preprocessors
- Simplified maintenance for large projects
## Detailed References
See specific files for:
- `theme.md` - Complete theme variable configuration
- `directives.md` - Syntax and examples of all directives
- `config.md` - Advanced configuration and use cases
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.