|
| 1 | +# ObjectUI AI Development Prompts |
| 2 | + |
| 3 | +This directory contains specialized AI prompts for developing and optimizing each core component of the ObjectUI system. |
| 4 | + |
| 5 | +## Purpose |
| 6 | + |
| 7 | +These prompts serve as system instructions for AI agents (like GitHub Copilot, ChatGPT, Claude, etc.) when working on specific parts of the ObjectUI codebase. Each prompt contains: |
| 8 | + |
| 9 | +- **Role & Context**: What the AI should act as and understand |
| 10 | +- **Technical Constraints**: Stack-specific rules and requirements |
| 11 | +- **Architecture Guidelines**: How the component fits in the system |
| 12 | +- **Development Rules**: Best practices and patterns to follow |
| 13 | +- **Testing Requirements**: What and how to test |
| 14 | +- **Examples**: Common patterns and usage |
| 15 | + |
| 16 | +## Directory Structure |
| 17 | + |
| 18 | +``` |
| 19 | +.github/prompts/ |
| 20 | +├── README.md # This file |
| 21 | +├── core-packages/ # Core system packages |
| 22 | +│ ├── types-package.md # @object-ui/types - Protocol definitions |
| 23 | +│ ├── core-package.md # @object-ui/core - Engine logic |
| 24 | +│ ├── react-package.md # @object-ui/react - Runtime bindings |
| 25 | +│ └── components-package.md # @object-ui/components - UI library |
| 26 | +├── components/ # Component category prompts |
| 27 | +│ ├── basic-components.md # Basic primitives (text, image, icon) |
| 28 | +│ ├── layout-components.md # Layout system (grid, flex, container) |
| 29 | +│ ├── form-components.md # Form controls (input, select, checkbox) |
| 30 | +│ ├── data-display-components.md # Data visualization (list, table, badge) |
| 31 | +│ ├── feedback-components.md # User feedback (loading, progress, toast) |
| 32 | +│ ├── overlay-components.md # Overlays (dialog, popover, tooltip) |
| 33 | +│ ├── navigation-components.md # Navigation (menu, tabs, breadcrumb) |
| 34 | +│ ├── disclosure-components.md # Disclosure (accordion, collapsible) |
| 35 | +│ └── complex-components.md # Complex patterns (CRUD, calendar) |
| 36 | +├── plugins/ # Plugin development |
| 37 | +│ └── plugin-development.md # Guidelines for creating plugins |
| 38 | +└── tools/ # Developer tools |
| 39 | + ├── designer.md # Visual designer |
| 40 | + ├── cli.md # CLI tool |
| 41 | + └── runner.md # App runner |
| 42 | +
|
| 43 | +``` |
| 44 | + |
| 45 | +## How to Use |
| 46 | + |
| 47 | +### For AI Agents |
| 48 | + |
| 49 | +When working on a specific component or package: |
| 50 | + |
| 51 | +1. **Identify** the relevant prompt file based on the task |
| 52 | +2. **Load** the prompt as your system instruction |
| 53 | +3. **Follow** the guidelines, constraints, and patterns defined |
| 54 | +4. **Reference** the examples for common patterns |
| 55 | + |
| 56 | +### For Developers |
| 57 | + |
| 58 | +When requesting AI assistance: |
| 59 | + |
| 60 | +1. **Point** the AI to the relevant prompt file |
| 61 | +2. **Provide** context about what you're trying to achieve |
| 62 | +3. **Review** the AI's output against the prompt's requirements |
| 63 | + |
| 64 | +### Example Usage |
| 65 | + |
| 66 | +```bash |
| 67 | +# Using with GitHub Copilot Chat |
| 68 | +"Use the prompt from .github/prompts/core-packages/types-package.md to help me add a new component schema" |
| 69 | + |
| 70 | +# Using with ChatGPT/Claude |
| 71 | +"I need to develop a new form component. Here's the development guide: [paste content from .github/prompts/components/form-components.md]" |
| 72 | +``` |
| 73 | + |
| 74 | +## Prompt Categories |
| 75 | + |
| 76 | +### 1. Core Packages (Foundation Layer) |
| 77 | + |
| 78 | +These prompts govern the fundamental building blocks: |
| 79 | + |
| 80 | +- **types**: Pure TypeScript interfaces, zero dependencies |
| 81 | +- **core**: Schema validation, registry, expression engine |
| 82 | +- **react**: React bindings and SchemaRenderer |
| 83 | +- **components**: Shadcn/Tailwind implementation |
| 84 | + |
| 85 | +### 2. Component Categories (UI Layer) |
| 86 | + |
| 87 | +Organized by UI purpose and patterns: |
| 88 | + |
| 89 | +- **basic**: Primitive elements (text, image, icon, separator) |
| 90 | +- **layout**: Spatial organization (grid, flex, stack, container) |
| 91 | +- **form**: User input (input, select, checkbox, radio, switch) |
| 92 | +- **data-display**: Information presentation (list, table, badge, avatar) |
| 93 | +- **feedback**: System state (loading, progress, skeleton, toast) |
| 94 | +- **overlay**: Layered content (dialog, popover, dropdown, tooltip) |
| 95 | +- **navigation**: Movement (menu, tabs, breadcrumb, pagination) |
| 96 | +- **disclosure**: Show/hide content (accordion, collapsible, tabs) |
| 97 | +- **complex**: Advanced patterns (CRUD, calendar, kanban, charts) |
| 98 | + |
| 99 | +### 3. Plugins (Extension Layer) |
| 100 | + |
| 101 | +Guidelines for extending ObjectUI: |
| 102 | + |
| 103 | +- Plugin architecture and patterns |
| 104 | +- Lazy loading and code splitting |
| 105 | +- Integration with core system |
| 106 | +- Examples: charts, editor, kanban, markdown |
| 107 | + |
| 108 | +### 4. Tools (Developer Experience) |
| 109 | + |
| 110 | +For building ObjectUI tooling: |
| 111 | + |
| 112 | +- **designer**: Visual drag-and-drop editor |
| 113 | +- **cli**: Command-line interface |
| 114 | +- **runner**: Development server |
| 115 | + |
| 116 | +## Key Principles (Applies to All Prompts) |
| 117 | + |
| 118 | +### 1. JSON Schema-First Design |
| 119 | + |
| 120 | +Every component must be fully definable via JSON schema: |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + "type": "button", |
| 125 | + "label": "Click Me", |
| 126 | + "variant": "primary", |
| 127 | + "onClick": { "type": "action", "name": "submit" } |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +### 2. Zero Runtime Overhead |
| 132 | + |
| 133 | +- No inline styles (`style={{}}`) |
| 134 | +- No CSS-in-JS libraries |
| 135 | +- Tailwind classes only (via `cn()` utility) |
| 136 | +- Use `class-variance-authority` for variants |
| 137 | + |
| 138 | +### 3. Stateless Components |
| 139 | + |
| 140 | +Components are controlled by schema props: |
| 141 | + |
| 142 | +```tsx |
| 143 | +// ✅ Good: Controlled by props |
| 144 | +export function Button({ schema, data }: RendererProps<ButtonSchema>) { |
| 145 | + return <button className={cn(buttonVariants({ variant: schema.variant }))} /> |
| 146 | +} |
| 147 | + |
| 148 | +// ❌ Bad: Internal state |
| 149 | +export function Button() { |
| 150 | + const [clicked, setClicked] = useState(false) |
| 151 | +} |
| 152 | +``` |
| 153 | + |
| 154 | +### 4. Separation of Concerns |
| 155 | + |
| 156 | +``` |
| 157 | +types (Protocol) → core (Logic) → react (Bindings) → components (UI) |
| 158 | +``` |
| 159 | + |
| 160 | +No backwards dependencies allowed! |
| 161 | + |
| 162 | +### 5. TypeScript Strict Mode |
| 163 | + |
| 164 | +- All code must pass `tsc --strict` |
| 165 | +- No `any` types without justification |
| 166 | +- Comprehensive interface definitions |
| 167 | + |
| 168 | +### 6. Accessibility First |
| 169 | + |
| 170 | +- WCAG 2.1 AA minimum |
| 171 | +- Keyboard navigation |
| 172 | +- Screen reader support |
| 173 | +- ARIA attributes |
| 174 | +- Focus management |
| 175 | + |
| 176 | +### 7. Testing Requirements |
| 177 | + |
| 178 | +- Unit tests for logic (core) |
| 179 | +- Integration tests for renderers (components) |
| 180 | +- Type tests for schemas (types) |
| 181 | +- Visual regression tests (Storybook) |
| 182 | + |
| 183 | +## Maintenance |
| 184 | + |
| 185 | +These prompts should be updated when: |
| 186 | + |
| 187 | +- Architecture patterns change |
| 188 | +- New constraints are identified |
| 189 | +- Common mistakes are discovered |
| 190 | +- Best practices evolve |
| 191 | + |
| 192 | +## Contributing |
| 193 | + |
| 194 | +When adding or updating prompts: |
| 195 | + |
| 196 | +1. Follow the existing structure |
| 197 | +2. Include concrete examples |
| 198 | +3. Specify constraints clearly |
| 199 | +4. Link to relevant documentation |
| 200 | +5. Test the prompt with an AI agent |
| 201 | + |
| 202 | +## Related Documentation |
| 203 | + |
| 204 | +- [Architecture Overview](../../docs/spec/architecture.md) |
| 205 | +- [Component System](../../docs/spec/component.md) |
| 206 | +- [Protocol Specifications](../../docs/protocol/overview.md) |
| 207 | +- [Contributing Guide](../../CONTRIBUTING.md) |
| 208 | + |
| 209 | +--- |
| 210 | + |
| 211 | +**Version**: 1.0.0 |
| 212 | +**Last Updated**: 2026-01-21 |
| 213 | +**Maintainer**: ObjectUI Team |
0 commit comments