@neyugn/agent-kits 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +514 -0
- package/README.vi.md +410 -0
- package/README.zh.md +410 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +422 -0
- package/kits/coder/ARCHITECTURE.md +289 -0
- package/kits/coder/agents/ai-engineer.md +344 -0
- package/kits/coder/agents/backend-specialist.md +270 -0
- package/kits/coder/agents/cloud-architect.md +363 -0
- package/kits/coder/agents/code-reviewer.md +284 -0
- package/kits/coder/agents/data-engineer.md +401 -0
- package/kits/coder/agents/database-specialist.md +251 -0
- package/kits/coder/agents/debugger.md +209 -0
- package/kits/coder/agents/devops-engineer.md +281 -0
- package/kits/coder/agents/documentation-writer.md +296 -0
- package/kits/coder/agents/frontend-specialist.md +298 -0
- package/kits/coder/agents/i18n-specialist.md +348 -0
- package/kits/coder/agents/integration-specialist.md +314 -0
- package/kits/coder/agents/mobile-developer.md +271 -0
- package/kits/coder/agents/multi-tenant-architect.md +281 -0
- package/kits/coder/agents/orchestrator.md +263 -0
- package/kits/coder/agents/performance-analyst.md +327 -0
- package/kits/coder/agents/project-planner.md +277 -0
- package/kits/coder/agents/queue-specialist.md +282 -0
- package/kits/coder/agents/realtime-specialist.md +267 -0
- package/kits/coder/agents/security-auditor.md +253 -0
- package/kits/coder/agents/test-engineer.md +315 -0
- package/kits/coder/agents/ux-researcher.md +388 -0
- package/kits/coder/rules/.cursorrules +287 -0
- package/kits/coder/rules/CLAUDE.md +287 -0
- package/kits/coder/rules/CODEX.md +287 -0
- package/kits/coder/rules/GEMINI.md +287 -0
- package/kits/coder/scripts/checklist.py +318 -0
- package/kits/coder/scripts/kit_status.py +292 -0
- package/kits/coder/scripts/skills_manager.py +243 -0
- package/kits/coder/scripts/verify_all.py +391 -0
- package/kits/coder/skills/accessibility-patterns/SKILL.md +372 -0
- package/kits/coder/skills/accessibility-patterns/scripts/a11y_checker.py +211 -0
- package/kits/coder/skills/ai-rag-patterns/SKILL.md +444 -0
- package/kits/coder/skills/api-patterns/SKILL.md +316 -0
- package/kits/coder/skills/api-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/api-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/api-patterns/scripts/api_validator.py +253 -0
- package/kits/coder/skills/api-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/auth-patterns/SKILL.md +267 -0
- package/kits/coder/skills/aws-patterns/SKILL.md +576 -0
- package/kits/coder/skills/brainstorming/SKILL.md +370 -0
- package/kits/coder/skills/brainstorming/assets/.gitkeep +1 -0
- package/kits/coder/skills/brainstorming/references/deep-dive.md +21 -0
- package/kits/coder/skills/brainstorming/scripts/validate.py +56 -0
- package/kits/coder/skills/clean-code/SKILL.md +240 -0
- package/kits/coder/skills/clean-code/assets/.gitkeep +1 -0
- package/kits/coder/skills/clean-code/references/deep-dive.md +21 -0
- package/kits/coder/skills/clean-code/scripts/lint_runner.py +186 -0
- package/kits/coder/skills/clean-code/scripts/validate.py +56 -0
- package/kits/coder/skills/database-design/SKILL.md +255 -0
- package/kits/coder/skills/database-design/assets/.gitkeep +1 -0
- package/kits/coder/skills/database-design/references/deep-dive.md +21 -0
- package/kits/coder/skills/database-design/scripts/schema_validator.py +272 -0
- package/kits/coder/skills/database-design/scripts/validate.py +56 -0
- package/kits/coder/skills/docker-patterns/SKILL.md +240 -0
- package/kits/coder/skills/documentation-templates/SKILL.md +441 -0
- package/kits/coder/skills/e2e-testing/SKILL.md +457 -0
- package/kits/coder/skills/flutter-patterns/SKILL.md +330 -0
- package/kits/coder/skills/frontend-design/SKILL.md +127 -0
- package/kits/coder/skills/github-actions/SKILL.md +349 -0
- package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +466 -0
- package/kits/coder/skills/graphql-patterns/SKILL.md +558 -0
- package/kits/coder/skills/i18n-localization/SKILL.md +345 -0
- package/kits/coder/skills/i18n-localization/scripts/i18n_checker.py +267 -0
- package/kits/coder/skills/kubernetes-patterns/SKILL.md +357 -0
- package/kits/coder/skills/mermaid-diagrams/SKILL.md +351 -0
- package/kits/coder/skills/mobile-design/SKILL.md +305 -0
- package/kits/coder/skills/monitoring-observability/SKILL.md +458 -0
- package/kits/coder/skills/multi-tenancy/SKILL.md +317 -0
- package/kits/coder/skills/multi-tenancy/assets/.gitkeep +1 -0
- package/kits/coder/skills/multi-tenancy/references/deep-dive.md +21 -0
- package/kits/coder/skills/multi-tenancy/scripts/validate.py +56 -0
- package/kits/coder/skills/nodejs-best-practices/SKILL.md +220 -0
- package/kits/coder/skills/performance-profiling/SKILL.md +333 -0
- package/kits/coder/skills/performance-profiling/assets/.gitkeep +1 -0
- package/kits/coder/skills/performance-profiling/references/deep-dive.md +21 -0
- package/kits/coder/skills/performance-profiling/scripts/validate.py +56 -0
- package/kits/coder/skills/plan-writing/SKILL.md +360 -0
- package/kits/coder/skills/plan-writing/assets/.gitkeep +1 -0
- package/kits/coder/skills/plan-writing/references/deep-dive.md +21 -0
- package/kits/coder/skills/plan-writing/scripts/validate.py +56 -0
- package/kits/coder/skills/postgres-patterns/SKILL.md +361 -0
- package/kits/coder/skills/prompt-engineering/SKILL.md +277 -0
- package/kits/coder/skills/queue-patterns/SKILL.md +359 -0
- package/kits/coder/skills/queue-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/queue-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/queue-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/react-native-patterns/SKILL.md +393 -0
- package/kits/coder/skills/react-patterns/SKILL.md +319 -0
- package/kits/coder/skills/realtime-patterns/SKILL.md +506 -0
- package/kits/coder/skills/realtime-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/realtime-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/realtime-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/redis-patterns/SKILL.md +484 -0
- package/kits/coder/skills/security-fundamentals/SKILL.md +363 -0
- package/kits/coder/skills/security-fundamentals/assets/.gitkeep +1 -0
- package/kits/coder/skills/security-fundamentals/references/deep-dive.md +21 -0
- package/kits/coder/skills/security-fundamentals/scripts/security_scan.py +326 -0
- package/kits/coder/skills/security-fundamentals/scripts/validate.py +56 -0
- package/kits/coder/skills/seo-patterns/SKILL.md +262 -0
- package/kits/coder/skills/seo-patterns/scripts/seo_checker.py +211 -0
- package/kits/coder/skills/systematic-debugging/SKILL.md +478 -0
- package/kits/coder/skills/systematic-debugging/assets/.gitkeep +1 -0
- package/kits/coder/skills/systematic-debugging/references/deep-dive.md +21 -0
- package/kits/coder/skills/systematic-debugging/scripts/validate.py +56 -0
- package/kits/coder/skills/tailwind-patterns/SKILL.md +395 -0
- package/kits/coder/skills/terraform-patterns/SKILL.md +470 -0
- package/kits/coder/skills/testing-patterns/SKILL.md +285 -0
- package/kits/coder/skills/testing-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/testing-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kits/coder/skills/testing-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/typescript-patterns/SKILL.md +417 -0
- package/kits/coder/skills/ui-ux-pro-max/SKILL.md +364 -0
- package/kits/coder/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/kits/coder/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/kits/coder/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/kits/coder/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/kits/coder/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/kits/coder/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/kits/coder/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/kits/coder/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/kits/coder/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/kits/coder/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/kits/coder/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/kits/coder/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/core.py +257 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/design_system.py +488 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/search.py +76 -0
- package/kits/coder/workflows/.gitkeep +20 -0
- package/kits/coder/workflows/create.md +152 -0
- package/kits/coder/workflows/debug.md +223 -0
- package/kits/coder/workflows/deploy.md +283 -0
- package/kits/coder/workflows/orchestrate.md +243 -0
- package/kits/coder/workflows/plan.md +134 -0
- package/kits/coder/workflows/test.md +237 -0
- package/kits/coder/workflows/ui-ux-pro-max.md +109 -0
- package/package.json +49 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Example validator for systematic-debugging
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python validate.py <project_path>
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def validate(project_path: str) -> dict:
|
|
14
|
+
"""Main validation logic"""
|
|
15
|
+
results = {
|
|
16
|
+
'errors': [],
|
|
17
|
+
'warnings': [],
|
|
18
|
+
'passed': []
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# TODO: Add validation logic
|
|
22
|
+
results['passed'].append('Placeholder validation passed')
|
|
23
|
+
|
|
24
|
+
return results
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def print_results(results: dict):
|
|
28
|
+
"""Pretty print results"""
|
|
29
|
+
print("\n🔍 Validation Results\n")
|
|
30
|
+
|
|
31
|
+
if results['errors']:
|
|
32
|
+
print(f"❌ Errors ({len(results['errors'])})")
|
|
33
|
+
for error in results['errors']:
|
|
34
|
+
print(f" - {error}")
|
|
35
|
+
|
|
36
|
+
if results['warnings']:
|
|
37
|
+
print(f"\n⚠️ Warnings ({len(results['warnings'])})")
|
|
38
|
+
for warning in results['warnings']:
|
|
39
|
+
print(f" - {warning}")
|
|
40
|
+
|
|
41
|
+
if results['passed']:
|
|
42
|
+
print(f"\n✅ Passed ({len(results['passed'])})")
|
|
43
|
+
for passed in results['passed']:
|
|
44
|
+
print(f" - {passed}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
if len(sys.argv) < 2:
|
|
49
|
+
print("Usage: python validate.py <project_path>")
|
|
50
|
+
sys.exit(1)
|
|
51
|
+
|
|
52
|
+
project_path = sys.argv[1]
|
|
53
|
+
results = validate(project_path)
|
|
54
|
+
print_results(results)
|
|
55
|
+
|
|
56
|
+
sys.exit(1 if results['errors'] else 0)
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwind-patterns
|
|
3
|
+
description: Tailwind CSS v4 patterns and best practices. Utility-first CSS, component patterns, responsive design, dark mode, and design system architecture. Use when styling web applications with Tailwind.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tailwind CSS Patterns
|
|
8
|
+
|
|
9
|
+
> Utility-first CSS that actually scales.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Principles
|
|
14
|
+
|
|
15
|
+
1. **Utility-first** - Compose classes, don't write custom CSS
|
|
16
|
+
2. **Extract components** - When patterns repeat 3+ times
|
|
17
|
+
3. **Design tokens first** - Configure theme before building
|
|
18
|
+
4. **Responsive mobile-first** - Start small, scale up
|
|
19
|
+
5. **Dark mode native** - Design both themes from the start
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🎨 Tailwind v4 Changes
|
|
24
|
+
|
|
25
|
+
### CSS-First Configuration (v4)
|
|
26
|
+
|
|
27
|
+
```css
|
|
28
|
+
/* app.css - v4 uses CSS for configuration */
|
|
29
|
+
@import "tailwindcss";
|
|
30
|
+
|
|
31
|
+
@theme {
|
|
32
|
+
/* Colors */
|
|
33
|
+
--color-primary: oklch(0.7 0.15 250);
|
|
34
|
+
--color-secondary: oklch(0.6 0.1 180);
|
|
35
|
+
|
|
36
|
+
/* Spacing */
|
|
37
|
+
--spacing-18: 4.5rem;
|
|
38
|
+
|
|
39
|
+
/* Font */
|
|
40
|
+
--font-display: "Cal Sans", sans-serif;
|
|
41
|
+
|
|
42
|
+
/* Custom utilities */
|
|
43
|
+
--container-3xl: 1920px;
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### v3 vs v4 Comparison
|
|
48
|
+
|
|
49
|
+
| Feature | v3 (tailwind.config.js) | v4 (CSS @theme) |
|
|
50
|
+
| ----------------- | ----------------------- | ------------------------- |
|
|
51
|
+
| Configuration | JavaScript | CSS with `@theme` |
|
|
52
|
+
| Custom colors | `theme.extend.colors` | `--color-*` CSS variables |
|
|
53
|
+
| Plugins | JS plugins | CSS `@plugin` directive |
|
|
54
|
+
| JIT | Opt-in | Default |
|
|
55
|
+
| Container queries | Plugin needed | Native `@container` |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📐 Design Token Architecture
|
|
60
|
+
|
|
61
|
+
### Color System
|
|
62
|
+
|
|
63
|
+
```css
|
|
64
|
+
@theme {
|
|
65
|
+
/* Semantic colors (recommended) */
|
|
66
|
+
--color-background: oklch(1 0 0);
|
|
67
|
+
--color-foreground: oklch(0.1 0 0);
|
|
68
|
+
--color-muted: oklch(0.96 0.01 250);
|
|
69
|
+
--color-muted-foreground: oklch(0.55 0.02 250);
|
|
70
|
+
|
|
71
|
+
--color-primary: oklch(0.6 0.2 250);
|
|
72
|
+
--color-primary-foreground: oklch(1 0 0);
|
|
73
|
+
|
|
74
|
+
--color-destructive: oklch(0.6 0.2 25);
|
|
75
|
+
--color-destructive-foreground: oklch(1 0 0);
|
|
76
|
+
|
|
77
|
+
--color-border: oklch(0.9 0.01 250);
|
|
78
|
+
--color-ring: oklch(0.7 0.15 250);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Typography Scale
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
@theme {
|
|
86
|
+
--font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif;
|
|
87
|
+
--font-mono: "JetBrains Mono", ui-monospace, monospace;
|
|
88
|
+
|
|
89
|
+
--text-xs: 0.75rem;
|
|
90
|
+
--text-sm: 0.875rem;
|
|
91
|
+
--text-base: 1rem;
|
|
92
|
+
--text-lg: 1.125rem;
|
|
93
|
+
--text-xl: 1.25rem;
|
|
94
|
+
--text-2xl: 1.5rem;
|
|
95
|
+
--text-3xl: 1.875rem;
|
|
96
|
+
--text-4xl: 2.25rem;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Spacing System
|
|
101
|
+
|
|
102
|
+
```css
|
|
103
|
+
@theme {
|
|
104
|
+
/* Use 4px base (0.25rem) */
|
|
105
|
+
--spacing-0: 0;
|
|
106
|
+
--spacing-1: 0.25rem; /* 4px */
|
|
107
|
+
--spacing-2: 0.5rem; /* 8px */
|
|
108
|
+
--spacing-3: 0.75rem; /* 12px */
|
|
109
|
+
--spacing-4: 1rem; /* 16px */
|
|
110
|
+
--spacing-6: 1.5rem; /* 24px */
|
|
111
|
+
--spacing-8: 2rem; /* 32px */
|
|
112
|
+
--spacing-12: 3rem; /* 48px */
|
|
113
|
+
--spacing-16: 4rem; /* 64px */
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 🧩 Component Patterns
|
|
120
|
+
|
|
121
|
+
### Button Component
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
// Base button with variants
|
|
125
|
+
const buttonVariants = {
|
|
126
|
+
base: "inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
127
|
+
variants: {
|
|
128
|
+
variant: {
|
|
129
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
130
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
131
|
+
outline: "border border-border bg-background hover:bg-muted",
|
|
132
|
+
ghost: "hover:bg-muted",
|
|
133
|
+
destructive:
|
|
134
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
135
|
+
},
|
|
136
|
+
size: {
|
|
137
|
+
sm: "h-8 px-3 text-sm",
|
|
138
|
+
md: "h-10 px-4",
|
|
139
|
+
lg: "h-12 px-6 text-lg",
|
|
140
|
+
icon: "h-10 w-10",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
defaultVariants: {
|
|
144
|
+
variant: "default",
|
|
145
|
+
size: "md",
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Card Pattern
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
<div className="rounded-xl border border-border bg-card p-6 shadow-sm">
|
|
154
|
+
<div className="flex items-center gap-4 mb-4">
|
|
155
|
+
<div className="h-12 w-12 rounded-full bg-primary/10" />
|
|
156
|
+
<div>
|
|
157
|
+
<h3 className="font-semibold text-foreground">Title</h3>
|
|
158
|
+
<p className="text-sm text-muted-foreground">Subtitle</p>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<p className="text-foreground/80">Content goes here...</p>
|
|
162
|
+
</div>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Input Pattern
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<input
|
|
169
|
+
className="
|
|
170
|
+
flex h-10 w-full rounded-lg border border-border
|
|
171
|
+
bg-background px-3 py-2 text-foreground
|
|
172
|
+
placeholder:text-muted-foreground
|
|
173
|
+
focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent
|
|
174
|
+
disabled:cursor-not-allowed disabled:opacity-50
|
|
175
|
+
"
|
|
176
|
+
placeholder="Enter text..."
|
|
177
|
+
/>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 📱 Responsive Design
|
|
183
|
+
|
|
184
|
+
### Mobile-First Breakpoints
|
|
185
|
+
|
|
186
|
+
| Prefix | Min-width | Target Devices |
|
|
187
|
+
| ------ | --------- | -------------- |
|
|
188
|
+
| (none) | 0 | Mobile default |
|
|
189
|
+
| `sm` | 640px | Large phones |
|
|
190
|
+
| `md` | 768px | Tablets |
|
|
191
|
+
| `lg` | 1024px | Laptops |
|
|
192
|
+
| `xl` | 1280px | Desktops |
|
|
193
|
+
| `2xl` | 1536px | Large screens |
|
|
194
|
+
|
|
195
|
+
### Responsive Pattern
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
// Mobile-first: start with mobile, override for larger
|
|
199
|
+
<div
|
|
200
|
+
className="
|
|
201
|
+
grid grid-cols-1 gap-4
|
|
202
|
+
sm:grid-cols-2
|
|
203
|
+
lg:grid-cols-3
|
|
204
|
+
xl:grid-cols-4
|
|
205
|
+
"
|
|
206
|
+
>
|
|
207
|
+
{items.map((item) => (
|
|
208
|
+
<Card key={item.id} />
|
|
209
|
+
))}
|
|
210
|
+
</div>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Container Queries (v4)
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
// Parent defines container
|
|
217
|
+
<div className="@container">
|
|
218
|
+
{/* Child responds to container, not viewport */}
|
|
219
|
+
<div className="@sm:flex @md:grid @lg:grid-cols-2">
|
|
220
|
+
Content adapts to container width
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 🌙 Dark Mode
|
|
228
|
+
|
|
229
|
+
### Class Strategy (Recommended)
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
// HTML element has 'dark' class
|
|
233
|
+
<html className="dark">
|
|
234
|
+
|
|
235
|
+
// Components use dark: prefix
|
|
236
|
+
<div className="bg-white dark:bg-slate-900">
|
|
237
|
+
<p className="text-slate-900 dark:text-white">
|
|
238
|
+
Adapts to theme
|
|
239
|
+
</p>
|
|
240
|
+
</div>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Using CSS Variables (Better)
|
|
244
|
+
|
|
245
|
+
```css
|
|
246
|
+
/* Define in @theme - automatically works with dark mode */
|
|
247
|
+
@theme {
|
|
248
|
+
--color-background: oklch(1 0 0);
|
|
249
|
+
--color-foreground: oklch(0.1 0 0);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
@media (prefers-color-scheme: dark) {
|
|
253
|
+
:root {
|
|
254
|
+
--color-background: oklch(0.1 0 0);
|
|
255
|
+
--color-foreground: oklch(0.95 0 0);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
// Components just use semantic colors - no dark: needed
|
|
262
|
+
<div className="bg-background text-foreground">Works in both themes!</div>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## ⚡ Performance Patterns
|
|
268
|
+
|
|
269
|
+
### Avoid These
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
// ❌ Dynamic classes (can't be tree-shaken)
|
|
273
|
+
<div className={`text-${color}-500`}>
|
|
274
|
+
|
|
275
|
+
// ❌ Conditional with many variants
|
|
276
|
+
<div className={isLarge ? 'text-xl p-8' : 'text-sm p-4'}>
|
|
277
|
+
|
|
278
|
+
// ✅ Use complete class names
|
|
279
|
+
const sizeClasses = {
|
|
280
|
+
sm: 'text-sm p-4',
|
|
281
|
+
lg: 'text-xl p-8',
|
|
282
|
+
};
|
|
283
|
+
<div className={sizeClasses[size]}>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Class Merging (cn utility)
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import { clsx, type ClassValue } from 'clsx';
|
|
290
|
+
import { twMerge } from 'tailwind-merge';
|
|
291
|
+
|
|
292
|
+
export function cn(...inputs: ClassValue[]) {
|
|
293
|
+
return twMerge(clsx(inputs));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Usage - later classes override earlier
|
|
297
|
+
<button className={cn(
|
|
298
|
+
"px-4 py-2 bg-blue-500",
|
|
299
|
+
isActive && "bg-green-500",
|
|
300
|
+
className // Allow override from props
|
|
301
|
+
)} />
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 🎯 Common Patterns
|
|
307
|
+
|
|
308
|
+
### Flexbox Center
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
<div className="flex items-center justify-center h-screen">
|
|
312
|
+
Centered content
|
|
313
|
+
</div>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Truncate Text
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
<p className="truncate">Long text that will truncate...</p>
|
|
320
|
+
<p className="line-clamp-2">Multi-line text that clips after 2 lines...</p>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Aspect Ratio
|
|
324
|
+
|
|
325
|
+
```tsx
|
|
326
|
+
<div className="aspect-video">16:9 container</div>
|
|
327
|
+
<div className="aspect-square">1:1 container</div>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Glass Effect
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
<div className="backdrop-blur-md bg-white/70 dark:bg-black/70">
|
|
334
|
+
Glassmorphism effect
|
|
335
|
+
</div>
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Gradient Text
|
|
339
|
+
|
|
340
|
+
```tsx
|
|
341
|
+
<h1 className="bg-gradient-to-r from-purple-500 to-pink-500 bg-clip-text text-transparent">
|
|
342
|
+
Gradient Text
|
|
343
|
+
</h1>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## ✅ Checklist
|
|
349
|
+
|
|
350
|
+
### Setup
|
|
351
|
+
|
|
352
|
+
- [ ] Tailwind v4 installed correctly
|
|
353
|
+
- [ ] CSS `@theme` configured
|
|
354
|
+
- [ ] Design tokens defined
|
|
355
|
+
- [ ] `cn()` utility created
|
|
356
|
+
|
|
357
|
+
### Components
|
|
358
|
+
|
|
359
|
+
- [ ] Using semantic color names
|
|
360
|
+
- [ ] Mobile-first responsive
|
|
361
|
+
- [ ] Dark mode supported
|
|
362
|
+
- [ ] Accessible focus states
|
|
363
|
+
|
|
364
|
+
### Performance
|
|
365
|
+
|
|
366
|
+
- [ ] No dynamic class construction
|
|
367
|
+
- [ ] Classes are complete strings
|
|
368
|
+
- [ ] Unused styles tree-shaken
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## ❌ Anti-Patterns
|
|
373
|
+
|
|
374
|
+
| ❌ Don't | ✅ Do |
|
|
375
|
+
| -------------------------------- | -------------------------------- |
|
|
376
|
+
| `text-${color}-500` dynamic | Map to complete class strings |
|
|
377
|
+
| Inline arbitrary values `[23px]` | Define in `@theme` and use token |
|
|
378
|
+
| 20+ classes per element | Extract component or @apply |
|
|
379
|
+
| `dark:` on every element | Use CSS variables for colors |
|
|
380
|
+
| Skip focus states | Include `focus-visible:ring-*` |
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## 🔗 Related Skills
|
|
385
|
+
|
|
386
|
+
| Need | Skill |
|
|
387
|
+
| ------------------------ | ------------------------ |
|
|
388
|
+
| React component patterns | `react-patterns` |
|
|
389
|
+
| Accessibility | `accessibility-patterns` |
|
|
390
|
+
| Design principles | `frontend-design` |
|
|
391
|
+
| Performance | `performance-profiling` |
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
> **Remember:** Tailwind's power is in its constraints. Stick to the design system, use semantic colors, and resist the urge to add arbitrary values.
|