@wangs-ui/skills 1.3.0-alpha.11 → 1.3.0-alpha.12

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.
Files changed (76) hide show
  1. package/README.md +14 -7
  2. package/dist/bin.js +18 -14
  3. package/dist/index.js +2 -2
  4. package/dist/rules/react19-checklist-and-reference.md +37 -0
  5. package/dist/rules/react19-compiler-render-patterns.md +13 -0
  6. package/dist/rules/react19-naming-conventions.md +16 -0
  7. package/dist/rules/react19-no-manual-memoization.md +26 -0
  8. package/dist/rules/react19-primitives-typing.md +85 -0
  9. package/dist/rules/react19-props-typing.md +25 -0
  10. package/dist/rules/react19-purity-and-immutability.md +41 -0
  11. package/dist/rules/react19-tooling-and-opt-out.md +68 -0
  12. package/dist/rules/typescript-assertions-last-resort.md +13 -0
  13. package/dist/rules/typescript-checklist-and-reference.md +34 -0
  14. package/dist/rules/typescript-discriminated-unions.md +40 -0
  15. package/dist/rules/typescript-explicit-return-types.md +22 -0
  16. package/dist/rules/typescript-interface-vs-type.md +40 -0
  17. package/dist/rules/typescript-literal-unions-vs-enums.md +22 -0
  18. package/dist/rules/typescript-naming-conventions.md +24 -0
  19. package/dist/rules/typescript-narrowing-over-casting.md +44 -0
  20. package/dist/rules/typescript-readonly-by-default.md +24 -0
  21. package/dist/rules/typescript-tsconfig-strictness.md +31 -0
  22. package/dist/rules/typescript-zero-any.md +37 -0
  23. package/dist/rules/wangs-ui/default-props-precedence.md +14 -0
  24. package/dist/rules/wangs-ui/forms-destructuring-lock.md +19 -0
  25. package/dist/rules/wangs-ui/no-raw-html.md +29 -0
  26. package/dist/rules/wangs-ui/no-redundant-wrappers.md +56 -0
  27. package/dist/rules/wangs-ui/theme-variable-override-breaks-engine.md +20 -0
  28. package/dist/skills/craft-theme/SKILL.md +2 -1
  29. package/dist/skills/create-form/SKILL.md +2 -1
  30. package/dist/skills/data-table/SKILL.md +2 -1
  31. package/dist/skills/dialog-modal/SKILL.md +2 -1
  32. package/dist/skills/i18n-usage/SKILL.md +2 -1
  33. package/dist/skills/layout-navigation/SKILL.md +2 -1
  34. package/dist/skills/responsive-design/SKILL.md +2 -1
  35. package/dist/skills/universal-layout/SKILL.md +2 -1
  36. package/dist/skills/wangs-ui-components/SKILL.md +2 -1
  37. package/dist/src-DwQOnl9b.js +640 -0
  38. package/package.json +3 -2
  39. package/rules/react19-checklist-and-reference.md +37 -0
  40. package/rules/react19-compiler-render-patterns.md +13 -0
  41. package/rules/react19-naming-conventions.md +16 -0
  42. package/rules/react19-no-manual-memoization.md +26 -0
  43. package/rules/react19-primitives-typing.md +85 -0
  44. package/rules/react19-props-typing.md +25 -0
  45. package/rules/react19-purity-and-immutability.md +41 -0
  46. package/rules/react19-tooling-and-opt-out.md +68 -0
  47. package/rules/typescript-assertions-last-resort.md +13 -0
  48. package/rules/typescript-checklist-and-reference.md +34 -0
  49. package/rules/typescript-discriminated-unions.md +40 -0
  50. package/rules/typescript-explicit-return-types.md +22 -0
  51. package/rules/typescript-interface-vs-type.md +40 -0
  52. package/rules/typescript-literal-unions-vs-enums.md +22 -0
  53. package/rules/typescript-naming-conventions.md +24 -0
  54. package/rules/typescript-narrowing-over-casting.md +44 -0
  55. package/rules/typescript-readonly-by-default.md +24 -0
  56. package/rules/typescript-tsconfig-strictness.md +31 -0
  57. package/rules/typescript-zero-any.md +37 -0
  58. package/rules/wangs-ui/default-props-precedence.md +14 -0
  59. package/rules/wangs-ui/forms-destructuring-lock.md +19 -0
  60. package/rules/wangs-ui/no-raw-html.md +29 -0
  61. package/rules/wangs-ui/no-redundant-wrappers.md +56 -0
  62. package/rules/wangs-ui/theme-variable-override-breaks-engine.md +20 -0
  63. package/skills/craft-theme/SKILL.md +2 -1
  64. package/skills/create-form/SKILL.md +2 -1
  65. package/skills/data-table/SKILL.md +2 -1
  66. package/skills/dialog-modal/SKILL.md +2 -1
  67. package/skills/i18n-usage/SKILL.md +2 -1
  68. package/skills/layout-navigation/SKILL.md +2 -1
  69. package/skills/responsive-design/SKILL.md +2 -1
  70. package/skills/universal-layout/SKILL.md +2 -1
  71. package/skills/wangs-ui-components/SKILL.md +2 -1
  72. package/dist/skills/react19-compiler-typescript/SKILL.md +0 -388
  73. package/dist/skills/typescript-strict-typing/SKILL.md +0 -317
  74. package/dist/src-DF1oWSLf.js +0 -258
  75. package/skills/react19-compiler-typescript/SKILL.md +0 -388
  76. package/skills/typescript-strict-typing/SKILL.md +0 -317
