tailwind-file-first-vsa
Prioritizes file-based Tailwind CSS styling using Vertical Slice Architecture (VSA) to reduce component bloat and maintain a scalable global design system. Use when structuring Tailwind styles, refactoring utility-bloated JSX/HTML components, or organizing stylesheets into feature domain slices.
- License 许可
- MIT
- 最近更新
- 2026-09-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- tailwind-file-first-vsa
- tags
- [ "tailwind", "css", "vsa", "architecture", "styling" ]
- version
- 1.0.0
- description
- Prioritizes file-based Tailwind CSS styling using Vertical Slice Architecture (VSA) to reduce component bloat and maintain a scalable global design system. Use when structuring Tailwind styles, refactoring utility-bloated JSX/HTML components, or organizing stylesheets into feature domain slices.
02 资源文件 5
- 参考文档agents/openai.yaml232 B
- 参考文档examples/basic-example.md5.7 KB
- 参考文档references/technical-details.md5.2 KB
- 其他resources/.gitkeep—
- 脚本scripts/run.sh4.6 KB
03 SKILL.md 正文
Tailwind File-First VSA Architect
Enforces a strict "File-Based First" architecture for Tailwind CSS development. Instead of polluting JSX/HTML components with repetitive inline utility strings, styles are composed into dedicated, domain-sliced .css files using Tailwind's @apply directive.
🎯 When to Activate This Skill
- When creating or styling UI components with Tailwind CSS.
- When refactoring JSX/HTML files burdened with inline utility class bloat.
- When structuring or auditing project stylesheets using Vertical Slice Architecture (VSA).
- When establishing centralized design tokens, global themes, or domain-specific style aggregators.
🧠 Core Objectives
- Unified Global Design: Consolidate design tokens and utility combinations into dedicated stylesheets for consistency.
- Maintainable Design: Decouple CSS style rules from React/Vue/Svelte component logic.
- Flexible Theming: Centralized styling enables rapid token overrides, dark-mode variations, and theme swapping.
- Zero Component Bloat: Keep JSX/HTML lean, semantic, and readable by abstracting utility chains into meaningful class names.
📐 Vertical Slice Architecture (VSA) for Styles
Styles mirror domain boundaries using screaming architecture:
styles/
├── dashboard/ # Feature Slice Context
│ ├── main.css # Feature Aggregator (imports slice styles)
│ ├── header.css # Domain-specific header styles
│ └── sidebar.css # Domain-specific sidebar styles
├── button.css # Global shared element
├── card.css # Global shared element
├── input.css # Global shared element
├── main.css # Shared elements aggregator
└── styles.css # Root stylesheet (Tailwind directives & slice imports)
- Global Shared Elements: Primitive, universally reused components (
button.css,card.css) live directly understyles/. - Feature Slices: Co-located context styles belong in a dedicated domain folder (e.g.,
styles/dashboard/,styles/auth/). - Aggregators (
main.css): Every slice folder contains amain.cssthat imports its child stylesheets.
🚀 Execution Workflow for Agents
Step 1: Categorize Component Scope
Determine if the element is a Global Shared Element (used across features) or belongs to a Feature Slice (specific page or domain context).
Step 2: Scaffold the Stylesheet Slice
Create the target .css file in styles/ or the corresponding styles/<slice>/ directory. You can automate this with the helper script:
./scripts/run.sh <slice-name> <element-name>
# Example: ./scripts/run.sh dashboard sidebar
Step 3: Compose Utilities with @apply
Write semantic CSS classes wrapping Tailwind utilities within @layer components:
@layer components {
.dashboard-sidebar {
@apply flex flex-col w-64 min-h-screen bg-slate-900 border-r border-slate-800 p-4;
}
.dashboard-sidebar-item {
@apply flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-colors;
}
}
Step 4: Wire Aggregator & Root Imports
Ensure the .css file is imported into its slice main.css, and that the slice aggregator is imported into the root styles.css.
Step 5: Apply Semantic Classes to Components
Replace inline utility strings in JSX/HTML with the semantic class names.
📁 References & Examples
- Concrete Refactoring Walkthrough - Before-and-after component refactor and file layout.
- Technical Architecture & @apply Guide - Layer precedence, variant handling, and Tailwind v3/v4 compatibility.
- Scaffold Helper Script - Bash automation to generate VSA slices and wire aggregator imports.
04 同仓库更多 Skills
vertical-slice-architect
Enforces strict vertical slice architecture, highly granular file-based Single Responsibility Principle (SRP), and domain-driven folder structures before writing any code.
tdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grill-me
A relentless interview to sharpen a plan or design.
angular-new-app
Creates a new Angular app using the Angular CLI. This skill should be used whenever a user wants to create a new Angular application and contains important guidelines for how to effectively create a modern Angular application.
angular-developer
Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, naming conventions, or CLI tooling.
angular-architect
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS patterns, and optimizes bundle performance. Use when building Angular 17+ applications with standalone components or signals, setting up NgRx stores, establishing RxJS reactive patterns, performance tuning, or writing Angular tests for enterprise apps.