@skriv/ads 0.1.0 → 0.2.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 CHANGED
@@ -14,7 +14,7 @@ Then ask your agent: **Connect ADS to this project.** The installer creates a pe
14
14
  - ads-record: local walkthrough recording and verified video handoff.
15
15
  - ads-code-review: integrated behavior checks against approved contracts.
16
16
  - ads-figma-to-code and ads-code-to-figma: design handoff in either direction.
17
- - Optional heroui-react: detected for HeroUI v3 app manifests or enabled with --with-heroui. Includes its Apache-2.0 license.
17
+ - Optional HeroUI group: heroui-react for building interfaces and heroui-theming for global restyling and named light/dark themes. Detected for HeroUI v3 app manifests or enabled with --with-heroui. Both skills include their Apache-2.0 licenses; theming includes read-only scripts that inspect the installed @heroui/styles.
18
18
  - Project profile, behavior-contract and review-report templates.
19
19
  - Versioned installation metadata and file hashes, diagnostics and video validation.
20
20
 
@@ -29,12 +29,14 @@ npx @skriv/ads@latest doctor
29
29
  npx @skriv/ads@latest video-check ./walkthrough.mp4
30
30
  ```
31
31
 
32
- All commands support --json. Init and update support --dry-run. Run from the project root or pass its directory. HeroUI detection scans app manifests up to four directory levels, excluding build, dependency and hidden directories. Use --with-heroui when a v3 version comes from a workspace catalog or alias.
32
+ All commands support --json. Init and update support --dry-run. Run from the project root or pass its directory. HeroUI detection scans app manifests up to four directory levels, excluding build, dependency and hidden directories. Use --with-heroui when a v3 version comes from a workspace catalog or alias. Updating a 0.1.x installation that already selected heroui-react also installs heroui-theming, even if detection no longer finds its app manifest.
33
33
 
34
34
  ## Project files and updates
35
35
 
36
36
  Skills go into .agents/skills/. AGENTS.md gets a marked ADS block alongside existing instructions. A new profile goes to docs/ads/project.md; a pre-existing profile is preserved. Contract and report templates go into docs/ads/templates/. .ads/install.json records the installed version and hashes. Commit these files to share ADS with the team.
37
37
 
38
+ HeroUI installations also get docs/ads/templates/theming.md. The agent records approved token-definition files, exact selectors and theme names in the project profile, adapting the project's own token gate as needed. Raw values in upstream component examples still need approved tokens under ADS. The package supplies guidance; the reference lab's checker and its dependency set remain repository tools. Changing the theme still requires verifying states, both modes, focus and reduced motion.
39
+
38
40
  Updates replace unchanged managed files. They preserve the project profile and instructions outside the marked block. If a managed file or routing block has local edits, the entire update stops before writing; compare it with the new bundle and reconcile before retrying. There is no force overwrite. An identical existing file can be adopted on init; a differing untracked skill requires reconciliation. Existing legacy ads-review installations need manual reconciliation with ads-code-review.
39
41
 
40
42
  The CLI does not run application scripts or install recording dependencies during init. Agent requests use the project's existing runner and browser setup. For recording, doctor checks FFmpeg, ffprobe, agent-browser and project Playwright availability; the agent verifies the actual browser session. Missing optional tools are warnings. Missing or modified managed files are errors. A pending profile is a warning requiring discovery before recording or review. Figma access is checked by the agent in its connected Figma tool.
@@ -43,4 +45,4 @@ Install FFmpeg/ffprobe with your OS package manager when recording is needed. Us
43
45
 
44
46
  ## Maintainers
45
47
 
46
- Source and release instructions: [skriv/ADS](https://github.com/skriv/ADS/tree/main/packages/ads). The package is UNLICENSED; the bundled HeroUI skill retains its own Apache-2.0 license.
48
+ Source and release instructions: [skriv/ADS](https://github.com/skriv/ADS/tree/main/packages/ads). The package is UNLICENSED; both bundled HeroUI skills retain their own Apache-2.0 licenses.
package/bin/ads.mjs CHANGED
@@ -16,7 +16,7 @@ const help = `ADS — Agentic Design System
16
16
  Init installs all five ADS skills and creates a pending project profile.
17
17
  Then ask your agent: "Connect ADS to this project".