@@ -0,0 +1,37 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when writing or reviewing any TypeScript type annotation."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: TypeScript — Never Use `any`
9
+
10
+ `any` is not "unknown type," it's "type checking off." It's contagious — once a value is `any`, everything it touches becomes unchecked too.
11
+
12
+ - Never write `any` for parameters, return types, variables, or generics.
13
+ - Use `unknown` for genuinely unknown external data (API responses, `JSON.parse`, catch clauses, third-party callbacks) and narrow it before use.
14
+ - Use generics (`<T>`) when a function needs to work across types but preserve the relationship between input and output.
15
+ - If a library ships untyped, write a minimal local type/interface for the surface area you actually use instead of reaching for `any`.
16
+
17
+ ```ts
18
+ // ❌ Bad
19
+ function parseConfig(json: any) {
20
+ return json.settings.theme; // no safety, no autocomplete, silent runtime crash
21
+ }
22
+
23
+ // ✅ Good
24
+ function parseConfig(json: unknown): string {
25
+ if (
26
+ typeof json === 'object' &&
27
+ json !== null &&
28
+ 'settings' in json &&
29
+ typeof (json as { settings: unknown }).settings === 'object'
30
+ ) {
31
+ // still narrow further or validate with a schema library (zod, valibot, etc.)
32
+ }
33
+ throw new Error('Invalid config shape');
34
+ }
35
+ ```
36
+
37
+ The only acceptable `any` is a well-justified, isolated, and commented one (e.g. interfacing with a genuinely untyped legacy module) — never a default.
@@ -0,0 +1,14 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when deciding whether a prop belongs in global defaultProps config or per-instance JSX."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Wangs UI Fact: `configOptions.defaultProps` Precedence
9
+
10
+ `WangsUiProvider.configOptions.defaultProps` lets any project set global
11
+ default prop values per component. Per-instance JSX props always win over
12
+ that global default — the merge order is global-default-then-instance, never
13
+ the reverse. This is a `WangsUiProvider` mechanism, true in any project that
14
+ uses it, independent of what values a given project actually configures.
@@ -0,0 +1,19 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when writing a <Field> render-prop callback in a Wangs UI Form/DialogForm."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Wangs UI Fact: `<Field>` Render-Prop Must Destructure `{ fieldProps, fieldState }`
9
+
10
+ `<Field>`'s callback render prop must destructure as `{({ fieldProps, fieldState })}`.
11
+ Passing a single parameter instead (`{(field) => ...}`) produces `undefined`
12
+ `value`/`onChange` and permanently locks the input — the field never becomes
13
+ interactive, even on initial render. This is a real `@wangs-ui/form` quirk,
14
+ not a project convention; it reproduces the same way in any consumer.
15
+
16
+ `<Field>` is generic — `fieldProps.onChange` is already typed to the field's
17
+ actual value type. Pass it straight through (`fieldProps.onChange`); don't
18
+ wrap it in a defensive `typeof`/`e?.target?.value` extraction, that's fighting
19
+ a type the field already guarantees.
@@ -0,0 +1,29 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when writing JSX markup — enforce Wangs UI primitives over raw HTML elements."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: No Raw HTML Controls
9
+
10
+ Zero raw HTML elements. Use Wangs UI primitives and Foundation theme typography.
11
+
12
+ ## Prohibitions
13
+
14
+ - No `<button>`, `<input>`, `<select>`, `<textarea>`, `<form>`, `<table>`, `<dialog>`.
15
+ - No `<h1>`-`<h6>`, `<p>`, `<span>` for text typography without Wangs UI theme primitives.
16
+
17
+ ## Mandatory Imports
18
+
19
+ - Primitives via subpath:
20
+ - `@wangs-ui/react-core/primitive/button`
21
+ - `@wangs-ui/react-core/primitive/input`
22
+ - `@wangs-ui/react-core/primitive/datatable`
23
+ - `@wangs-ui/react-core/primitive/modal`
24
+ - `@wangs-ui/react-core/primitive/dialogform`
25
+ - `@wangs-ui/react-core/primitive/card`
26
+ - `@wangs-ui/react-core/primitive/badge`
27
+ - Typography via Foundation theme:
28
+ - `@wangs-ui/foundation/theme` (`Text`, `Code`, `Kbd`, `Link`, `Mark`, `Blockquote`, `List`)
29
+ - Use variants: `display*`, `headline*`, `title*`, `body*`, `label*`.
@@ -0,0 +1,56 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when writing or reviewing JSX layout for redundant wrapper containers."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: No Redundant Layout & Container Wrappers
9
+
10
+ > **Severity**: **ARCHITECTURAL CODE SMELL / LINT FAILURE**.
11
+
12
+ Components must not be wrapped in an unnecessary layout element. A `<div>` (or `Box`/`Stack`) wrapping a single component without active layout coordination is strictly prohibited — see `.agents/skills/universal-layout` and `.agents/rules/no-inline-component-styling.md` §2 for which primitive replaces a raw `<div>` when layout coordination is genuinely needed.
13
+
14
+ ---
15
+
16
+ ## 1. Prohibited Anti-Patterns
17
+
18
+ 1. **Single-Child Wrapper `<div>`**:
19
+ Never wrap a single component (e.g. `<DataTable />`, `<Card />`, `<Tabs />`, `<Input />`, `<Button />`) inside an isolated `<div>` that has no layout siblings.
20
+ 2. **Intermediate Tab/Card Wrappers**:
21
+ Do not insert pass-through `<div>` wrappers between `<Card>`/`<Tabs>` and feature content:
22
+ ```tsx
23
+ // ❌ Bad — Redundant intermediate div wrapping a single tab component
24
+ function TabbedPage() {
25
+ return (
26
+ <Card>
27
+ <Tabs ... />
28
+ <div>
29
+ {activeTab === 'general' ? <GeneralTab /> : <AdvancedTab />}
30
+ </div>
31
+ </Card>
32
+ );
33
+ }
34
+
35
+ // ✅ Good — Render active tab directly as Card child
36
+ function TabbedPage() {
37
+ return (
38
+ <Card>
39
+ <Tabs ... />
40
+ {activeTab === 'general' ? <GeneralTab /> : <AdvancedTab />}
41
+ </Card>
42
+ );
43
+ }
44
+ ```
45
+ 3. **Redundant Table Wrappers**:
46
+ Never wrap `<DataTable />` in a `Box`/`div` solely to set width or margin. Wangs UI DataTable manages its own container scroll and dimensions out of the box.
47
+
48
+ ---
49
+
50
+ ## 2. When a Layout Wrapper Is Permitted
51
+
52
+ A layout wrapper is **ONLY** warranted when coordinating **2 or more siblings** in a structural layout — and even then it's a `universal-layout` primitive, not a raw `<div>`:
53
+
54
+ 1. **Alignment bars**: header title + search + action buttons → `<HStack justify="between">`.
55
+ 2. **Multi-column/card grids**: responsive multi-card or multi-field layouts → `<Grid columns={{ compact: 1, medium: 2, expanded: 3 }}>`.
56
+ 3. **Fragment Alternative**: when returning multiple adjacent elements without layout coordination, use React Fragment (`<>...</>`) — not an empty wrapper.
@@ -0,0 +1,20 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when tempted to override a Wangs UI theme CSS variable directly."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Wangs UI Fact: Theme Variables Are Engine-Internal, Never Override Directly
9
+
10
+ Manually defining or overriding `:root`, `[data-mode='dark']`, or `.dark` custom
11
+ properties owned by `@wangs-ui/foundation/theme` (`--color-*`, `--z-index-*`,
12
+ `--spacing-*`, `--size-*`, `--shadow-*`, `--radius-*`) breaks the theme token
13
+ engine: it destroys automatic light/dark mode transitions, corrupts sub-tree
14
+ density overrides made via `<ThemeProvider>`, and causes cross-module visual
15
+ bugs that don't reproduce consistently. This is true for any project consuming
16
+ `@wangs-ui/foundation`, not specific to one app's setup.
17
+
18
+ The supported customization surface is `WangsUiProvider.configOptions.preset`
19
+ — discover it via the `design-system`/`wangs-ui-components` skills' MCP calls,
20
+ never by reading or guessing the CSS variable names.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: craft-theme
3
3
  description: Generate a brand-color theme (13-shade tonal palette + M3-style semantic tokens) for a Wangs UI app via the `wangs-ui-generate-palette` CLI — never hand-write hex shade ramps.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Craft Theme
