2026-07-02 08:58:29 +00:00
|
|
|
# AI DESIGN PRINCIPLES
|
|
|
|
|
|
|
|
|
|
**Rules for AI Agents Working with the Landvex Design System**
|
|
|
|
|
|
|
|
|
|
| | |
|
|
|
|
|
|---|---|
|
|
|
|
|
| **Version** | 1.0 |
|
|
|
|
|
| **Status** | LOCKED |
|
|
|
|
|
| **Scope** | All AI agents (ChatGPT, Gemini, Claude, Grok, Codex, Cursor, future) |
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## A. DECISION PROCESS
|
|
|
|
|
|
|
|
|
|
### A.1 Core Principle
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
**AI must be a design system citizen, not a design system exception.**
|
|
|
|
|
|
|
|
|
|
Every output from an AI agent must comply with the same rules as human designers and developers. No special pleading. No "AI knows better."
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### A.2 Before Any Action
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** verify proposal against document hierarchy:
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
SYSTEM_CONSTITUTION > ENGINEERING_CONSTITUTION > DESIGN_CONSTITUTION > PRODUCT_DOCTRINES > DESIGN_SPECIFICATIONS > IMPLEMENTATION_GUIDES > CODE
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT** propose anything that conflicts with a higher document.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### A.3 Check Existing Solutions
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
Before proposing anything new, **MUST**:
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
1. Search Component Decision Tree
|
|
|
|
|
2. Search Component Library (Tier 1, 2, 3)
|
2026-07-02 08:58:29 +00:00
|
|
|
3. Search existing tokens (Primitive, Semantic, Component)
|
|
|
|
|
4. Search Anti-Patterns
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** use existing solution or explain why it cannot be used.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### A.4 Apply New Component Rule
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
If no existing solution, **MUST** verify:
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
1. Can existing component be used?
|
|
|
|
|
2. Can variant be created?
|
|
|
|
|
3. Can modifier be used?
|
|
|
|
|
4. Can new state solve problem?
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
Only then **MAY** propose new component.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## B. COMPONENT SELECTION
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### B.1 Inheritance First
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** check component inheritance before creating anything new.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Button
|
|
|
|
|
├── Icon Button
|
|
|
|
|
├── Split Button
|
|
|
|
|
└── Floating Action Button
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
If child component solves need, **MUST** use it.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### B.2 Use Template
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** follow `COMPONENT_TEMPLATE.md` for all specifications.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT** omit sections or invent new ones without approval.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### B.3 Document Anti-Patterns
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** list relevant anti-patterns for every component specified.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### B.4 No Component Without Purpose
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** document Cognitive Purpose and Interaction Contract for every component.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## C. TOKEN USAGE
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### C.1 No Hardcoded Values
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT** propose hardcoded colors, spacing, dimensions, or animations.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** reference existing tokens or propose new ones through Design Review Gate.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### C.2 Semantic First
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** use semantic tokens before primitive tokens.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
❌ `color: #3b82f6;`
|
|
|
|
|
✅ `color: var(--surface-primary);`
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### C.3 Token Lifecycle
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** start all new tokens as Draft.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT**:
|
|
|
|
|
- Introduce tokens directly as Stable
|
|
|
|
|
- Skip Experimental stage
|
|
|
|
|
- Deprecate tokens without migration path
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### C.4 Deterministic Choices
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** ensure two AI agents working from same specification arrive at same token choice.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
If ambiguity exists, **MUST** flag for human resolution: `[UNCERTAIN: reason]`
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
---
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## D. DESIGN REVIEW
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### D.1 Self-Check Before Output
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
Before delivering any proposal, **MUST** verify:
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
- [ ] No hardcoded values
|
|
|
|
|
- [ ] No new components without inheritance check
|
|
|
|
|
- [ ] No tokens skipping lifecycle
|
|
|
|
|
- [ ] No anti-patterns violated
|
|
|
|
|
- [ ] Document hierarchy respected
|
|
|
|
|
- [ ] Accessibility requirements met
|
|
|
|
|
- [ ] Motion follows intention-based tokens
|
|
|
|
|
- [ ] Reduced motion considered
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### D.2 Accessibility Minimum
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** meet WCAG 2.1 AA. **MUST** verify:
|
|
|
|
|
- Color contrast ratios
|
|
|
|
|
- Keyboard navigation
|
|
|
|
|
- Screen reader labels
|
|
|
|
|
- Focus visibility
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### D.3 No ARIA Without Purpose
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT** add ARIA attributes without justification in component spec.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### D.4 Motion Rules
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** use intention-based duration tokens.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** include reduced-motion fallback.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST NOT** propose animation for aesthetic purposes.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
---
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## E. ESCALATION
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### E.1 When to Create DDR
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** create Design Decision Record (DDR) when proposing:
|
|
|
|
|
- New pattern
|
|
|
|
|
- New component
|
|
|
|
|
- New token
|
|
|
|
|
- Change to existing rule
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MAY** skip DDR if decision is trivial and fully covered by existing rules.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### E.2 Explain Rationale
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** explain why decision was made, not just what decision is.
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
### E.3 Flag Uncertainty
|
2026-07-02 08:58:29 +00:00
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
**MUST** flag uncertainty explicitly: `[UNCERTAIN: reason]`
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## AI CONTRACT FOR BUTTON
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
**When should AI choose Button?**
|
|
|
|
|
- Primary user action
|
|
|
|
|
- Form submission
|
|
|
|
|
- Dialog confirmation
|
|
|
|
|
|
|
|
|
|
**When should AI choose Link?**
|
|
|
|
|
- Navigation to another page
|
|
|
|
|
- Secondary action that does not modify state
|
|
|
|
|
- External URL
|
|
|
|
|
|
|
|
|
|
**When should AI choose Icon Button?**
|
|
|
|
|
- Toolbar action
|
|
|
|
|
- Compact UI
|
|
|
|
|
- Action is self-evident from icon
|
|
|
|
|
|
|
|
|
|
**When should AI choose Split Button?**
|
|
|
|
|
- Primary action + secondary options
|
|
|
|
|
- Save + Save As pattern
|
|
|
|
|
|
|
|
|
|
**When should AI NOT use Button?**
|
|
|
|
|
- For navigation (use Link)
|
|
|
|
|
- For toggling state (use Switch)
|
|
|
|
|
- For selecting from options (use Select)
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 09:06:08 +00:00
|
|
|
## RELATIONSHIP TO OTHER DOCUMENTS
|
|
|
|
|
|
|
|
|
|
| Document | Role |
|
|
|
|
|
|----------|------|
|
|
|
|
|
| `LANDVEX_DESIGN_CONSTITUTION.md` | Why AI must follow rules |
|
|
|
|
|
| `TOKEN_PHILOSOPHY.md` | How AI handles tokens |
|
|
|
|
|
| `LANDVEX_DESIGN_SPECIFICATION.md` | What AI must implement |
|
|
|
|
|
| `DESIGN_ANTI_PATTERNS.md` | What AI must avoid |
|
|
|
|
|
| `COMPONENT_DECISION_TREE.md` | How AI chooses components |
|
|
|
|
|
| `AI_DESIGN_PRINCIPLES.md` | AI-specific rules |
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-02 08:58:29 +00:00
|
|
|
## ÄNDRINGSHISTORIA
|
|
|
|
|
|
|
|
|
|
| Version | Datum | Beskrivning |
|
|
|
|
|
|---------|-------|-------------|
|
2026-07-02 09:06:08 +00:00
|
|
|
| 1.0 | 2026-07-02 | Restructured into 5 parts: Decision Process, Component Selection, Token Usage, Design Review, Escalation |
|
2026-07-02 08:58:29 +00:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## STATUS
|
|
|
|
|
|
|
|
|
|
**LOCKED**
|
|
|
|
|
|
|
|
|
|
- Mindre revideringar: 1.x-serien
|
|
|
|
|
- Brytande ändringar: Kräver Architecture Review, ny major-version (2.0+)
|