fosmvvm-react-view-generator
Generate React components that render FOSMVVM ViewModels. Scaffolds ViewModelView pattern with hooks, loading states, and TypeScript types.
What this skill does
# FOSMVVM React View Generator
Generate React components that render FOSMVVM ViewModels.
## Conceptual Foundation
> For full architecture context, see [FOSMVVMArchitecture.md](../../docs/FOSMVVMArchitecture.md) | [OpenClaw reference]({baseDir}/references/FOSMVVMArchitecture.md)
In FOSMVVM, **React components are thin rendering layers** that display ViewModels:
```
┌─────────────────────────────────────────────────────────────┐
│ ViewModelView Pattern │
├─────────────────────────────────────────────────────────────┤
│ │
│ ViewModel (Data) React Component │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ title: String │────►│ <h1>{vm.title} │ │
│ │ items: [Item] │────►│ {vm.items.map()} │ │
│ │ isEnabled: Bool │────►│ disabled={!...} │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
│ ServerRequest (Actions) │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ processRequest() │◄────│ <Component.bind │ │
│ │ │ │ requestType={} │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
```
**Key principle:** Components don't transform or compute data. They render what the ViewModel provides.
---
## View-ViewModel Alignment
**The component filename should match the ViewModel it renders.**
```
src/
viewmodels/
{Feature}ViewModel.js ←──┐
{Entity}CardViewModel.js ←──┼── Same names
│
components/ │
{Feature}/ │
{Feature}View.jsx ────┤ (renders {Feature}ViewModel)
{Entity}CardView.jsx ────┘ (renders {Entity}CardViewModel)
```
This alignment provides:
- **Discoverability** - Find the component for any ViewModel instantly
- **Consistency** - Same naming discipline as SwiftUI and Leaf
- **Maintainability** - Changes to ViewModel are reflected in component location
---
## TDD Workflow
This skill generates **tests FIRST, implementation SECOND** in a single invocation:
```
1. Reference ViewModel and ServerRequest details from conversation context
2. Generate .test.js file → Tests FAIL (no implementation yet)
3. Generate .jsx file → Tests PASS
4. Verify completeness (both files exist)
5. User runs `npm test` → All tests pass ✓
```
**Context-aware:** Skill references conversation understanding of requirements. No file parsing or Q&A needed.
---
## Core Components
### 1. viewModelComponent() Wrapper
Every component is wrapped with `viewModelComponent()`:
```jsx
const MyView = FOSMVVM.viewModelComponent(({ viewModel }) => {
return <div>{viewModel.title}</div>;
});
export default MyView;
```
**Required:**
- Use `FOSMVVM.viewModelComponent()` from global namespace (loaded via script tag)
- Component function receives `{ viewModel }` prop
- No imports needed - FOSMVVM utilities loaded via `<script>` tags
### 2. The .bind() Pattern
Parent components use `.bind()` to invoke ServerRequests:
```jsx
// Parent component
function Dashboard() {
return (
<div>
<TaskList.bind({
requestType: 'GetTasksRequest',
params: { status: 'active' }
}) />
</div>
);
}
```
**The .bind() pattern:**
- Child components receive data via ServerRequest
- Parent specifies `requestType` and `params`
- WASM bridge handles request → ViewModel → component rendering
- No fetch() calls, no hardcoded URLs
### 3. Error ViewModel Handling
Error ViewModels are rendered like any other ViewModel:
```jsx
const TaskCard = FOSMVVM.viewModelComponent(({ viewModel }) => {
// Handle error ViewModels
if (viewModel.errorType === 'NotFoundError') {
return (
<div className="error">
<p>{viewModel.message}</p>
<p>{viewModel.suggestedAction}</p>
</div>
);
}
if (viewModel.errorType === 'ValidationError') {
return (
<div className="validation-error">
<h3>{viewModel.title}</h3>
<ul>
{viewModel.errors.map(err => (
<li key={err.field}>{err.message}</li>
))}
</ul>
</div>
);
}
// Render success ViewModel
return (
<div className="task-card">
<h3>{viewModel.title}</h3>
<p>{viewModel.description}</p>
</div>
);
});
```
**Key principles:**
- No generic error handling
- Each error type has its own ViewModel
- Component conditionally renders based on `errorType` property
- Error rendering is just data rendering
### 4. Navigation Intents (Not URLs)
Use navigation intents, not hardcoded paths:
```jsx
// FOSMVVM utilities loaded via <script> tag, available on global namespace
// ❌ NEVER
<a href="/tasks/123">View Task</a>
// ✅ ALWAYS
<FOSMVVM.Link to={{ intent: 'viewTask', id: viewModel.id }}>
{viewModel.linkText}
</FOSMVVM.Link>
```
**Navigation patterns:**
- Use `FOSMVVM.Link` from global namespace (loaded via script tag)
- Use `intent` property, not hardcoded paths
- Router maps intents to routes
- Platform-independent navigation
---
## Component Categories
### Display-Only Components
Components that just render data (no user interactions):
```jsx
const InfoCard = FOSMVVM.viewModelComponent(({ viewModel }) => {
return (
<div className="info-card">
<h2>{viewModel.title}</h2>
<p>{viewModel.description}</p>
{viewModel.isActive && (
<span className="badge">{viewModel.activeLabel}</span>
)}
</div>
);
});
export default InfoCard;
```
**Characteristics:**
- Just renders ViewModel properties
- No event handlers (onClick, onSubmit, etc.)
- May have conditional rendering based on ViewModel state
- No .bind() calls to child components
### Interactive Components
Components with user actions that trigger ServerRequests:
```jsx
const ActionCard = FOSMVVM.viewModelComponent(({ viewModel }) => {
return (
<div className="action-card">
<h2>{viewModel.title}</h2>
<p>{viewModel.description}</p>
<div className="actions">
<button
onClick={() => viewModel.operations.performAction()}
disabled={!viewModel.canPerformAction}
>
{viewModel.actionLabel}
</button>
<button onClick={() => viewModel.operations.cancel()}>
{viewModel.cancelLabel}
</button>
</div>
</div>
);
});
export default ActionCard;
```
### List Components
Components that render collections:
```jsx
const TaskList = FOSMVVM.viewModelComponent(({ viewModel }) => {
if (viewModel.isEmpty) {
return <div className="empty">{viewModel.emptyMessage}</div>;
}
return (
<div className="task-list">
<h2>{viewModel.title}</h2>
<p>{viewModel.totalCount}</p>
{viewModel.tasks.map(task => (
<TaskCard.bind({
requestType: 'GetTaskRequest',
params: { id: task.id }
}) />
))}
</div>
);
});
export default TaskList;
```
### Form Components
Components with validated input fields:
```jsx
const SignInForm = FOSMVVM.viewModelComponent(({ viewModel }) => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [errors, setErrors] = useState({});
const handleSubmit = async (e) => {
e.preventDefault();
const result = await viewModel.operations.submit({
email,
password
});
if (result.validationErrors) {
setErrors(result.validationErrors);
}
};
return (
<form onSubmit={handleSubmit}>
<div>
<label>{viewModel.emailLabel}</label>
<input
type="email"
value={emaRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.