@wangs-ui/skills 1.3.0-alpha.10 → 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 +20 -15
  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 +94 -0
  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 +94 -0
  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-BzJg2A5l.js +0 -254
  75. package/skills/react19-compiler-typescript/SKILL.md +0 -388
  76. package/skills/typescript-strict-typing/SKILL.md +0 -317
@@ -0,0 +1,24 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when naming a TypeScript type, variable, or constant."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: TypeScript — Naming Conventions
9
+
10
+ | Kind | Convention | Example |
11
+ | ---------------------------------------------------------- | ------------------------------------------- | ----------------------------------- |
12
+ | Types, interfaces, classes, enums | `PascalCase` | `UserProfile`, `OrderStatus` |
13
+ | Interfaces | `PascalCase`, **no `I` prefix** | `User`, not `IUser` |
14
+ | Type aliases | `PascalCase` | `type ApiResponse<T> = ...` |
15
+ | Variables, functions, methods, properties | `camelCase` | `getUserById`, `isValid` |
16
+ | Booleans | `camelCase` with `is/has/should/can` prefix | `isLoading`, `hasPermission` |
17
+ | True constants (module-level, never reassigned, primitive) | `UPPER_SNAKE_CASE` | `MAX_RETRIES`, `DEFAULT_TIMEOUT_MS` |
18
+ | Enum members | `PascalCase` | `enum Status { Active, Archived }` |
19
+ | Generic type parameters (simple, single-purpose) | Single uppercase letter | `T`, `K`, `V`, `E` for errors |
20
+ | Generic type parameters (multiple / non-obvious) | Descriptive, prefixed with `T` | `TInput`, `TOutput`, `TContext` |
21
+ | Discriminated union tag field | Consistent across the codebase | `kind`, `type`, or `status` |
22
+ | Files with a single exported entity | Match the entity name | `UserProfile.ts`, `useAuth.ts` |
23
+
24
+ Naming should describe **intent**, not implementation — `fetchUser` not `getUserFromApiEndpoint`; `retryCount` not `numRetries2`.
@@ -0,0 +1,44 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when narrowing an `unknown` or union-typed value in TypeScript."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: TypeScript — `unknown` + Narrowing, Not Casting
9
+
10
+ Prefer proving a type through control flow over asserting it with `as`.
11
+
12
+ ## Narrowing techniques, in order of preference:
13
+
14
+ 1. **`typeof`** — primitives (`string`, `number`, `boolean`, `undefined`, `function`)
15
+ 2. **`instanceof`** — class instances, `Error`, `Date`, custom classes
16
+ 3. **`in`** — checking a property exists before accessing it on a union/unknown
17
+ 4. **User-defined type guards** — `function isUser(x: unknown): x is User`
18
+ 5. **Discriminated union tag checks** — `switch (value.kind) { ... }`
19
+ 6. **Exhaustiveness checks** — a `never`-typed default branch so adding a new variant is a compile error until every switch/if-chain handles it
20
+
21
+ ```ts
22
+ // ✅ Type guard
23
+ function isUser(value: unknown): value is User {
24
+ return typeof value === 'object' && value !== null && 'id' in value && 'email' in value;
25
+ }
26
+
27
+ // ✅ Exhaustiveness check
28
+ function assertNever(x: never): never {
29
+ throw new Error(`Unhandled case: ${JSON.stringify(x)}`);
30
+ }
31
+
32
+ function area(shape: Shape): number {
33
+ switch (shape.kind) {
34
+ case 'circle':
35
+ return Math.PI * shape.radius ** 2;
36
+ case 'square':
37
+ return shape.side ** 2;
38
+ default:
39
+ return assertNever(shape); // compile error if a variant is missed
40
+ }
41
+ }
42
+ ```
43
+
44
+ Type assertions (`as X`) and the non-null assertion (`!`) bypass this entirely — treat them as a last resort, not a shortcut.
@@ -0,0 +1,24 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when declaring a TypeScript collection or object shape."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: TypeScript — Readonly by Default
9
+
10
+ Prefer immutable shapes unless mutation is intentional and localized.
11
+
12
+ ```ts
13
+ interface Point {
14
+ readonly x: number;
15
+ readonly y: number;
16
+ }
17
+
18
+ function config(values: readonly string[]) {
19
+ /* ... */
20
+ }
21
+
22
+ const ROLES = ['admin', 'editor', 'viewer'] as const;
23
+ type UserRole = (typeof ROLES)[number];
24
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ trigger: model_decision
3
+ description: "Apply when configuring or reviewing tsconfig.json compiler strictness options."
4
+ owner: wangs-ui
5
+ metadata:
6
+ owner: wangs-ui
7
+ ---
8
+ # Rule: TypeScript — Baseline `tsconfig.json` Strictness
9
+
10
+ Treat these as the non-negotiable floor for any project this rule touches:
11
+
12
+ ```json
13
+ {
14
+ "compilerOptions": {
15
+ "strict": true,
16
+ "noImplicitAny": true,
17
+ "strictNullChecks": true,
18
+ "strictFunctionTypes": true,
19
+ "strictPropertyInitialization": true,
20
+ "noUncheckedIndexedAccess": true,
21
+ "exactOptionalPropertyTypes": true,
22
+ "noImplicitOverride": true,
23
+ "noFallthroughCasesInSwitch": true,
24
+ "noUnusedLocals": true,
25
+ "noUnusedParameters": true,
26
+ "forceConsistentCasingInFileNames": true
27
+ }
28
+ }
29
+ ```
30
+
31
+ `strict: true` alone enables the core group (`noImplicitAny`, `strictNullChecks`, etc.), but `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes` are commonly missed and close real gaps (array/object index access returning `T` instead of `T | undefined`; optional properties silently accepting `undefined` as an explicit value).
@@ -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`.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: responsive-design
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
6
+ ---
7
+ # Skill: Responsive Design (Consumer Guide)
8
+
9
+ Use this skill when building responsive pages, layouts, or screen adaptations with Wangs UI components.
10
+
11
+ ---
12
+
13
+ ## 1. Breakpoint Reference
14
+
15
+ Wangs UI uses three standardized breakpoints:
16
+
17
+ | Breakpoint | Viewport Range | Typical Target |
18
+ | :------------- | :------------- | :------------------------- |
19
+ | **`compact`** | `< 600px` | Mobile phones |
20
+ | **`medium`** | `600–839px` | Tablet portrait |
21
+ | **`expanded`** | `≥ 840px` | Tablet landscape & Desktop |
22
+
23
+ ### Reading the Current Breakpoint in Code
24
+
25
+ ```tsx
26
+ import { useTheme } from '@wangs-ui/foundation/theme';
27
+
28
+ const { breakpoint } = useTheme(); // 'compact' | 'medium' | 'expanded'
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 2. Responsive Props (`ResponsiveValue`)
34
+
35
+ Visual scale props (`size`, layout `gap`, `columns`, `p`, `m`) accept either a single value or an object mapped by breakpoint:
36
+
37
+ ```tsx
38
+ // Static (identical across all devices)
39
+ <Button size="md" />
40
+ <Stack gap={4} />
41
+
42
+ // Adaptive (changes across breakpoints)
43
+ <Button size={{ compact: 'lg', expanded: 'sm' }} />
44
+ <Grid columns={{ compact: 1, medium: 2, expanded: 4 }} />
45
+ ```
46
+
47
+ > **Rule**: Do **NOT** attempt to use responsive objects on event handlers or boolean flags (e.g. `disabled`, `onClick`). Only visual scale props support responsive objects.
48
+
49
+ ---
50
+
51
+ ## 3. Conditional Rendering (`<Show>`)
52
+
53
+ Use `<Show>` when a component should be mounted or unmounted based on the active breakpoint:
54
+
55
+ ```tsx
56
+ import { Show } from '@wangs-ui/foundation/theme';
57
+
58
+ // Render only on tablet & desktop
59
+ <Show above="medium">
60
+ <SidebarNav />
61
+ </Show>
62
+
63
+ // Render only on mobile
64
+ <Show below="medium">
65
+ <MobileNavbar />
66
+ </Show>
67
+
68
+ // Swap component with a fallback
69
+ <Show at="compact" fallback={<DesktopTable />}>
70
+ <MobileCardList />
71
+ </Show>
72
+ ```
73
+
74
+ ### When to use `<Show>` vs CSS `hidden`:
75
+
76
+ - **Use `<Show>`**: If the hidden component has expensive network fetches, subscriptions, or animations (unmounts completely).
77
+ - **Use CSS Tailwind (`hidden md:block`)**: If it's just a visual styling toggle with no side effects.
78
+
79
+ ---
80
+
81
+ ## 4. Spacing Conventions
82
+
83
+ Spacing tokens are **flat and fixed** (1 unit = 4px):
84
+
85
+ - **Web**: Use standard Tailwind numeric classes (`gap-2`, `px-4`, `py-3`). **Never** use legacy named classes like `gap-md` or `px-sm`.
86
+ - **Native**: Use `const { spacing } = useTheme();` (`spacing[4]` = 16px).
87
+
88
+ ---
89
+
90
+ ## 5. Anti-Patterns to Avoid
91
+
92
+ 1. **Avoid `hidden md:block` for stateful/heavy trees**: Always prefer `<Show>` so unused components cleanly unmount.
93
+ 2. **Never pass responsive objects to behavioral props**: `<Button disabled={{ compact: true }} />` is invalid.
94
+ 3. **No manual pixel calculations**: Use Tailwind numeric tokens (`gap-4`, `p-6`) or `ResponsiveValue`.
@@ -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`).