AGENT SKILL

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
所属仓库
deJames-13/deblog
最近更新
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

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

  1. Unified Global Design: Consolidate design tokens and utility combinations into dedicated stylesheets for consistency.
  2. Maintainable Design: Decouple CSS style rules from React/Vue/Svelte component logic.
  3. Flexible Theming: Centralized styling enables rapid token overrides, dark-mode variations, and theme swapping.
  4. 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 under styles/.
  • 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 a main.css that 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

04 同仓库更多 Skills

deJames-13
deJames-13/deblog

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.

★ 1
deJames-13
deJames-13/deblog

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.

★ 1
deJames-13
deJames-13/deblog

grill-me

A relentless interview to sharpen a plan or design.

★ 1
deJames-13
deJames-13/deblog

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.

★ 1
deJames-13
deJames-13/deblog

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.

★ 1
deJames-13
deJames-13/deblog

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.

★ 1