@dynokostya/just-works 1.0.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/.claude/agents/csharp-code-writer.md +32 -0
- package/.claude/agents/diagrammer.md +49 -0
- package/.claude/agents/frontend-code-writer.md +36 -0
- package/.claude/agents/prompt-writer.md +38 -0
- package/.claude/agents/python-code-writer.md +32 -0
- package/.claude/agents/swift-code-writer.md +32 -0
- package/.claude/agents/typescript-code-writer.md +32 -0
- package/.claude/commands/git-sync.md +96 -0
- package/.claude/commands/project-docs.md +287 -0
- package/.claude/settings.json +112 -0
- package/.claude/settings.json.default +15 -0
- package/.claude/skills/csharp-coding/SKILL.md +368 -0
- package/.claude/skills/ddd-architecture-python/SKILL.md +288 -0
- package/.claude/skills/feature-driven-architecture-python/SKILL.md +302 -0
- package/.claude/skills/gemini-3-prompting/SKILL.md +483 -0
- package/.claude/skills/gpt-5-2-prompting/SKILL.md +295 -0
- package/.claude/skills/opus-4-6-prompting/SKILL.md +315 -0
- package/.claude/skills/plantuml-diagramming/SKILL.md +758 -0
- package/.claude/skills/python-coding/SKILL.md +293 -0
- package/.claude/skills/react-coding/SKILL.md +264 -0
- package/.claude/skills/rest-api/SKILL.md +421 -0
- package/.claude/skills/shadcn-ui-coding/SKILL.md +454 -0
- package/.claude/skills/swift-coding/SKILL.md +401 -0
- package/.claude/skills/tailwind-css-coding/SKILL.md +268 -0
- package/.claude/skills/typescript-coding/SKILL.md +464 -0
- package/.claude/statusline-command.sh +34 -0
- package/.codex/prompts/plan-reviewer.md +162 -0
- package/.codex/prompts/project-docs.md +287 -0
- package/.codex/skills/ddd-architecture-python/SKILL.md +288 -0
- package/.codex/skills/feature-driven-architecture-python/SKILL.md +302 -0
- package/.codex/skills/gemini-3-prompting/SKILL.md +483 -0
- package/.codex/skills/gpt-5-2-prompting/SKILL.md +295 -0
- package/.codex/skills/opus-4-6-prompting/SKILL.md +315 -0
- package/.codex/skills/plantuml-diagramming/SKILL.md +758 -0
- package/.codex/skills/python-coding/SKILL.md +293 -0
- package/.codex/skills/react-coding/SKILL.md +264 -0
- package/.codex/skills/rest-api/SKILL.md +421 -0
- package/.codex/skills/shadcn-ui-coding/SKILL.md +454 -0
- package/.codex/skills/tailwind-css-coding/SKILL.md +268 -0
- package/.codex/skills/typescript-coding/SKILL.md +464 -0
- package/AGENTS.md +57 -0
- package/CLAUDE.md +98 -0
- package/LICENSE +201 -0
- package/README.md +114 -0
- package/bin/cli.mjs +291 -0
- package/package.json +39 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwind-css-coding
|
|
3
|
+
description: Apply when writing or editing Tailwind CSS classes in any template or component file. Behavioral corrections for dynamic styling, class composition, responsive design, dark mode, interaction states, accessibility, and common antipatterns. Project conventions always override these defaults.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tailwind CSS Coding
|
|
7
|
+
|
|
8
|
+
Match the project's existing conventions. When uncertain, read 2-3 existing components to infer the local style. Check `package.json` for the `tailwindcss` version. v4 signals: `@tailwindcss/postcss` or `@tailwindcss/vite` in deps, `@import "tailwindcss"` in CSS, `@theme {}` blocks. v3 signals: `tailwind.config.js` with `module.exports`, `@tailwind base;` directives, `autoprefixer` as separate dep. These defaults apply only when the project has no established convention.
|
|
9
|
+
|
|
10
|
+
## Never rules
|
|
11
|
+
|
|
12
|
+
These are unconditional. They prevent broken builds, invisible bugs, and inaccessible UI regardless of project style.
|
|
13
|
+
|
|
14
|
+
- **Never construct class names dynamically** -- Tailwind's compiler scans source files as plain text with regex. It never executes code. Template literals, string concatenation, and interpolation produce classes the compiler cannot find. Use lookup maps of complete static strings.
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// Wrong: compiler cannot extract "bg-red-500" from this
|
|
18
|
+
const cls = `bg-${color}-500`;
|
|
19
|
+
|
|
20
|
+
// Correct: every class is a complete static string
|
|
21
|
+
const bgMap = {
|
|
22
|
+
red: "bg-red-500",
|
|
23
|
+
blue: "bg-blue-500",
|
|
24
|
+
} as const;
|
|
25
|
+
const cls = bgMap[color];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- **Never use template literal concatenation for class composition** -- CSS source order determines which class wins when two utilities target the same property, not HTML attribute order. `p-4 p-6` is unpredictable. Use `cn()` (clsx + tailwind-merge) to merge classes safely.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
// Wrong: conflicting padding, last-in-source wins (not last-in-string)
|
|
32
|
+
className={`p-4 ${isLarge ? "p-6" : ""}`}
|
|
33
|
+
|
|
34
|
+
// Correct: tailwind-merge resolves conflicts deterministically
|
|
35
|
+
import { cn } from "@/lib/utils";
|
|
36
|
+
className={cn("p-4", isLarge && "p-6")}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **Never use arbitrary values when a design token exists** -- `p-[16px]` is `p-4`. `bg-[#3b82f6]` is `bg-blue-500`. `w-[100%]` is `w-full`. `text-[14px]` is `text-sm`. Arbitrary values bypass the design system and create inconsistency.
|
|
40
|
+
|
|
41
|
+
- **Never omit interaction states on interactive elements** -- every button and link needs `hover:`, `focus-visible:`, and `disabled:` states. Add `transition-colors` for smooth feedback. In v4: add `cursor-pointer` explicitly -- Preflight no longer sets it on buttons.
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
// Wrong: no interaction feedback
|
|
45
|
+
<button className="bg-blue-500 text-white px-4 py-2 rounded">Save</button>
|
|
46
|
+
|
|
47
|
+
// Correct: full interaction states (v4: include cursor-pointer)
|
|
48
|
+
<button className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer">
|
|
49
|
+
Save
|
|
50
|
+
</button>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **Never use `@apply` for patterns extractable to components** -- extract a React/Vue/Svelte component instead. `@apply` is only for third-party library overrides, CMS/Markdown HTML, and non-component template languages.
|
|
54
|
+
|
|
55
|
+
- **Never forget dark mode counterparts** -- every `bg-`, `text-`, and `border-` color needs a `dark:` variant, or use CSS variable theming to handle both modes in one declaration.
|
|
56
|
+
|
|
57
|
+
- **Never use `sm:` thinking it means "small screens"** -- `sm:` means 640px AND ABOVE. Unprefixed utilities apply to all screens (mobile-first). Write base styles for mobile, then layer breakpoints upward.
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<!-- Wrong mental model: "sm means small phones" -->
|
|
61
|
+
<div class="hidden sm:block">Only on small screens</div>
|
|
62
|
+
|
|
63
|
+
<!-- Correct: sm:block means "show at 640px and above" -->
|
|
64
|
+
<div class="block sm:hidden">Mobile only</div>
|
|
65
|
+
<div class="hidden sm:block">Desktop only</div>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **Never hallucinate class names** -- common fakes: `flex-center` (use `flex items-center justify-center`), `text-bold` (use `font-bold`), `bg-grey-500` (American spelling: `bg-gray-500`), `d-flex` (Bootstrap, not Tailwind).
|
|
69
|
+
|
|
70
|
+
- **Never output conflicting utilities** -- `p-4 p-6` is unpredictable. One value per CSS property. Don't redundantly set defaults (`flex flex-row`, `flex flex-nowrap`).
|
|
71
|
+
|
|
72
|
+
- **Never forget accessibility** -- use `sr-only` for icon-only button labels, `focus:not-sr-only` for skip links. Every interactive element needs visible focus indication via `focus-visible:`.
|
|
73
|
+
|
|
74
|
+
## Dynamic styling
|
|
75
|
+
|
|
76
|
+
For conditional classes, use `cn()` (clsx + tailwind-merge). For truly dynamic values that cannot be enumerated (user-set colors, computed positions), use inline `style` props -- these bypass the compiler entirely and always work.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
// Conditional classes: cn()
|
|
80
|
+
<div className={cn("rounded p-4", isActive && "ring-2 ring-blue-500")} />
|
|
81
|
+
|
|
82
|
+
// Truly dynamic: inline style
|
|
83
|
+
<div className="rounded p-4" style={{ backgroundColor: user.brandColor }} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For variant-driven styling, use a lookup map with complete static strings:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
const sizeClasses = {
|
|
90
|
+
sm: "px-2 py-1 text-sm",
|
|
91
|
+
md: "px-4 py-2 text-base",
|
|
92
|
+
lg: "px-6 py-3 text-lg",
|
|
93
|
+
} as const;
|
|
94
|
+
|
|
95
|
+
function Button({ size = "md", className, ...props }: ButtonProps) {
|
|
96
|
+
return <button className={cn(sizeClasses[size], className)} {...props} />;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For components with 2+ variant dimensions, consider `cva` from class-variance-authority.
|
|
101
|
+
|
|
102
|
+
When the compiler must see classes that only appear in dynamic data (CMS content, database values), safelist them. In v4: `@source inline("bg-red-500 bg-blue-500")`. In v3: `safelist` array in `tailwind.config.js`.
|
|
103
|
+
|
|
104
|
+
## Class composition
|
|
105
|
+
|
|
106
|
+
The `cn()` helper combines `clsx` (conditional joining) with `tailwind-merge` (conflict resolution). Standard setup:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { clsx, type ClassValue } from "clsx";
|
|
110
|
+
import { twMerge } from "tailwind-merge";
|
|
111
|
+
|
|
112
|
+
export function cn(...inputs: ClassValue[]) {
|
|
113
|
+
return twMerge(clsx(inputs));
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Use `cn()` whenever merging external `className` props with internal defaults -- raw concatenation silently breaks when both sides set the same property.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
// Wrong: parent's p-6 may or may not override internal p-4
|
|
121
|
+
function Card({ className }: { className?: string }) {
|
|
122
|
+
return <div className={`rounded bg-white p-4 ${className}`} />;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Correct: tailwind-merge ensures parent overrides win
|
|
126
|
+
function Card({ className }: { className?: string }) {
|
|
127
|
+
return <div className={cn("rounded bg-white p-4", className)} />;
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Responsive design
|
|
132
|
+
|
|
133
|
+
Mobile-first: write base styles for the smallest screen, then add breakpoints upward. Always order breakpoints `sm:` -> `md:` -> `lg:` -> `xl:` -> `2xl:`. Never skip to `lg:` without considering the gap.
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<!-- Single column on mobile, two on tablet, three on desktop -->
|
|
137
|
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
In v4: container queries are built-in (no plugin). Use `@container` for component-scoped responsive design:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
// Parent declares a container
|
|
144
|
+
<div className="@container">
|
|
145
|
+
{/* Child responds to container width, not viewport */}
|
|
146
|
+
<div className="flex flex-col @md:flex-row @lg:grid @lg:grid-cols-3 gap-4">
|
|
147
|
+
{children}
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Dark mode
|
|
153
|
+
|
|
154
|
+
Cover every visible color. A component with `bg-white text-gray-900` needs `dark:bg-gray-900 dark:text-white`. Missing a single `dark:` variant causes unreadable text or invisible elements.
|
|
155
|
+
|
|
156
|
+
Better approach -- CSS variable theming. Define colors once, switch palettes:
|
|
157
|
+
|
|
158
|
+
```css
|
|
159
|
+
/* v4: @theme block */
|
|
160
|
+
@theme {
|
|
161
|
+
--color-surface: #ffffff;
|
|
162
|
+
--color-on-surface: #111827;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
166
|
+
|
|
167
|
+
.dark {
|
|
168
|
+
--color-surface: #111827;
|
|
169
|
+
--color-on-surface: #f9fafb;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Then use `bg-surface text-on-surface` everywhere -- no `dark:` variants needed per component.
|
|
174
|
+
|
|
175
|
+
## Interaction states
|
|
176
|
+
|
|
177
|
+
Minimum states for buttons: `hover:`, `focus-visible:`, `disabled:`, `transition-colors`. Minimum for inputs: `focus:`, `disabled:`, `placeholder:`. Minimum for links: `hover:`, `focus-visible:`.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
// Complete button pattern
|
|
181
|
+
<button className={cn(
|
|
182
|
+
"px-4 py-2 rounded font-medium transition-colors",
|
|
183
|
+
"bg-blue-600 text-white",
|
|
184
|
+
"hover:bg-blue-700",
|
|
185
|
+
"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",
|
|
186
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
187
|
+
"cursor-pointer" // v4: Preflight no longer sets cursor:pointer on buttons
|
|
188
|
+
)}>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Complete input pattern:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
<input className={cn(
|
|
195
|
+
"w-full rounded border px-3 py-2 transition-colors",
|
|
196
|
+
"border-gray-300 bg-white text-gray-900",
|
|
197
|
+
"dark:border-gray-600 dark:bg-gray-800 dark:text-white",
|
|
198
|
+
"placeholder:text-gray-400 dark:placeholder:text-gray-500",
|
|
199
|
+
"focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
200
|
+
"disabled:cursor-not-allowed disabled:bg-gray-100 disabled:opacity-50",
|
|
201
|
+
)} />
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
In v4: `hover:` only fires on hover-capable devices (`@media (hover: hover)`). Touch-only devices skip hover styles entirely -- don't rely on hover for critical information.
|
|
205
|
+
|
|
206
|
+
## Accessibility
|
|
207
|
+
|
|
208
|
+
Icon-only buttons need screen reader text:
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
<button className="p-2 rounded hover:bg-gray-100">
|
|
212
|
+
<SearchIcon className="h-5 w-5" aria-hidden="true" />
|
|
213
|
+
<span className="sr-only">Search</span>
|
|
214
|
+
</button>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Skip links use `sr-only` that becomes visible on focus:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
<a href="#main" className="sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4 focus:z-50 focus:px-4 focus:py-2 focus:bg-white focus:text-black focus:rounded">
|
|
221
|
+
Skip to main content
|
|
222
|
+
</a>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Every focusable element needs a visible focus indicator. `focus-visible:` is preferred over `focus:` -- it only shows for keyboard navigation, not mouse clicks.
|
|
226
|
+
|
|
227
|
+
Ensure sufficient color contrast on interactive states. A `hover:bg-blue-700` on `bg-blue-600` is barely visible -- test both light and dark modes.
|
|
228
|
+
|
|
229
|
+
## v4 configuration
|
|
230
|
+
|
|
231
|
+
In v4, configuration lives in CSS, not JavaScript. Entry point is `@import "tailwindcss"`. Autoprefixer is built-in (don't add it separately).
|
|
232
|
+
|
|
233
|
+
```css
|
|
234
|
+
@import "tailwindcss";
|
|
235
|
+
|
|
236
|
+
@theme {
|
|
237
|
+
--font-display: "Inter", sans-serif;
|
|
238
|
+
--color-brand: #4f46e5;
|
|
239
|
+
--breakpoint-3xl: 1920px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@utility card {
|
|
243
|
+
background: var(--color-surface);
|
|
244
|
+
border-radius: var(--radius-lg);
|
|
245
|
+
padding: var(--spacing-6);
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Key v4 renames (old names still work via compat but generate warnings):
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
v3 v4
|
|
253
|
+
shadow -> shadow-sm ring -> ring-3
|
|
254
|
+
shadow-sm -> shadow-xs outline-none -> outline-hidden
|
|
255
|
+
rounded -> rounded-sm bg-gradient-to-r -> bg-linear-to-r
|
|
256
|
+
rounded-sm -> rounded-xs blur -> blur-sm
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Other v4 changes inline:
|
|
260
|
+
|
|
261
|
+
```tsx
|
|
262
|
+
// v3: bg-opacity-50 -> v4: bg-black/50 (opacity modifier)
|
|
263
|
+
// v3: bg-[--brand-color] -> v4: bg-(--brand-color) (CSS variable syntax)
|
|
264
|
+
// v3: !bg-red-500 -> v4: bg-red-500! (important modifier at end)
|
|
265
|
+
// v3: first:*:pt-0 -> v4: *:first:pt-0 (variant stacking left-to-right)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Borders default to `currentColor` in v4, not `gray-200`. Add explicit border colors if the v3 default was relied upon. Custom utilities via `@utility name {}` not `@layer components {}`. Safelist via `@source inline("...")` not `safelist` array.
|