18
18
  Update preserves the profile, team instructions and locally edited files.
19
- HeroUI v3 is detected in app manifests, or selected with --with-heroui.
19
+ HeroUI v3 adds heroui-react and heroui-theming; or select with --with-heroui.
20
20
  Node.js 22+ is required. No global install is needed.
21
21
  `;
22
22
  let json = false;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@skriv/ads",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "skills": [
6
6
  "ads-init",
7
7
  "ads-record",
@@ -10,11 +10,18 @@
10
10
  "ads-code-to-figma"
11
11
  ],
12
12
  "optionalSkills": [
13
- "heroui-react"
13
+ "heroui-react",
14
+ "heroui-theming"
14
15
  ],
16
+ "skillGroups": {
17
+ "heroui": [
18
+ "heroui-react",
19
+ "heroui-theming"
20
+ ]
21
+ },
15
22
  "files": {
16
- "skills/ads-init/SKILL.md": "514ba45840b2ac9d88b7d3e1d8cc6c2df2c6cd9209c2ba31d6085c807f5bccf5",
17
- "skills/ads-init/profile.md": "8c952570581b3a56954a01f96c80d1937b67ecb1e44d49563d4bb25f48dab00e",
23
+ "skills/ads-init/SKILL.md": "6566901437578a1ffb6b223de9191732f5f8210caae0bd8c8c35db697f6ad715",
24
+ "skills/ads-init/profile.md": "9fc63284dd75cef57eee30fac0fdc04cde5752d2d9559159cca909aefe0d2dc5",
18
25
  "skills/ads-init/scripts/connect.py": "c3ed51f64d4cbeddf1981e7da35a4d61a2121d3df5df28bce7870e67ebcab5bb",
19
26
  "skills/ads-record/SKILL.md": "e8e568d4f0c179c8b998b4cb5df01f5ce42598704e4bb9a6f5f16b7fa9274a19",
20
27
  "skills/ads-code-review/SKILL.md": "5f0091bef3f305a7c1233ea3c2739c3105f36ba0c9106c915fc2803f3a979844",
@@ -28,9 +35,19 @@
28
35
  "skills/heroui-react/scripts/get_styles.mjs": "49026d791b24194f9591746e745e2ea151230868add46ccdaba0eacb0763f589",
29
36
  "skills/heroui-react/scripts/get_theme.mjs": "29bf627208839ec297d546273fdd712702635784505f26c3e537f4e4d32486b5",
30
37
  "skills/heroui-react/scripts/get_docs.mjs": "c5b746cd1f8da6066822623876a55537163c80fefcf4d441ed55ed9df8518ac2",
38
+ "skills/heroui-theming/SKILL.md": "e90477808ff2f45cb3015b61c5a9421b6fe86b24abea5c2f325007fcd7e053cd",
39
+ "skills/heroui-theming/LICENSE.txt": "bd087c1ebd511adbab74705ec2b31d63d175e8d422f58c1af54754da02b1d329",
40
+ "skills/heroui-theming/references/tokens.md": "cb82d01020a9a28bf69241a468fb9feadbf36f5a7312a0b76238dfb0e06ad109",
41
+ "skills/heroui-theming/references/components.md": "0bbf38836337bde4eb3d2bf980c4971a4a8f398fe9e57a0f4a9c486f3802fe31",
42
+ "skills/heroui-theming/references/theme-recipe.md": "a7fb4bebb59e28b535fa4e62d62c028fd3763c9bf1ca8326052dc0c937da4908",
43
+ "skills/heroui-theming/references/any-framework.md": "1a002a5992effd7537c1a5f1b661a4f676f26f4f3f6e44e6a6cef8f325fbc99f",
44
+ "skills/heroui-theming/scripts/_styles_dir.mjs": "25961da4ab8d7dc0c1d2ffaf97a265e8dd77205d29f802fe00e8b941b2f18622",
45
+ "skills/heroui-theming/scripts/list_tokens.mjs": "3c772fdc29fcc58908f6376a6b0bb572d1611ea4ae6dacaa7113a337c0bf9ad8",
46
+ "skills/heroui-theming/scripts/list_component_classes.mjs": "8f18cc14101abf0c1d4fb2ec358d19fe6d2616c56f2fa1fbd08986be91f62547",
31
47
  "templates/project.md": "14d3937647515196adafce56307ceeaa10330df5115c0bf54ae7a46cd92535c4",
32
48
  "templates/flow.md": "5f521209a0735eb469b63d7701bb109b9c272bc1296f13a9142c65b1fe7c8905",
33
49
  "templates/review.md": "16d4a00b3fae55237855ca8d1bfb5dc977a29ee76ee592bfbe77d139fc4033c7",
34
- "templates/routing.md": "fff52bc98e1b1a545f3dd7d8aa42a1ef6520e99e12df21203f7a3b549ce2fcbc"
50
+ "templates/routing.md": "68c212fbd611fa2c8c4d18a15229d73ce783ff726eecab1244759a9aaed1b948",
51
+ "templates/theming.md": "b644cfc9e43a909909e92312ed666eb0ebf7685503b20cf6cf9846d2430dbeda"
35
52
  }
36
53
  }
@@ -7,6 +7,8 @@ Work in the user's target repository. Resolve this skill's real directory (it ma
7
7
 
8
8
  If installed through @skriv/ads, .ads/install.json records the bundle version and managed files. A profile marked `ads-profile: pending` is a starter, not discovered settings. Complete discovery below and remove that marker only after writing verified settings. The npm CLI installs files; the agent performs project discovery. Use `npx @skriv/ads@latest update` for bundle upgrades, preserving project edits and reconciling conflicts. Use `npx @skriv/ads@latest doctor` for environment diagnostics.
9
9
 
10
+ For HeroUI projects the package installs heroui-react and heroui-theming together. Inspect tokens and component classes from the app's installed @heroui/styles using the theming skill's read-only scripts. Record approved definition files, exact theme selectors and active theme names in the profile. Preserve the project's token gate; raw values in theming examples still require approved definitions under ADS. Use docs/ads/templates/theming.md when available. A new theme or token requires the designer's decision before changing the approved sources.
11
+
10
12
  1. Identify the repository root, existing agent instructions, app/workspace roots, manifests, lockfiles, package scripts, framework routes, component and service directories, test configurations, docs, and ignore rules. Inspect the actual files behind likely commands. Include all relevant apps, with distinct working directories, in a monorepo. Use existing UI libraries and product conventions. Identify the approved token sources and how the build rejects hardcoded visual values. Record the command or gap in the profile. Preserve the token rule in the target agent instructions when connecting or refreshing ADS. Record the installed UI library, locked version, shipped component catalog, project catalog, standalone example routes and test commands. In HeroUI projects consult the local heroui-react skill and installed exports. Adoption of a different UI stack is a separate design decision.
11
13
  2. Discover the contract convention, flow routes and where business acceptance can be verified. Prefer existing contract locations. Otherwise adopt docs/ads/flows/<slug>.md for future English contracts. Find existing walkthrough tools, browser specs, isolated data and service setup. Choose a local Git-ignored recording location (add a narrow ignore entry if needed). Record missing capabilities explicitly. Commands and paths must be grounded in the target project. For secrets record only the environment variable name.
12
14
  3. Read the profile outline in profile.md beside this skill. Create docs/ads/project.md in English with concrete values and repository-relative paths, including command working directories. Distinguish verified facts, conventions selected for new artifacts, and unresolved settings. On repeat runs update changed facts and preserve team decisions and unrelated content. Do not invent acceptance criteria from implementation or copy the sample feedback app. Validate paths and run an appropriate available local smoke check. State exactly what was tested.
@@ -6,6 +6,6 @@ Keep this a human-readable settings file at docs/ads/project.md. Paths are relat
6
6
  - **Run locally** — installation, start and test commands, their working directories, local origin discovery, environment requirements, test accounts or fixtures (names only).
7
7
  - **Flow mapping** — component/route directories, contract convention, shared dependencies, and known flow mappings. For each known flow record the source, contract, app URL path, relevant service and available checks. Update this list as flows are added.
8
8
  - **Recording** — existing recorder command or browser automation method, output path, playback method, controlled responses and fixtures if available.
9
- - **Design tokens** — canonical theme sources, token check, build integration and unresolved mappings.
9
+ - **Design tokens** — approved definition files and selectors, theme entry import, active light/dark names, token check, build integration and unresolved mappings. For HeroUI, distinguish variables.css definitions from component override files; importing CSS does not approve literals in it.
10
10
  - **Review** — existing test commands, which evidence confirms acceptance, which checks use a controlled boundary, and how to run missing checks in the browser.
11
11
  - **Verification and gaps** — smoke checks actually run and anything that still requires an environment or team decision.
@@ -0,0 +1,199 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. Please also get an approval
185
+ from the project maintainers before using the Apache License.
186
+
187
+ Copyright 2025 NextUI Inc.
188
+
189
+ Licensed under the Apache License, Version 2.0 (the "License");
190
+ you may not use this file except in compliance with the License.
191
+ You may obtain a copy of the License at
192
+
193
+ http://www.apache.org/licenses/LICENSE-2.0
194
+
195
+ Unless required by applicable law or agreed to in writing, software
196
+ distributed under the License is distributed on an "AS IS" BASIS,
197
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
+ See the License for the specific language governing permissions and
199
+ limitations under the License.
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: heroui-theming
3
+ description: "Globally customize HeroUI v3 and author complete custom themes with CSS only. Use when restyling HeroUI components app-wide, changing design tokens (colors, radius, shadows, fields), overriding BEM component classes, adding variants, creating a named light/dark theme, or using @heroui/styles on plain HTML and non-React frameworks. Keywords: HeroUI theme, theming, custom theme, design tokens, CSS variables, oklch, BEM, data-theme, dark mode, @heroui/styles, global styles."
4
+ metadata:
5
+ author: heroui
6
+ version: "1.0.0"
7
+ ---
8
+
9
+ # HeroUI v3 Theming Guide
10
+
11
+ HeroUI's look lives entirely in `@heroui/styles`: plain CSS made of **theme tokens** and **BEM component classes** in cascade layers. `@heroui/react` only adds behavior and puts those class names on the DOM. So everything visual can be changed globally with CSS — no component wrappers, no forks, no JavaScript — and the same CSS works on any framework or plain HTML.
12
+
13
+ Use this skill to customize HeroUI globally or to build a full theme. For building UIs with the components, use the `heroui-react` skill.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ curl -fsSL https://heroui.com/install | bash -s heroui-theming
19
+ ```
20
+
21
+ ## Mental Model
22
+
23
+ ```
24
+ @layer theme, base, components, utilities; ← declared by @heroui/styles
25
+
26
+ theme tokens --accent, --radius, --surface-shadow, --field-border…
27
+ base resets border color, overlay keyframes
28
+ components BEM classes .button, .button--primary, .card__header, .switch__thumb…
29
+ utilities Tailwind bg-accent, rounded-xl, shadow-surface, status-focused…
30
+ ```
31
+
32
+ - **Later layers win** over earlier ones regardless of selector specificity. **Unlayered CSS beats every layer.**
33
+ - One chain connects everything: token `--accent` → Tailwind mapping `--color-accent: var(--accent)` → utility `bg-accent` → component `.button--primary { --button-bg: var(--accent) }`. Change the token and the whole chain follows.
34
+ - Colors without a suffix are backgrounds; `-foreground` is the text placed on them. They change as a pair.
35
+ - Default light tokens apply on `:root`, `.light`, `[data-theme="light"]`; dark on `.dark`, `[data-theme="dark"]`.
36
+
37
+ ## Always Inspect the Installed Version First
38
+
39
+ Never invent a token, class, or selector. Read them from the project's own `node_modules` (no network needed):
40
+
41
+ ```bash
42
+ node scripts/list_tokens.mjs # tokens: shared, light, dark, Tailwind mapping
43
+ node scripts/list_component_classes.mjs # every component stylesheet
44
+ node scripts/list_component_classes.mjs button switch # blocks, elements, modifiers, states, custom properties, tokens read
45
+ node scripts/list_component_classes.mjs modal --css # plus the raw CSS
46
+ ```
47
+
48
+ `scripts/` is this skill's folder. Run the scripts with the **project root as the working directory** — they resolve `@heroui/styles` from there — or pass `--dir <path-to>/node_modules/@heroui/styles`. The files they read:
49
+
50
+ | What | Path in the installed package |
51
+ | ---------------- | --------------------------------------------------------------- |
52
+ | Token values | `node_modules/@heroui/styles/dist/themes/default/variables.css` |
53
+ | Tailwind mapping | `node_modules/@heroui/styles/dist/themes/shared/theme.css` |
54
+ | Component CSS | `node_modules/@heroui/styles/dist/components/<name>.css` |
55
+
56
+ Read only. **Never edit `node_modules`.**
57
+
58
+ ## Decision Ladder
59
+
60
+ Use the lowest rung that solves the request. Each rung up costs more to maintain.
61
+
62
+ | # | The request sounds like | Use | Reference |
63
+ | --- | -------------------------------------------------------------------------- | ----------------------------------- | --------------------------------------------- |
64
+ | 1 | "Change the brand color / make everything rounder / flatter" | Theme tokens | [tokens.md](references/tokens.md) |
65
+ | 2 | "Primary buttons should be black" (one component's colors) | That component's custom properties | [components.md](references/components.md) |
66
+ | 3 | "All buttons uppercase / cards get a border" (shape, type, layout, states) | BEM override in `@layer components` | [components.md](references/components.md) |
67
+ | 4 | "Add a gradient button next to the existing ones" | New modifier class | [components.md](references/components.md) |
68
+ | 5 | "Create a theme called X" / a full visual identity with light + dark | Named theme folder | [theme-recipe.md](references/theme-recipe.md) |
69
+ | 6 | "Use preset X but in our colors" (a theme someone else wrote) | Brand palette layered over it | [theme-recipe.md](references/theme-recipe.md#restyling-a-theme-you-didnt-write) |
70
+
71
+ A one-off tweak on a single element is not theming: use `className` utilities there.
72
+
73
+ All snippets below go in the app's main CSS file, **after** the HeroUI import:
74
+
75
+ ```css
76
+ @import "tailwindcss";
77
+ @import "@heroui/styles";
78
+ /* customizations here */
79
+ ```
80
+
81
+ ### 1. Theme tokens
82
+
83
+ ```css
84
+ @layer theme {
85
+ /* Same in both modes */
86
+ :root {
87
+ --accent: oklch(0.55 0.2 300);
88
+ --accent-foreground: var(--snow);
89
+ --radius: 0.375rem;
90
+ }
91
+
92
+ /* Mode-specific tokens need BOTH blocks, light first */
93
+ :root,
94
+ .light,
95
+ [data-theme="light"] {
96
+ --background: oklch(0.98 0.01 300);
97
+ }
98
+
99
+ .dark,
100
+ [data-theme="dark"] {
101
+ --background: oklch(0.16 0.02 300);
102
+ }
103
+ }
104
+ ```
105
+
106
+ A token set only on `:root` also applies in dark mode, because your rule outranks the default dark block. That is right for `--accent` or `--radius`, and wrong for `--background`, `--surface`, `--foreground`, shadows: give those a dark value too.
107
+
108
+ Hover, soft, and border-level colors (`--accent-hover`, `--accent-soft`, `--field-hover`…) are calculated from the base tokens. Do not set them unless the result needs tuning.
109
+
110
+ ### 2. Component custom properties
111
+
112
+ Many components paint from their own properties (`--button-bg`, `--chip-bg`, `--switch-control-bg-checked`…). They are declared **on the component class**, so set them there, not on `:root`:
113
+
114
+ ```css
115
+ @layer components {
116
+ .button--primary {
117
+ --button-bg: var(--foreground);
118
+ --button-bg-hover: color-mix(in oklab, var(--foreground) 88%, var(--background));
119
+ --button-bg-pressed: color-mix(in oklab, var(--foreground) 80%, var(--background));
120
+ --button-fg: var(--background);
121
+ }
122
+ }
123
+ ```
124
+
125
+ Hover, pressed, focus, and disabled keep working because the base rules still do the painting.
126
+
127
+ ### 3. BEM overrides
128
+
129
+ ```css
130
+ @layer components {
131
+ .button {
132
+ @apply font-semibold tracking-wide uppercase;
133
+ }
134
+
135
+ .card {
136
+ @apply border border-border;
137
+ }
138
+
139
+ /* `.card` now sets a border: re-assert the modifier it would clobber */
140
+ .card--transparent {
141
+ @apply border-none;
142
+ }
143
+
144
+ /* States: the pseudo-class AND the data attribute, as in the base file */
145
+ .button:active,
146
+ .button[data-pressed="true"] {
147
+ transform: scale(0.95);
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### 4. New modifiers
153
+
154
+ Add a class in `@layer components` that assigns the component's custom properties (all of them), e.g. `.button--brand { --button-bg: var(--success); --button-bg-hover: var(--success-hover); --button-bg-pressed: var(--success-hover); --button-fg: var(--success-foreground); }`. Use it with `<Button className="button--brand">` or `<button class="button button--brand">`.
155
+
156
+ ### 5. A named theme
157
+
158
+ A theme is a folder with one fixed structure, imported after HeroUI and activated on `<html>`:
159
+
160
+ ```
161
+ src/themes/<name>/
162
+ ├── index.css
163
+ ├── variables.css
164
+ └── components/
165
+ ├── index.css
166
+ └── <component>.css # one file per overridden component
167
+ ```
168
+
169
+ ```css
170
+ /* ── themes/<name>/index.css ── */
171
+ @import "./variables.css" layer(theme);
172
+ @import "./components/index.css" layer(components);
173
+
174
+ /* ── themes/<name>/variables.css: the full palette in BOTH blocks ── */
175
+ .<name>-light,
176
+ [data-theme="<name>-light"] {
177
+ color-scheme: light;
178
+ /* --background, --foreground, --surface*, --overlay, --default, --accent, status colors,
179
+ --field-*, --border, --separator, --focus, --radius, shadows, your own --<name>-* tokens */
180
+ }
181
+
182
+ .<name>-dark,
183
+ [data-theme="<name>-dark"] {
184
+ color-scheme: dark;
185
+ /* the same tokens, dark values */
186
+ }
187
+
188
+ /* ── themes/<name>/components/index.css ── */
189
+ @import "./button.css";
190
+ @import "./card.css";
191
+
192
+ /* ── app/globals.css ── */
193
+ @import "tailwindcss";
194
+ @import "@heroui/styles";
195
+ @import "../themes/<name>/index.css";
196
+ ```
197
+
198
+ ```html
199
+ <html data-theme="<name>-light">
200
+ <body class="bg-background text-foreground"></body>
201
+ </html>
202
+ ```
203
+
204
+ Switch to dark with `data-theme="<name>-dark"` (a class of the same name also works). **Read [theme-recipe.md](references/theme-recipe.md) before writing a theme**: it has the step-by-step process and a complete worked example with light + dark variables and five component files.
205
+
206
+ A theme with a tactile look (raised, pressed, outlined) applies that **material** to every "on" state, not only buttons: switch, checkbox, radio, toggle button, tab indicator, slider, progress and meter fills, selected calendar days. The recipe's [Material](references/theme-recipe.md#material-one-look-for-every-on-state) section lists each selector and the pseudo-elements already in use.
207
+
208
+ ### 6. Restyle a theme you didn't write
209
+
210
+ Keep the preset's material and swap its palette: import the preset, then your `brand.css` with `layer(theme)`, keyed on the **preset's** selectors. Point every token the preset tints at your palette (`--overlay: var(--surface)`, `--field-border: var(--border)`) instead of copying its component CSS. Steps: [Restyling a theme you didn't write](references/theme-recipe.md#restyling-a-theme-you-didnt-write).
211
+
212
+ ## Without React
213
+
214
+ `@heroui/styles` works on plain HTML and any framework: load the CSS, put the BEM classes on real elements, set state attributes yourself.
215
+
216
+ ```html
217
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@heroui/styles@3/dist/heroui.min.css" />
218
+
219
+ <button class="button button--primary">Save</button>
220
+ <button class="switch" role="switch" aria-checked="true">
221
+ <span class="switch__content">
222
+ <span class="switch__control"><span class="switch__thumb"></span></span>
223
+ Notifications
224
+ </span>
225
+ </button>
226
+ ```
227
+
228
+ With a Tailwind v4 build, use `@import "tailwindcss"; @import "@heroui/styles";` instead. The prebuilt file has no Tailwind utilities and no `@apply`. Details, a runnable page, selective imports, and variant functions for Vue/Svelte: [any-framework.md](references/any-framework.md).
229
+
230
+ ## Rules
231
+
232
+ 1. **Tokens before overrides.** If a token can express it, do not write component CSS.
233
+ 2. **`oklch()` for colors.** Keep hue steady across a ramp and move lightness.
234
+ 3. **Semantic tokens, not hardcoded colors**, in every component override — a literal color is wrong in the other mode.
235
+ 4. **Keep `-foreground` pairs readable** (WCAG AA, 4.5:1 for text). Check soft variants (`--accent-soft` + `--accent-soft-foreground`) too.
236
+ 5. **Both modes, always.** Any mode-specific token gets a light and a dark value.
237
+ 6. **Style states twice:** pseudo-class + data attribute (`:hover` + `[data-hovered="true"]`, `:active` + `[data-pressed="true"]`, `:focus-visible` + `[data-focus-visible="true"]`, `:disabled` + `[data-disabled="true"]`/`[aria-disabled="true"]`). Copy the selector list from the base file; where it deliberately uses only one form, do the same.
238
+ 7. **Overrides go in `@layer components`**, never unlayered (unlayered CSS would also beat `className` utilities) and never with `!important`.
239
+ 8. **Match the base rule's specificity**, and re-assert modifiers that a block-level override clobbers.
240
+ 9. **Do not break focus rings.** The ring is a `box-shadow`: on focusable components use shadow utilities (`@apply shadow-[…]`) rather than raw `box-shadow`, and never set a shadow token to `none` (use `0 0 0 0 transparent`).
241
+ 10. **Do not remove disabled or reduced-motion handling.** After a custom `transition`, add `@apply motion-reduce:transition-none;`.
242
+ 11. **Apply themes on `<html>`.** Overlays portal to `<body>`, and calculated tokens only recompute on the root element.
243
+ 12. **Complete class names only.** In `@apply`, `className`, and variant maps, write full names (`button--brand`); never build them from strings.
244
+ 13. **Never edit `node_modules`** or copy HeroUI's CSS wholesale; override the smallest part.
245
+ 14. **Remove conflicting leftovers.** An old unlayered `:root { --accent: … }` silently beats a named theme.
246
+ 15. **One material for every "on" state.** If filled buttons are raised, so are the checked switch, the slider fill and the selected day.
247
+ 16. **Text in rem, shape in px** when the app has a text-size setting: set `--radius` and `--spacing` in px so only text scales.
248
+
249
+ ## Verification Checklist
250
+
251
+ Build the CSS first (an unknown utility in `@apply` fails the build). Then, in **light and dark**:
252
+
253
+ - [ ] Canvas and text (`bg-background text-foreground` on `<body>`)
254
+ - [ ] Button: every variant, hover, pressed, keyboard focus ring, disabled
255
+ - [ ] Fields: Input, Select, Checkbox, Radio, Switch — rest, hover, focus, invalid, disabled, placeholder
256
+ - [ ] Surfaces: Card variants, Accordion, Table, Tabs
257
+ - [ ] Overlays: Popover/Dropdown/Select list, Tooltip + arrow, Modal + backdrop, Toast — background, shadow, radius
258
+ - [ ] Soft colors: Chip/Badge/Alert in accent, success, warning, danger
259
+ - [ ] "On" states share the material: primary button, switch, checkbox, radio, toggle button, tab indicator, slider, progress/meter, selected day
260
+ - [ ] Over a preset: no token still carries its tint (overlay, field border, backdrop, scrollbar, charts)
261
+ - [ ] Reduced motion still disables new transitions
262
+ - [ ] If the project has a `DESIGN.md`, update it to the new tokens
263
+
264
+ ## References
265
+
266
+ Load on demand: [tokens.md](references/tokens.md) (every token, default, utility, effect), [components.md](references/components.md) (BEM conventions, states, per-component properties), [theme-recipe.md](references/theme-recipe.md) (full theme process + worked example), [any-framework.md](references/any-framework.md) (plain HTML, Vue, Svelte, CDN, selective imports).
267
+
268
+ Human docs: [Theming](https://heroui.com/docs/react/getting-started/theming.mdx), [Colors](https://heroui.com/docs/react/getting-started/colors.mdx), [Styling](https://heroui.com/docs/react/getting-started/styling.mdx), [Dark Mode](https://heroui.com/docs/react/getting-started/dark-mode.mdx).