|
| 1 | +--- |
| 2 | +name: objectui-sdui-page-builder |
| 3 | +description: Build and integrate Schema-Driven UI pages in third-party projects using Object UI. Use this skill whenever the user asks to create app pages from JSON schemas, wire SchemaRenderer into an existing React app, implement CRUD/dashboard/form/list/detail pages with Object UI, or migrate handwritten React pages to schema-driven rendering. Use it even if the user does not explicitly mention "skill" or "SchemaRenderer" but describes metadata-driven page development, console-like page composition, or JSON-to-UI workflows. |
| 4 | +--- |
| 5 | + |
| 6 | +# ObjectUI SDUI Page Builder |
| 7 | + |
| 8 | +Use this skill to guide app developers (not framework maintainers) to build production pages with Object UI's Schema-Driven UI Engine. |
| 9 | + |
| 10 | +## What this skill should optimize for |
| 11 | + |
| 12 | +- Deliver working page features quickly with JSON-first design. |
| 13 | +- Keep architecture aligned with Object UI conventions. |
| 14 | +- Keep third-party projects backend-agnostic through DataSource interfaces. |
| 15 | +- Produce outputs that are immediately usable in app codebases. |
| 16 | + |
| 17 | +## When to use this skill |
| 18 | + |
| 19 | +Use this skill when requests include: |
| 20 | + |
| 21 | +- "Build a page with Object UI / SchemaRenderer" |
| 22 | +- "Create a CRUD/dashboard/form/detail page from JSON" |
| 23 | +- "Integrate Object UI in an existing React/Vite/Next app" |
| 24 | +- "Design a metadata-driven page similar to console" |
| 25 | +- "Move an existing React page to schema-driven rendering" |
| 26 | + |
| 27 | +Do not use this skill for: |
| 28 | + |
| 29 | +- Modifying Shadcn upstream primitives under `packages/components/src/ui/**`. |
| 30 | +- Core engine internals that belong to `@object-ui/core` maintenance. |
| 31 | +- Non-UI backend implementation unrelated to schema rendering. |
| 32 | + |
| 33 | +## Required mindset |
| 34 | + |
| 35 | +1. JSON first, React second. |
| 36 | +2. Protocol compatibility before convenience shortcuts. |
| 37 | +3. Reusable schema blocks before one-off page code. |
| 38 | +4. DataSource abstraction over hardcoded transport logic. |
| 39 | + |
| 40 | +## Standard workflow |
| 41 | + |
| 42 | +### 1. Frame the page contract first |
| 43 | + |
| 44 | +Before writing implementation code, define: |
| 45 | + |
| 46 | +- Page purpose (dashboard, list, detail, form, wizard, board). |
| 47 | +- Required data inputs and output actions. |
| 48 | +- User roles and visibility rules. |
| 49 | +- Interaction model (navigation, submit, bulk actions, modals). |
| 50 | + |
| 51 | +Then produce a first schema draft. |
| 52 | + |
| 53 | +### 2. Select the right package boundaries |
| 54 | + |
| 55 | +Use these boundaries in guidance and generated code: |
| 56 | + |
| 57 | +- `@object-ui/types`: schema and typed interfaces. |
| 58 | +- `@object-ui/core`: expression/action/registry logic. |
| 59 | +- `@object-ui/components`: base visual components and wrappers. |
| 60 | +- `@object-ui/fields`: form input renderers. |
| 61 | +- `@object-ui/layout`: shell and page composition. |
| 62 | +- `@object-ui/plugin-*`: heavy feature widgets (grid, charts, kanban, map). |
| 63 | +- `@object-ui/react`: `SchemaRenderer`, provider wiring, runtime bridge. |
| 64 | + |
| 65 | +When helping third-party apps, consume these packages; avoid duplicating core runtime logic in the app layer. |
| 66 | + |
| 67 | +### 3. Compose schema using proven node shape |
| 68 | + |
| 69 | +Use a strict component schema shape similar to: |
| 70 | + |
| 71 | +```json |
| 72 | +{ |
| 73 | + "type": "card", |
| 74 | + "id": "customer_summary", |
| 75 | + "className": "col-span-12 lg:col-span-4", |
| 76 | + "props": { |
| 77 | + "title": "Customer Summary" |
| 78 | + }, |
| 79 | + "hidden": "${data.userRole !== 'admin'}", |
| 80 | + "children": [ |
| 81 | + { |
| 82 | + "type": "text", |
| 83 | + "props": { |
| 84 | + "content": "Active users: ${data.metrics.activeUsers}" |
| 85 | + } |
| 86 | + } |
| 87 | + ] |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +Prefer expression-based behavior (`hidden`, `disabled`, computed props) over imperative branching in component code. |
| 92 | + |
| 93 | +### 4. Wire renderer and registry cleanly |
| 94 | + |
| 95 | +Typical integration sequence: |
| 96 | + |
| 97 | +1. Register default renderers/components. |
| 98 | +2. Register plugin components needed by the page type. |
| 99 | +3. Provide `dataSource` and contextual data through renderer provider. |
| 100 | +4. Render schema via `SchemaRenderer`. |
| 101 | + |
| 102 | +Keep custom component registrations namespaced to avoid collisions. |
| 103 | + |
| 104 | +### 5. Use action data, not inline callback spaghetti |
| 105 | + |
| 106 | +Represent interactions as data where possible: |
| 107 | + |
| 108 | +```json |
| 109 | +{ |
| 110 | + "events": { |
| 111 | + "onClick": [ |
| 112 | + { "action": "validate", "target": "customer_form" }, |
| 113 | + { "action": "submit", "target": "customer_form" }, |
| 114 | + { "action": "navigate", "params": { "url": "/customers" } } |
| 115 | + ] |
| 116 | + } |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +If custom app-side handlers are needed, isolate them in action handlers instead of embedding business logic into presentation components. |
| 121 | + |
| 122 | +### 6. Validate responsiveness and accessibility |
| 123 | + |
| 124 | +For every generated page, ensure: |
| 125 | + |
| 126 | +- Responsive layout behavior (mobile/tablet/desktop). |
| 127 | +- Semantic labels and ARIA fields where relevant. |
| 128 | +- Keyboard-safe interactions for forms and actions. |
| 129 | +- Error and loading states are present in schema or wrappers. |
| 130 | + |
| 131 | +### 7. Ship with verification artifacts |
| 132 | + |
| 133 | +Always include: |
| 134 | + |
| 135 | +- Final page schema JSON. |
| 136 | +- Integration code snippet (provider + renderer + registry wiring). |
| 137 | +- Test checklist (rendering, expressions, actions, data loading). |
| 138 | +- Optional migration notes if replacing legacy React page code. |
| 139 | + |
| 140 | +## Output format |
| 141 | + |
| 142 | +Always structure results in this order: |
| 143 | + |
| 144 | +1. `Page Goal` - one paragraph. |
| 145 | +2. `Schema JSON` - complete runnable draft. |
| 146 | +3. `Integration Steps` - app wiring steps. |
| 147 | +4. `Code Snippets` - minimal required TS/TSX examples. |
| 148 | +5. `Validation Checklist` - what to test before merge. |
| 149 | +6. `Extension Options` - how to add fields/plugins/actions next. |
| 150 | + |
| 151 | +## Console-inspired patterns to reuse |
| 152 | + |
| 153 | +When users ask for a "console-like" experience, prefer: |
| 154 | + |
| 155 | +- App-shell layout with persistent navigation. |
| 156 | +- Metadata-driven detail pages composed from widgets. |
| 157 | +- Registry-based component resolution over switch/case rendering. |
| 158 | +- PageSchema factories for page variants of the same domain entity. |
| 159 | + |
| 160 | +## Common mistakes to avoid |
| 161 | + |
| 162 | +- Writing large bespoke React JSX trees before schema definition. |
| 163 | +- Hardcoding API calls directly inside visual renderers. |
| 164 | +- Introducing package coupling (for example, UI package depending on business logic package). |
| 165 | +- Registering components without namespace in plugin-heavy projects. |
| 166 | +- Skipping docs updates for newly introduced schema patterns. |
| 167 | + |
| 168 | +## Fast triage playbook for ambiguous requests |
| 169 | + |
| 170 | +If the request is underspecified: |
| 171 | + |
| 172 | +1. Infer likely page category (list/detail/form/dashboard). |
| 173 | +2. Produce a minimal viable schema first. |
| 174 | +3. Mark assumptions clearly. |
| 175 | +4. Provide one conservative and one advanced variant. |
| 176 | + |
| 177 | +This keeps momentum while inviting focused user feedback. |
| 178 | + |
| 179 | +## Example prompts this skill should handle well |
| 180 | + |
| 181 | +- "In our CRM app, create a customer detail page with tabs, related orders, and action buttons using SchemaRenderer." |
| 182 | +- "Migrate this existing React order list to Object UI schema, keep filters and bulk actions." |
| 183 | +- "Set up a dashboard page in a Vite app with Object UI cards + chart plugin and role-based visibility." |
0 commit comments