@wangs-ui/skills 1.3.0-alpha.2 → 1.3.0-alpha.20

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 (80) hide show
  1. package/README.md +15 -11
  2. package/dist/bin.js +20 -15
  3. package/dist/index.js +2 -2
  4. package/dist/rules/wangs-ui/default-props-precedence.md +14 -0
  5. package/dist/rules/wangs-ui/forms-destructuring-lock.md +19 -0
  6. package/dist/rules/wangs-ui/no-raw-html.md +29 -0
  7. package/dist/rules/wangs-ui/no-redundant-wrappers.md +56 -0
  8. package/dist/rules/wangs-ui/react19-checklist-and-reference.md +38 -0
  9. package/dist/rules/wangs-ui/react19-compiler-render-patterns.md +13 -0
  10. package/dist/rules/wangs-ui/react19-naming-conventions.md +16 -0
  11. package/dist/rules/wangs-ui/react19-no-manual-memoization.md +28 -0
  12. package/dist/rules/wangs-ui/react19-primitives-typing.md +85 -0
  13. package/dist/rules/wangs-ui/react19-props-typing.md +25 -0
  14. package/dist/rules/wangs-ui/react19-purity-and-immutability.md +41 -0
  15. package/dist/rules/wangs-ui/react19-tooling-and-opt-out.md +78 -0
  16. package/dist/rules/wangs-ui/theme-variable-override-breaks-engine.md +20 -0
  17. package/dist/rules/wangs-ui/typescript-assertions-last-resort.md +13 -0
  18. package/dist/rules/wangs-ui/typescript-checklist-and-reference.md +34 -0
  19. package/dist/rules/wangs-ui/typescript-discriminated-unions.md +40 -0
  20. package/dist/rules/wangs-ui/typescript-explicit-return-types.md +22 -0
  21. package/dist/rules/wangs-ui/typescript-interface-vs-type.md +40 -0
  22. package/dist/rules/wangs-ui/typescript-literal-unions-vs-enums.md +22 -0
  23. package/dist/rules/wangs-ui/typescript-naming-conventions.md +24 -0
  24. package/dist/rules/wangs-ui/typescript-narrowing-over-casting.md +44 -0
  25. package/dist/rules/wangs-ui/typescript-readonly-by-default.md +24 -0
  26. package/dist/rules/wangs-ui/typescript-tsconfig-strictness.md +31 -0
  27. package/dist/rules/wangs-ui/typescript-zero-any.md +37 -0
  28. package/dist/skills/wangs-ui/craft-theme/SKILL.md +63 -0
  29. package/dist/skills/{create-form → wangs-ui/create-form}/SKILL.md +27 -16
  30. package/{skills → dist/skills/wangs-ui}/data-table/SKILL.md +24 -15
  31. package/{skills → dist/skills/wangs-ui}/dialog-modal/SKILL.md +18 -9
  32. package/{skills → dist/skills/wangs-ui}/i18n-usage/SKILL.md +19 -11
  33. package/dist/skills/wangs-ui/layout-navigation/SKILL.md +156 -0
  34. package/dist/skills/wangs-ui/responsive-design/SKILL.md +107 -0
  35. package/dist/skills/wangs-ui/universal-layout/SKILL.md +80 -0
  36. package/dist/skills/wangs-ui/wangs-ui-components/SKILL.md +104 -0
  37. package/dist/src-C0l8elLu.js +663 -0
  38. package/package.json +3 -2
  39. package/rules/wangs-ui/default-props-precedence.md +14 -0
  40. package/rules/wangs-ui/forms-destructuring-lock.md +19 -0
  41. package/rules/wangs-ui/no-raw-html.md +29 -0
  42. package/rules/wangs-ui/no-redundant-wrappers.md +56 -0
  43. package/rules/wangs-ui/react19-checklist-and-reference.md +38 -0
  44. package/rules/wangs-ui/react19-compiler-render-patterns.md +13 -0
  45. package/rules/wangs-ui/react19-naming-conventions.md +16 -0
  46. package/rules/wangs-ui/react19-no-manual-memoization.md +28 -0
  47. package/rules/wangs-ui/react19-primitives-typing.md +85 -0
  48. package/rules/wangs-ui/react19-props-typing.md +25 -0
  49. package/rules/wangs-ui/react19-purity-and-immutability.md +41 -0
  50. package/rules/wangs-ui/react19-tooling-and-opt-out.md +78 -0
  51. package/rules/wangs-ui/theme-variable-override-breaks-engine.md +20 -0
  52. package/rules/wangs-ui/typescript-assertions-last-resort.md +13 -0
  53. package/rules/wangs-ui/typescript-checklist-and-reference.md +34 -0
  54. package/rules/wangs-ui/typescript-discriminated-unions.md +40 -0
  55. package/rules/wangs-ui/typescript-explicit-return-types.md +22 -0
  56. package/rules/wangs-ui/typescript-interface-vs-type.md +40 -0
  57. package/rules/wangs-ui/typescript-literal-unions-vs-enums.md +22 -0
  58. package/rules/wangs-ui/typescript-naming-conventions.md +24 -0
  59. package/rules/wangs-ui/typescript-narrowing-over-casting.md +44 -0
  60. package/rules/wangs-ui/typescript-readonly-by-default.md +24 -0
  61. package/rules/wangs-ui/typescript-tsconfig-strictness.md +31 -0
  62. package/rules/wangs-ui/typescript-zero-any.md +37 -0
  63. package/skills/wangs-ui/craft-theme/SKILL.md +63 -0
  64. package/skills/{create-form → wangs-ui/create-form}/SKILL.md +27 -16
  65. package/{dist/skills → skills/wangs-ui}/data-table/SKILL.md +24 -15
  66. package/{dist/skills → skills/wangs-ui}/dialog-modal/SKILL.md +18 -9
  67. package/{dist/skills → skills/wangs-ui}/i18n-usage/SKILL.md +19 -11
  68. package/skills/wangs-ui/layout-navigation/SKILL.md +156 -0
  69. package/skills/wangs-ui/responsive-design/SKILL.md +107 -0
  70. package/skills/wangs-ui/universal-layout/SKILL.md +80 -0
  71. package/skills/wangs-ui/wangs-ui-components/SKILL.md +104 -0
  72. package/dist/skills/layout-navigation/SKILL.md +0 -62
  73. package/dist/skills/react19-compiler-typescript/SKILL.md +0 -388
  74. package/dist/skills/typescript-strict-typing/SKILL.md +0 -317
  75. package/dist/skills/wangs-ui-components/SKILL.md +0 -108
  76. package/dist/src-DDi-O7tk.js +0 -246
  77. package/skills/layout-navigation/SKILL.md +0 -62
  78. package/skills/react19-compiler-typescript/SKILL.md +0 -388
  79. package/skills/typescript-strict-typing/SKILL.md +0 -317
  80. package/skills/wangs-ui-components/SKILL.md +0 -108
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: layout-navigation
3
+ description: Architecture, navigation hierarchies, and MCP discovery protocol for AppLayout, Sidebar, Breadcrumb, and Tabs in Wangs UI.
4
+ metadata:
5
+ owner: wangs-ui
6
+ ---
7
+
8
+ # Skill: Application Layout & Navigation Hierarchy
9
+
10
+ Use this skill when constructing application shells, multi-level sidebars, page headers, breadcrumbs, tabbed views, or feature routing with `@wangs-ui/react-core`, `@wangs-ui/foundation`, and `@wangs-ui/react-navigation`.
11
+
12
+ ---
13
+
14
+ ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
15
+
16
+ Do **NOT** guess layout block slots, sidebar item interfaces, or breadcrumb props. Query the MCP server dynamically to inspect exact contracts and live story implementations:
17
+
18
+ ### Inspect Layout & Navigation Contracts (`component` parameter):
19
+
20
+ ```json
21
+ get_component_api({ "component": "applayout" })
22
+ get_component_api({ "component": "sidebar" })
23
+ get_component_api({ "component": "tabletoolbar" })
24
+ get_component_api({ "component": "breadcrumb" })
25
+ get_component_api({ "component": "tabs" })
26
+ ```
27
+
28
+
29
+ ### Read Curated Layout Documentation (`id` parameter):
30
+
31
+ ```json
32
+ get_documentation({ "id": "applayout" })
33
+ get_documentation({ "id": "sidebar" })
34
+ get_documentation({ "id": "react-navigation" })
35
+ ```
36
+
37
+ ### Inspect Live Story Implementations:
38
+
39
+ ```json
40
+ get_component_examples({ "component": "applayout", "variant": "TopNavbar" })
41
+ get_component_examples({ "component": "sidebar", "variant": "WithSubMenu" })
42
+ get_component_examples({ "component": "breadcrumb", "variant": "Default" })
43
+ get_component_examples({ "component": "tabs", "variant": "Default" })
44
+ ```
45
+
46
+ ### Inspect Knowledge Graph & Usages:
47
+
48
+ ```json
49
+ query_graph({ "query": "AppLayout" })
50
+ query_graph({ "query": "Sidebar" })
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 2. Layout Architecture & Mental Model
56
+
57
+ 1. **Top-Level App Shell (`AppLayout`)**:
58
+ - Subpath: `@wangs-ui/react-core/blocks/applayout`
59
+ - Outer responsive shell arranging navigation, navbar, sidebars, main viewport, and footer. Inspect slots and layout variants via `get_component_api({ "component": "applayout" })`.
60
+ 2. **Hierarchical Menu (`Sidebar`)**:
61
+ - Subpath: `@wangs-ui/react-core/blocks/sidebar`
62
+ - Primary app navigation drawer/rail supporting nested menus, badges, and collapse states. Inspect items and events via `get_component_api({ "component": "sidebar" })`.
63
+ 3. **Breadcrumb Trail (`Breadcrumb`)**:
64
+ - Subpath: `@wangs-ui/react-core/primitive/breadcrumb`
65
+ - Secondary hierarchy navigation displaying screen depth. Inspect item structure via `get_component_api({ "component": "breadcrumb" })`.
66
+ 4. **Tabbed Sub-Views (`Tabs`)**:
67
+ - Subpath: `@wangs-ui/react-core/primitive/tabs`
68
+ - In-page view switcher for partitioning entity details into distinct panels. Inspect via `get_component_api({ "component": "tabs" })`.
69
+ 5. **Universal Routing (`@wangs-ui/react-navigation`)**:
70
+ - Platform-agnostic route graph abstraction (`buildGraph`, `paramRoute`).
71
+ - Web router bridge: `@wangs-ui/react-navigation/web` (React Router).
72
+ - Native router bridge: `@wangs-ui/react-navigation/native` (React Navigation / Expo).
73
+
74
+ ---
75
+
76
+ ## 3. Structural Page Blueprint (Standard Pattern)
77
+
78
+ ```tsx
79
+ import AppLayout from '@wangs-ui/react-core/blocks/applayout';
80
+ import Sidebar from '@wangs-ui/react-core/blocks/sidebar';
81
+ import Breadcrumb from '@wangs-ui/react-core/primitive/breadcrumb';
82
+ import { Container, Section, Stack, HStack } from '@wangs-ui/foundation/layout';
83
+ import { Text } from '@wangs-ui/foundation/theme';
84
+ import { useI18n } from '@wangs-ui/react-i18n';
85
+ import { HomeLine, Settings4Line } from '@wangs-ui/react-icons';
86
+ import { useState } from 'react';
87
+
88
+ export function ApplicationShell({ children }: { children: React.ReactNode }) {
89
+ const { t } = useI18n();
90
+ const [activeRoute, setActiveRoute] = useState('dashboard');
91
+ const [collapsed, setCollapsed] = useState(false);
92
+
93
+ const sidebarItems = [
94
+ { value: 'dashboard', label: t('Dashboard'), icon: HomeLine, to: '/' },
95
+ { value: 'settings', label: t('Settings'), icon: Settings4Line, to: '/settings' },
96
+ ];
97
+
98
+ return (
99
+ <AppLayout
100
+ variant="full-sidebar"
101
+ sidebar={
102
+ <Sidebar
103
+ items={sidebarItems}
104
+ value={activeRoute}
105
+ onValueChange={setActiveRoute}
106
+ collapsed={collapsed}
107
+ onCollapsedChange={setCollapsed}
108
+ collapseMode="rail"
109
+ />
110
+ }
111
+ >
112
+ <Container size="xl">
113
+ <Section space="md">
114
+ <Stack gap="4">
115
+ <Breadcrumb
116
+ items={[
117
+ { label: t('Home'), href: '/' },
118
+ { label: t('Dashboard') },
119
+ ]}
120
+ />
121
+ <Text variant="headlineLarge">{t('Overview')}</Text>
122
+ {children}
123
+ </Stack>
124
+ </Section>
125
+ </Container>
126
+ </AppLayout>
127
+ );
128
+ }
129
+ ```
130
+
131
+ ---
132
+
133
+ ## 4. Mandatory Implementation Rules
134
+
135
+ 1. **Query MCP First**: Always inspect `applayout` and `sidebar` stories via MCP before assembling the layout.
136
+ 2. **Strict Subpath Imports**:
137
+ - Blocks: `@wangs-ui/react-core/blocks/*` (`applayout`, `sidebar`, `tabletoolbar`)
138
+ - Primitives: `@wangs-ui/react-core/primitive/*` (`breadcrumb`, `tabs`)
139
+ - Layout Primitives: `@wangs-ui/foundation/layout` (`Container`, `Section`, `Stack`, `HStack`, `Box`, `Grid`)
140
+ - Typography: `@wangs-ui/foundation/theme` (`Text`)
141
+ 3. **Standard Layout Containers & Spacing**:
142
+ - Use `Container` (max-width rhythm) and `Section` (vertical rhythm) for page boundaries.
143
+ - Use flat numeric Tailwind spacing (`gap="4"`, `p="6"`). Never use legacy named tokens like `p-3xl` or `gap-md`.
144
+ 4. **Typography Scale**:
145
+ - Use `<Text variant="headlineLarge">` or `display*` / `title*` for page headers. Never use obsolete `.heading-*` helper classes or raw HTML heading tags without primitives.
146
+ 5. **No Redundant Layout Wrappers**:
147
+ - Do NOT insert intermediate pass-through `<div>` or `<Box>` wrappers between `<Card>`/`<Tabs>` and tab contents.
148
+ - Render active tab content directly as a child of the container:
149
+ ```tsx
150
+ // ✅ Good
151
+ <Card>
152
+ <Tabs items={tabItems} value={activeTab} onValueChange={setActiveTab} />
153
+ {activeTab === 'general' ? <GeneralTab /> : <SecurityTab />}
154
+ </Card>
155
+ ```
156
+ 6. **Translate Navigation Labels**: Wrap all sidebar item labels, breadcrumb text, and page headings in `t('...')` from `@wangs-ui/react-i18n`.
@@ -0,0 +1,107 @@
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. MCP Inspection Protocol (Mandatory Single Source of Truth)
14
+
15
+ Do **NOT** guess responsive prop types or breakpoint keys. Query the MCP server dynamically:
16
+
17
+ ```json
18
+ resolve_type_definition({ "types": ["ResponsiveValue", "Breakpoint", "SpacingKey"] })
19
+ ```
20
+
21
+ ---
22
+
23
+ ## 2. Breakpoint Reference
24
+
25
+ Wangs UI uses three standardized breakpoints:
26
+
27
+ | Breakpoint | Viewport Range | Typical Target |
28
+ | :------------- | :------------- | :------------------------- |
29
+ | **`compact`** | `< 600px` | Mobile phones |
30
+ | **`medium`** | `600–839px` | Tablet portrait |
31
+ | **`expanded`** | `≥ 840px` | Tablet landscape & Desktop |
32
+
33
+ ### Reading the Current Breakpoint in Code
34
+
35
+ ```tsx
36
+ import { useTheme } from '@wangs-ui/foundation/theme';
37
+
38
+ const { breakpoint } = useTheme(); // 'compact' | 'medium' | 'expanded'
39
+ ```
40
+
41
+ ---
42
+
43
+ ## 3. Responsive Props (`ResponsiveValue`)
44
+
45
+ Visual scale props (`size`, layout `gap`, `columns`, `p`, `m`) accept either a single value or an object mapped by breakpoint:
46
+
47
+ ```tsx
48
+ import { Button } from '@wangs-ui/react-core/components/button';
49
+ import { Grid, Stack } from '@wangs-ui/foundation/layout';
50
+
51
+ // Static (identical across all devices)
52
+ <Button size="md" />
53
+ <Stack gap="4" />
54
+
55
+ // Adaptive (changes across breakpoints)
56
+ <Button size={{ compact: 'lg', expanded: 'sm' }} />
57
+ <Grid columns={{ compact: 1, medium: 2, expanded: 4 }} />
58
+ ```
59
+
60
+ > **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.
61
+
62
+ ---
63
+
64
+ ## 4. Conditional Rendering (`<Show>`)
65
+
66
+ Use `<Show>` when a component should be mounted or unmounted based on the active breakpoint:
67
+
68
+ ```tsx
69
+ import { Show } from '@wangs-ui/foundation/theme';
70
+
71
+ // Render only on tablet & desktop
72
+ <Show above="medium">
73
+ <SidebarNav />
74
+ </Show>
75
+
76
+ // Render only on mobile
77
+ <Show below="medium">
78
+ <MobileNavbar />
79
+ </Show>
80
+
81
+ // Swap component with a fallback
82
+ <Show at="compact" fallback={<DesktopTable />}>
83
+ <MobileCardList />
84
+ </Show>
85
+ ```
86
+
87
+ ### When to use `<Show>` vs CSS `hidden`:
88
+
89
+ - **Use `<Show>`**: If the hidden component has expensive network fetches, subscriptions, or animations (unmounts completely).
90
+ - **Use CSS Tailwind (`hidden md:block`)**: If it's just a visual styling toggle with no side effects.
91
+
92
+ ---
93
+
94
+ ## 5. Spacing Conventions
95
+
96
+ Spacing tokens are **flat and fixed** (1 unit = 4px):
97
+
98
+ - **Web**: Use standard Tailwind numeric classes (`gap-2`, `px-4`, `py-3`). **Never** use legacy named classes like `gap-md` or `px-sm`.
99
+ - **Native**: Use `const { spacing } = useTheme();` (`spacing[4]` = 16px).
100
+
101
+ ---
102
+
103
+ ## 6. Anti-Patterns to Avoid
104
+
105
+ 1. **Avoid `hidden md:block` for stateful/heavy trees**: Always prefer `<Show>` so unused components cleanly unmount.
106
+ 2. **Never pass responsive objects to behavioral props**: `<Button disabled={{ compact: true }} />` is invalid.
107
+ 3. **No manual pixel calculations**: Use Tailwind numeric tokens (`gap-4`, `p-6`) or `ResponsiveValue`.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: universal-layout
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
6
+ ---
7
+ # Skill: Universal Layout Primitives
8
+
9
+ Use this skill when arranging page structure, spacing, or responsive grids with
10
+ `@wangs-ui/foundation/layout`.
11
+ For app shells (sidebar, breadcrumb, tabs), see the `layout-navigation` skill instead.
12
+
13
+ ---
14
+
15
+ ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
16
+
17
+ Do **NOT** guess layout prop names, spacing scales, or breakpoint keys. Query the MCP
18
+ server dynamically:
19
+
20
+ ```json
21
+ list_catalog({ "query": "layout" })
22
+ resolve_type_definition({ "types": ["ResponsiveValue", "SpacingKey", "StackProps", "GridProps", "BoxProps", "ScrollAreaProps"] })
23
+ ```
24
+
25
+ ---
26
+
27
+ ## 2. Choosing the Right Primitive
28
+
29
+ 1. **Stack (Vertical)** — default for vertical flows (forms, cards, page sections).
30
+ Fixed `column` direction, uniform `gap`, optional auto-`separator`.
31
+ 2. **HStack** — horizontal rows with vertical centering (avatar + label + action,
32
+ toolbar clusters). Fixed `row` direction.
33
+ 3. **Flex** — only when you need explicit `direction`, `wrap`, `align`, or `justify`
34
+ control beyond what Stack/HStack fix. Prefer Stack/HStack otherwise.
35
+ 4. **Grid** — two-dimensional placement or multi-column flows:
36
+ - explicit `columns={{ compact: 1, medium: 2, expanded: 4 }}` for fixed column counts;
37
+ - `minItemWidth` for auto-fit (columns grow/shrink with container width, no media query);
38
+ - `GridItem` with `colSpan` / `rowSpan` for featured tiles.
39
+ 5. **Box** — leaf-level spacing/sizing wrapper (`p`, `m`, `radius`, `overflow`), or
40
+ polymorphic `as="section" | "main" | "article"` for landmarks.
41
+ 6. **Container / Section** — page-level rhythm only: `Container` bounds max-width
42
+ (`size`, default `'xl'`) with consistent horizontal padding; `Section` sets
43
+ vertical rhythm (`space: 'sm' | 'md' | 'lg'`, default `'md'`). Never nest
44
+ `Container` inside `Container`.
45
+ 7. **ZStack** — overlays (badge on card, status dot on avatar, hero overlay).
46
+ 8. **ScrollArea** — styled, accessible scrollable viewports (`orientation: 'vertical' | 'horizontal' | 'both'`, `variant: 'hover' | 'always' | 'scroll'`).
47
+ 9. **AspectRatio / Bleed / Spacer** — media frames (`ratio`), full-bleed breakouts
48
+ inside padded containers (`Bleed`), and flexible fillers in stacks (`Spacer`).
49
+
50
+ ---
51
+
52
+ ## 3. Mandatory Implementation Rules
53
+
54
+ 1. **ResponsiveValue everywhere**: scalar for static (`gap="4"`), object for
55
+ adaptive (`gap={{ compact: '2', medium: '4', expanded: '6' }}`,
56
+ `columns={{ compact: 1, medium: 2, expanded: 4 }}`). Breakpoints are
57
+ `compact` (mobile-first base), `medium` (`md:`), `expanded` (`lg:`).
58
+ 2. **Separators, not manual dividers**: `<Stack separator={<Divider />}>` inserts
59
+ dividers between children with no trailing element. Never hand-place a divider
60
+ after every child.
61
+ 3. **Spacing scale**: `gap`/`p`/`m` use `SpacingKey` (Tailwind numeric scale strings,
62
+ e.g. `'0'`, `'1'`, `'2'`, `'4'`, `'6'`, `'8'`, `'12'`, `'16'`). Never pass raw pixel strings to spacing props.
63
+ 4. **Strict subpath imports**:
64
+ ```tsx
65
+ import { Stack, HStack, Grid, Container, Box, Flex, ScrollArea } from '@wangs-ui/foundation/layout';
66
+ ```
67
+ 5. **Translate visible labels** inside layout children via `t('...')` from
68
+ `@wangs-ui/react-i18n` (layout props themselves are never translated).
69
+
70
+ ---
71
+
72
+ ## 4. Anti-Patterns (Forbidden)
73
+
74
+ 1. **Gap vs margin**: NEVER hardcode `marginBottom`/`mb-*` on children inside a
75
+ Stack/Flex/Grid to fake spacing — always use the parent's `gap`/`gapX`/`gapY`.
76
+ Margins collapse unpredictably and break `separator` insertion.
77
+ 2. **No nested Containers** and no `Container` for non-page content (cards, modals).
78
+ 3. **No `Flex` with hardcoded `flexDirection` styles** when `Stack`/`HStack` express it.
79
+ 4. **No raw media queries** for `direction`/`gap`/`columns` — use `ResponsiveValue`.
80
+ 5. **No `Grid` for one-dimensional lists** — that is `Stack`/`HStack` territory.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: wangs-ui-components
3
+ description: MCP Discovery Protocol, modular subpath import map, and primitive substitution map for Wangs UI applications.
4
+ metadata:
5
+ owner: wangs-ui
6
+ ---
7
+
8
+ # Skill: Wangs UI Component Fundamentals & MCP Protocol
9
+
10
+ Use this skill to navigate the Wangs UI ecosystem. **MCP is the single source of truth** for all component APIs, props, variants, slots, and examples. Do not hardcode or assume props — always query MCP dynamically.
11
+
12
+ ---
13
+
14
+ ## 1. The MCP Discovery Protocol (Single Source of Truth)
15
+
16
+ Do **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Always query the MCP server dynamically:
17
+
18
+ ```mermaid
19
+ graph TD
20
+ A[Identify Component / Primitive Needed] --> B[list_catalog to confirm name/id]
21
+ B --> C[get_component_api for typed contract]
22
+ B --> D[get_documentation for curated guidance]
23
+ C --> E{Need live story / variant code?}
24
+ D --> E
25
+ E -->|Yes| F[get_component_examples]
26
+ E -->|No| G[Implement with Subpath Import Map]
27
+ F --> G
28
+ ```
29
+
30
+ ### Discovery Steps:
31
+
32
+ 1. **Discover Catalog Entries**:
33
+ ```json
34
+ list_catalog({ "query": "button" })
35
+ list_catalog({ "category": "component" })
36
+ ```
37
+ 2. **Inspect Typed Contracts & Props** (`component` parameter):
38
+ ```json
39
+ get_component_api({ "component": "button" })
40
+ get_component_api({ "component": "datatable" })
41
+ get_component_api({ "component": "field" })
42
+ ```
43
+ 3. **Read Curated Narrative Documentation** (`id` parameter):
44
+ ```json
45
+ get_documentation({ "id": "button" })
46
+ get_documentation({ "id": "foundation" })
47
+ get_documentation({ "id": "form" })
48
+ ```
49
+ 4. **Fetch Live Storybook TSX Examples**:
50
+ ```json
51
+ get_component_examples({ "component": "button", "variant": "Sizes" })
52
+ get_component_examples({ "component": "datatable", "variant": "Basic" })
53
+ ```
54
+ 5. **Explore Knowledge Graph Relationships**:
55
+ ```json
56
+ query_graph({ "query": "DataTable" })
57
+ query_graph({ "query": "useForm" })
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 2. Modular Subpath Import Map
63
+
64
+ Always import via specific subpath modules to guarantee tree-shaking and avoid bundling entire packages:
65
+
66
+ | Ecosystem Layer | Subpath Pattern | Example Imports |
67
+ | :--- | :--- | :--- |
68
+ | **Core Primitives** | `@wangs-ui/react-core/primitive/<name>` | `Button`, `Input`, `Select`, `DataTable`, `Dialog`, `Modal`, `Field`, `Form`, `Card`, `Badge` |
69
+ | **Layout Primitives** | `@wangs-ui/foundation/layout` | `Stack`, `HStack`, `VStack`, `Flex`, `Grid`, `Box`, `Container`, `Section`, `ScrollArea` |
70
+ | **Typography Primitives** | `@wangs-ui/foundation/theme` | `Text`, `Code`, `Kbd`, `Link`, `Blockquote`, `List`, `Mark` |
71
+ | **Blocks & Shells** | `@wangs-ui/react-core/blocks/<name>` | `AppLayout`, `Sidebar`, `TableToolbar` |
72
+ | **Form Engine** | `@wangs-ui/form/core`, `@wangs-ui/form/react` | Headless form state, hooks, validation adapters |
73
+ | **Universal Navigation** | `@wangs-ui/react-navigation/web`, `@wangs-ui/react-navigation/native` | `buildGraph`, `paramRoute`, platform router bridges |
74
+ | **Theme & Providers** | `@wangs-ui/react-core/api`, `@wangs-ui/foundation/theme` | `WangsUiProvider`, `ThemeProvider`, `useTheme` |
75
+ | **Vector Icons** | `@wangs-ui/react-icons` | `SearchLine`, `AddLine`, `DeleteBin6Line`, `CheckLine` |
76
+ | **i18n & Localization** | `@wangs-ui/react-i18n` | `useI18n`, `t`, `WangsUiI18nProvider` |
77
+
78
+ ---
79
+
80
+ ## 3. Primitive Substitution Map
81
+
82
+ Zero raw HTML elements. Never write raw HTML tags when a Wangs UI primitive exists:
83
+
84
+ | Forbidden Raw HTML | Mandatory Wangs UI Primitive | Import Path | MCP Catalog / Doc ID |
85
+ | :--- | :--- | :--- | :--- |
86
+ | `<button>` | `Button` | `@wangs-ui/react-core/primitive/button` | `button` |
87
+ | `<input type="text">` | `Input` | `@wangs-ui/react-core/primitive/input` | `input` |
88
+ | `<input type="number">` | `NumberInput` | `@wangs-ui/react-core/primitive/numberinput` | `numberinput` |
89
+ | `<input type="checkbox">` | `Checkbox` | `@wangs-ui/react-core/primitive/checkbox` | `checkbox` |
90
+ | `<select>` | `Select` / `MultiSelect` | `@wangs-ui/react-core/primitive/select` | `select`, `multiselect` |
91
+ | `<textarea>` | `Textarea` | `@wangs-ui/react-core/primitive/textarea` | `textarea` |
92
+ | `<form>` | `Form` / `DialogForm` | `@wangs-ui/react-core/primitive/form` | `form`, `dialogform` |
93
+ | `<dialog>` / alert modal | `Modal` / `Dialog` | `@wangs-ui/react-core/primitive/modal` | `modal`, `dialog` |
94
+ | `<table>` | `DataTable` | `@wangs-ui/react-core/primitive/datatable` | `datatable` |
95
+ | `<div>` (layout / flex / grid) | `Stack`, `HStack`, `Flex`, `Grid`, `Box` | `@wangs-ui/foundation/layout` | `universal-layout` |
96
+ | `<div>` (surface card) | `Card` | `@wangs-ui/react-core/primitive/card` | `card` |
97
+ | Pill / status chip | `Badge` | `@wangs-ui/react-core/primitive/badge` | `badge` |
98
+ | `<h1>` - `<h6>` | `<Text variant="...">` | `@wangs-ui/foundation/theme` | `foundation` |
99
+ | `<p>`, `<span>` (body text) | `<Text variant="...">` | `@wangs-ui/foundation/theme` | `foundation` |
100
+ | `<a>` | `Link` | `@wangs-ui/foundation/theme` | `foundation` |
101
+ | `<code>` | `Code` | `@wangs-ui/foundation/theme` | `foundation` |
102
+ | `<kbd>` | `Kbd` | `@wangs-ui/foundation/theme` | `foundation` |
103
+ | `<blockquote>` | `Blockquote` | `@wangs-ui/foundation/theme` | `foundation` |
104
+ | `<ul>`, `<ol>` | `List` | `@wangs-ui/foundation/theme` | `foundation` |
@@ -1,62 +0,0 @@
1
- ---
2
- name: layout-navigation
3
- description: Architecture, navigation hierarchies, and MCP discovery protocol for AppLayout, Sidebar, Breadcrumb, and Tabs in Wangs UI.
4
- ---
5
-
6
- # Skill: Application Layout & Navigation Hierarchy
7
-
8
- Use this skill when constructing application shells, multi-level sidebars, page headers, breadcrumbs, or tabbed views with `@wangs-ui/react-core`.
9
-
10
- ---
11
-
12
- ## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
13
-
14
- Do **NOT** guess layout block slots, sidebar item interfaces, or breadcrumb props. Query the MCP server dynamically to inspect exact contracts and live story implementations:
15
-
16
- ### Inspect Layout & Navigation Contracts:
17
-
18
- ```json
19
- get-documentation({ "id": "applayout" })
20
- get-documentation({ "id": "sidebar" })
21
- get-documentation({ "id": "breadcrumb" })
22
- get-documentation({ "id": "tabs" })
23
- ```
24
-
25
- ### Inspect Live Story Implementations:
26
-
27
- ```json
28
- get-documentation-for-story({ "id": "applayout", "storyName": "Default" })
29
- get-documentation-for-story({ "id": "sidebar", "storyName": "Default" })
30
- get-documentation-for-story({ "id": "breadcrumb", "storyName": "Default" })
31
- get-documentation-for-story({ "id": "tabs", "storyName": "Default" })
32
- ```
33
-
34
- ### Inspect Knowledge Graph & Usages:
35
-
36
- ```json
37
- query_graph({ "query": "AppLayout" })
38
- query_graph({ "query": "Sidebar" })
39
- ```
40
-
41
- ---
42
-
43
- ## 2. Layout Architecture & Mental Model
44
-
45
- 1. **Top-Level App Shell (`AppLayout`)**:
46
- Provides structured slots for `sidebar`, `header`, and main content view, handling responsive viewport scaling and mobile navigation overlays.
47
- 2. **Hierarchical Menu (`Sidebar`)**:
48
- Renders single and nested navigation items, active route indicators, collapsible state, and notification badges.
49
- 3. **Breadcrumb Trail (`Breadcrumb`)**:
50
- Maintains clear navigational hierarchy on page headers.
51
- 4. **Tabbed Sub-Views (`Tabs`)**:
52
- Organizes complex entity detail views or multi-section settings into distinct tabbed panels.
53
-
54
- ---
55
-
56
- ## 3. Mandatory Implementation Rules
57
-
58
- 1. **Query MCP for Current Code Patterns**: Inspect `applayout` and `sidebar` stories via MCP before assembling the layout.
59
- 2. **Strict Subpath Imports**: Import layout blocks via `@wangs-ui/react-core/blocks/*` and primitives via `@wangs-ui/react-core/primitive/*`.
60
- 3. **Consistent Spacing Grid**: Use standard container padding (`p-6` or `p-3xl`) across page contents.
61
- 4. **Page Hierarchy Alignment**: Every page view inside the layout must provide a clear `.heading-1` hierarchy and synchronized breadcrumbs.
62
- 5. **Translate Navigation Labels**: Wrap all sidebar item labels and breadcrumb texts in `t('...')` from `@wangs-ui/react-i18n`.