7
8
 
8
9
  Use this skill whenever the user asks to create, customize, or rebrand the color theme of an app built on `@wangs-ui/react-core` / `@wangs-ui/foundation` — "make the app's theme orange", "use our brand color #ff6b35", "add a new palette called sunset", etc.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: create-form
3
3
  description: Form architecture, validation workflows, strongly-typed forms (useForm, useDialogForm, useWatchField), initialValues/reset lifecycle, and MCP discovery protocol for building forms and input controls with @wangs-ui/react-core.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Form Architecture & Validation Workflows
7
8
 
8
9
  Use this skill when building forms, data entry panels, modal forms, settings pages, or multipart forms in Wangs UI applications.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: data-table
3
3
  description: Architecture, workflows, and MCP discovery protocol for building DataTables with sorting, pagination, filtering, selection, and export.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: DataTable Architecture & Integration Workflows
7
8
 
8
9
  Use this skill when implementing data grids, server-paginated tables, filterable listing views, or batch management interfaces with `@wangs-ui/react-core`.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: dialog-modal
3
3
  description: Patterns, overlay selection criteria, and MCP discovery protocol for Dialog, Modal, and DialogForm components in Wangs UI.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Dialog, Modal & Overlay Workflows
7
8
 
8
9
  Use this skill when building interactive modals, create/edit dialog forms, destructive action confirmations, or slide-in overlay panels.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: i18n-usage
