@its-thepoe/tailwindcss 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/README.md +25 -0
- package/SKILL.md +193 -0
- package/package.json +21 -0
- package/reference.md +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @its-thepoe/tailwindcss
|
|
2
|
+
|
|
3
|
+
**Agent Skill** — implement Tailwind CSS reliably (v3 or v4), wire it into the build, and debug "Tailwind classes not applying" without guessing.
|
|
4
|
+
|
|
5
|
+
## Install into your agents
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @its-thepoe/skills@latest install tailwindcss
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it focuses on
|
|
12
|
+
|
|
13
|
+
- Detect Tailwind major version first (v3 vs v4).
|
|
14
|
+
- Ensure CSS entry is correct and imported.
|
|
15
|
+
- Ensure content scanning/build plugin is correct for the version.
|
|
16
|
+
- Add dark mode + tokens without breaking accessibility.
|
|
17
|
+
|
|
18
|
+
## Contents
|
|
19
|
+
|
|
20
|
+
- `SKILL.md` — required workflow + minimal correct setups
|
|
21
|
+
- `reference.md` — deeper checklist and migration notes
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwindcss
|
|
3
|
+
description: >-
|
|
4
|
+
Implement Tailwind CSS in an app without guessing version, config, or build
|
|
5
|
+
wiring. Use when adding Tailwind, fixing "classes not applying", setting up
|
|
6
|
+
dark mode, tokens/themes, setting up Tailwind v3 or v4, or migrating a
|
|
7
|
+
project from Tailwind v3 to v4.
|
|
8
|
+
argument-hint: "[project-or-component]"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Tailwind CSS
|
|
12
|
+
|
|
13
|
+
Use this skill when implementing Tailwind CSS (v3 or v4) or debugging why Tailwind utilities are not applying.
|
|
14
|
+
|
|
15
|
+
## Non-negotiable first step: detect Tailwind major version
|
|
16
|
+
|
|
17
|
+
1. Read `package.json`.
|
|
18
|
+
2. Determine Tailwind major version from the installed dependency:
|
|
19
|
+
- Tailwind v4 rules are not the same as v3.
|
|
20
|
+
3. Apply the matching setup below.
|
|
21
|
+
|
|
22
|
+
If Tailwind is not installed yet, decide up front:
|
|
23
|
+
|
|
24
|
+
- New project that can follow modern guidance: prefer **Tailwind v4**.
|
|
25
|
+
- Existing project already on Tailwind v3: stay on v3 unless explicitly migrating.
|
|
26
|
+
- If the user asks for v3 specifically: install v3.
|
|
27
|
+
|
|
28
|
+
## Quick diagnosis (when styles are not applying)
|
|
29
|
+
|
|
30
|
+
Before changing anything:
|
|
31
|
+
|
|
32
|
+
1. Confirm Tailwind is installed (and the version).
|
|
33
|
+
2. Find the CSS entry file that should include Tailwind.
|
|
34
|
+
3. Confirm that CSS entry is imported by the app entrypoint.
|
|
35
|
+
4. Confirm content scanning includes your source files (v3 config) or you are using v4 correctly.
|
|
36
|
+
5. Add a visible test element and verify it renders with Tailwind classes.
|
|
37
|
+
|
|
38
|
+
Example test:
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<div class="m-4 rounded-md bg-blue-600 px-3 py-2 text-white">Tailwind OK</div>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Setup selection (pick one)
|
|
45
|
+
|
|
46
|
+
- Tailwind v4 + Vite plugin (`@tailwindcss/vite`) is the clean default for Vite apps.
|
|
47
|
+
- Tailwind v3 often uses PostCSS (`tailwindcss` + `autoprefixer`) and a `tailwind.config.*` file with `content` globs.
|
|
48
|
+
|
|
49
|
+
## Tailwind v4 setup rules
|
|
50
|
+
|
|
51
|
+
- CSS entry must include:
|
|
52
|
+
|
|
53
|
+
```css
|
|
54
|
+
@import "tailwindcss";
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- Do not use `@tailwind base/components/utilities` (those are v3 only).
|
|
58
|
+
- PostCSS plugin is `@tailwindcss/postcss` when using PostCSS.
|
|
59
|
+
|
|
60
|
+
### Vite (v4)
|
|
61
|
+
|
|
62
|
+
Install:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -D tailwindcss @tailwindcss/vite
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Vite config:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { defineConfig } from "vite";
|
|
72
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
73
|
+
|
|
74
|
+
export default defineConfig({
|
|
75
|
+
plugins: [tailwindcss()],
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
CSS entry:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@import "tailwindcss";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Tailwind v3 setup rules
|
|
86
|
+
|
|
87
|
+
- CSS entry must include:
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
@tailwind base;
|
|
91
|
+
@tailwind components;
|
|
92
|
+
@tailwind utilities;
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- `tailwind.config.js` (or `.ts`) must exist and include correct `content` globs.
|
|
96
|
+
- PostCSS uses `tailwindcss` + `autoprefixer`.
|
|
97
|
+
|
|
98
|
+
Install (v3):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install -D tailwindcss postcss autoprefixer
|
|
102
|
+
npx tailwindcss init -p
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`tailwind.config.js` example:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
module.exports = {
|
|
109
|
+
content: ["./src/**/*.{js,jsx,ts,tsx}", "./index.html"],
|
|
110
|
+
theme: { extend: {} },
|
|
111
|
+
plugins: [],
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Migrate v3 -> v4 (safe workflow)
|
|
116
|
+
|
|
117
|
+
Do not “half migrate”. Pick one commit where Tailwind is definitely v4 and definitely wired correctly.
|
|
118
|
+
|
|
119
|
+
1. Confirm current v3 setup works (baseline).
|
|
120
|
+
2. Upgrade deps to v4 (and whichever integration you are using).
|
|
121
|
+
3. Replace CSS entry directives:
|
|
122
|
+
|
|
123
|
+
From v3:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
@tailwind base;
|
|
127
|
+
@tailwind components;
|
|
128
|
+
@tailwind utilities;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
To v4:
|
|
132
|
+
|
|
133
|
+
```css
|
|
134
|
+
@import "tailwindcss";
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
4. Update the build integration:
|
|
138
|
+
- For Vite: add `@tailwindcss/vite` plugin (recommended path for v4 + Vite).
|
|
139
|
+
- For PostCSS: switch to `@tailwindcss/postcss` (only if the project uses PostCSS).
|
|
140
|
+
5. Validate `content`/scanning assumptions:
|
|
141
|
+
- If you are still relying on v3-style `tailwind.config.*` `content` globs, keep them correct during the migration.
|
|
142
|
+
6. Add a visible test element and confirm Tailwind applies again.
|
|
143
|
+
7. Run typecheck/build/tests and fix class-name changes or plugin differences as needed.
|
|
144
|
+
|
|
145
|
+
If the user says “migrate v4 -> v3”, treat it as a downgrade: do the inverse steps and expect more friction.
|
|
146
|
+
|
|
147
|
+
## Dark mode
|
|
148
|
+
|
|
149
|
+
Decide which mode the project wants:
|
|
150
|
+
|
|
151
|
+
- `media` (system-driven): use `dark:` classes, no toggle required.
|
|
152
|
+
- `class` (manual toggle): add/remove `dark` class on `document.documentElement`.
|
|
153
|
+
|
|
154
|
+
When adding a toggle, persist preference in `localStorage`, and respect system preference on first load.
|
|
155
|
+
|
|
156
|
+
## Tokens and theming
|
|
157
|
+
|
|
158
|
+
Prefer built-in tokens over arbitrary values. Use opacity suffixes like `bg-black/10` instead of custom alpha literals.
|
|
159
|
+
|
|
160
|
+
If v4: prefer `@theme` in CSS for tokens.
|
|
161
|
+
|
|
162
|
+
If v3: prefer `theme.extend` in `tailwind.config.*` or CSS variables referenced by utilities.
|
|
163
|
+
|
|
164
|
+
## Common gotchas (don’t let the agent hallucinate)
|
|
165
|
+
|
|
166
|
+
- If Tailwind is installed but nothing works, it is almost always:
|
|
167
|
+
- The CSS entry file is not imported.
|
|
168
|
+
- The content scan does not include the files where classes are used (v3).
|
|
169
|
+
- You used v3 directives in v4 or v4 import in v3.
|
|
170
|
+
- You used dynamic class strings that Tailwind can’t statically detect.
|
|
171
|
+
|
|
172
|
+
Bad (won’t be detected reliably):
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<div className={`text-${color}-500`} />
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Good (explicit options):
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
<div className={color === "blue" ? "text-blue-500" : "text-red-500"} />
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Accessibility defaults
|
|
185
|
+
|
|
186
|
+
- Always include visible focus styles (`focus-visible:` ring/outline).
|
|
187
|
+
- Do not remove focus outlines unless you replace them with a better visible treatment.
|
|
188
|
+
- Ensure color contrast in dark mode, not just light mode.
|
|
189
|
+
|
|
190
|
+
## References
|
|
191
|
+
|
|
192
|
+
- Tailwind v3 installation: https://v3.tailwindcss.com/docs/installation
|
|
193
|
+
- Tailwind v4 + Vite installation: https://tailwindcss.com/docs/installation/using-vite
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@its-thepoe/tailwindcss",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Agent Skill: implement Tailwind CSS (v3/v4), debug setup issues, and apply consistent utility-first patterns.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"agent-skills",
|
|
8
|
+
"tailwindcss",
|
|
9
|
+
"tailwind",
|
|
10
|
+
"css",
|
|
11
|
+
"frontend",
|
|
12
|
+
"design-system"
|
|
13
|
+
],
|
|
14
|
+
"files": ["README.md", "SKILL.md", "reference.md", "package.json"],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./SKILL.md",
|
|
17
|
+
"./SKILL.md": "./SKILL.md",
|
|
18
|
+
"./reference": "./reference.md",
|
|
19
|
+
"./reference.md": "./reference.md"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/reference.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Tailwind CSS Reference
|
|
2
|
+
|
|
3
|
+
Use this when setup is non-standard or the project is mid-migration.
|
|
4
|
+
|
|
5
|
+
## Preflight checklist
|
|
6
|
+
|
|
7
|
+
- Identify framework (Next.js, Vite, Remix, Astro, CRA, etc.).
|
|
8
|
+
- Identify Tailwind major version (v3 vs v4).
|
|
9
|
+
- Identify CSS entry file and confirm it is imported.
|
|
10
|
+
- Identify build pipeline (Vite plugin vs PostCSS).
|
|
11
|
+
- Confirm content scanning covers files that contain class strings.
|
|
12
|
+
|
|
13
|
+
## Setup recipes (minimal)
|
|
14
|
+
|
|
15
|
+
### V4 + Vite
|
|
16
|
+
|
|
17
|
+
- Install: `tailwindcss` + `@tailwindcss/vite`
|
|
18
|
+
- Vite plugin enabled in `vite.config.*`
|
|
19
|
+
- CSS entry uses `@import "tailwindcss";`
|
|
20
|
+
|
|
21
|
+
### V3 + PostCSS
|
|
22
|
+
|
|
23
|
+
- Install: `tailwindcss` + `postcss` + `autoprefixer`
|
|
24
|
+
- `postcss.config.*` includes `tailwindcss` and `autoprefixer`
|
|
25
|
+
- `tailwind.config.*` exists with correct `content` globs
|
|
26
|
+
- CSS entry uses `@tailwind base/components/utilities`
|
|
27
|
+
|
|
28
|
+
## Migration notes (v3 -> v4)
|
|
29
|
+
|
|
30
|
+
- Replace v3 directives with `@import "tailwindcss";`.
|
|
31
|
+
- Replace PostCSS plugin config (`tailwindcss`) with `@tailwindcss/postcss` only if using PostCSS.
|
|
32
|
+
- Delete/adjust obsolete `tailwind.config.*` patterns when the project adopts v4 conventions.
|
|
33
|
+
|
|
34
|
+
## Migration checklist (v3 -> v4)
|
|
35
|
+
|
|
36
|
+
1. Snapshot the v3 baseline:
|
|
37
|
+
- Identify current CSS entry file and verify classes apply.
|
|
38
|
+
- Note current `tailwind.config.*`, PostCSS config, and integration points.
|
|
39
|
+
2. Upgrade dependencies (Tailwind v4 + integration).
|
|
40
|
+
3. Update CSS entry to v4 import.
|
|
41
|
+
4. Update build integration (Vite plugin or PostCSS plugin).
|
|
42
|
+
5. Keep `content` scanning accurate during migration (avoid “classes missing” false alarms).
|
|
43
|
+
6. Add a visible Tailwind test element and verify on a real page.
|
|
44
|
+
7. Fix plugin differences and any deprecated class usage surfaced by lint/build.
|
|
45
|
+
8. Re-run build/tests and confirm production build is correct.
|
|
46
|
+
|
|
47
|
+
## Troubleshooting checklist
|
|
48
|
+
|
|
49
|
+
- Is the CSS file with Tailwind imported?
|
|
50
|
+
- Are class names present as string literals in the built source?
|
|
51
|
+
- Does the framework use a non-standard source folder that content scanning missed (v3)?
|
|
52
|
+
- Are you using `class` vs `className` correctly for the framework?
|
|
53
|
+
- Are you fighting CSS specificity from an existing component library?
|
|
54
|
+
|
|
55
|
+
## Recommended UX defaults
|
|
56
|
+
|
|
57
|
+
- Buttons: `focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2`
|
|
58
|
+
- Inputs: same focus-visible ring + clear invalid states
|
|
59
|
+
- Layout: mobile-first `sm:` `md:` `lg:` with small deltas
|