3
3
  description: Comprehensive guidelines for application internationalization, JIT translations (t), ICU formatting, and locale-aware formatting with @wangs-ui/react-i18n.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Application Internationalization & Formatting Protocol
7
8
 
8
9
  Use this skill when implementing multi-language interfaces, translating user-facing text, formatting dates, times, currencies, or numbers in React applications built with Wangs UI and `@wangs-ui/react-i18n`.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: layout-navigation
3
3
  description: Architecture, navigation hierarchies, and MCP discovery protocol for AppLayout, Sidebar, Breadcrumb, and Tabs in Wangs UI.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Application Layout & Navigation Hierarchy
7
8
 
8
9
  Use this skill when constructing application shells, multi-level sidebars, page headers, breadcrumbs, or tabbed views with `@wangs-ui/react-core`.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: responsive-design
3
3
  description: Guidelines for implementing responsive UIs with Wangs UI — covering Breakpoint tiers, responsive props (ResponsiveValue), <Show> conditional rendering, and spacing conventions.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Responsive Design (Consumer Guide)
7
8
 
8
9
  Use this skill when building responsive pages, layouts, or screen adaptations with Wangs UI components.
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: universal-layout
3
3
  description: Universal layout primitives (Box, Flex, Stack, Grid, Container, Section) with ResponsiveValue patterns for Web and React Native in Wangs UI.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Universal Layout Primitives
7
8
 
8
9
  Use this skill when arranging page structure, spacing, or responsive grids with
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  name: wangs-ui-components
3
3
  description: Foundational rules, subpath imports, design tokens, and the MCP Discovery Protocol for building React apps with Wangs UI.
4
+ metadata:
5
+ owner: wangs-ui
4
6
  ---
5
-
6
7
  # Skill: Wangs UI Component Fundamentals & MCP Protocol
7
8
 
8
9
  Use this skill whenever you write or modify UI components using Wangs UI (`@wangs-ui/react-core`, `@wangs-ui/react-icons`, `@wangs-ui/react-presets`, `@wangs-ui/foundation`).