FOSMVVM ViewModel Generator for Openclaw

Automate the creation of type-safe, localized ViewModels and factories for SwiftUI using the FOSMVVM architecture.

foscomputerservices
v2.0.6
Feb 15, 2026
2
1.6k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install fosmvvm-viewmodel-generator

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install fosmvvm-viewmodel-generator using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is FOSMVVM ViewModel Generator?

The FOSMVVM ViewModel Generator is a specialized tool designed to streamline the implementation of the Model-View-ViewModel architecture in SwiftUI projects. It automates the creation of ViewModels that act as the bridge between raw data models and the user interface, ensuring that data shaping and localization occur before reaching the View. This skill is a powerful addition to the library of Openclaw Skills, allowing developers to focus on feature logic rather than boilerplate code.

By leveraging the @ViewModel macro, the generator handles property name retrieval for localization bindings and supports two distinct hosting modes. Server-hosted ViewModels allow for backend-driven UI with hand-written factories, while client-hosted ViewModels use macro-generated factories for local state and offline-first features. This flexibility makes it indispensable for building complex, scalable Apple platform applications.

FOSMVVM ViewModel Generator Use Cases

  • Rapidly scaffolding new pages or complex screens with built-in request logic using Openclaw Skills.
  • Creating localized UI components such as cards, list rows, and interactive modals.
  • Implementing editable forms that synchronize validation logic via shared Fields protocols.
  • Developing robust error-handling views that wrap ResponseError data into localized ViewModels.
  • Managing nested data structures using the Nested Child Types Pattern for cleaner codebases.

How FOSMVVM ViewModel Generator Works

  1. The agent evaluates the current conversation and codebase context to determine the necessary data source and hosting mode.
  2. It distinguishes between Display ViewModels for read-only data and Form ViewModels for user input.
  3. The tool generates the Swift struct, applying the @ViewModel macro and conforming to protocols like RequestableViewModel.
  4. It scaffolds the associated Request types and Factory extensions for server-side data fetching.
  5. Corresponding YAML resource files are generated to manage all localized strings, dates, and numbers externally.

FOSMVVM ViewModel Generator Setup

Ensure your project structure includes a dedicated target for ViewModels and a resources path for localization. You can trigger the generation process by providing requirements to your AI agent and running the command.

/fosmvvm-viewmodel-generator

FOSMVVM ViewModel Generator Data Schema & Taxonomy

The generator organizes output into distinct files to maintain a clear separation of concerns:

File Pattern Description
{Name}ViewModel.swift Main struct definition with @ViewModel macro
{Name}Request.swift The networking or fetching logic for top-level screens
{Name}ViewModel+Factory.swift Server-side implementation for building ViewModels from DB
{Name}ViewModel.yml YAML-based localization strings for the specific view

FOSMVVM ViewModel Generator Advanced Features

  • Dual Hosting Modes: Seamlessly switch between server-side and client-side factory generation for diverse application needs.
  • Enum Localization: Dedicated patterns for localizing dynamic enum-based status and state values using stored LocalizableString properties.
  • Two-Tier Stubbing: Automatic generation of stub() methods to support both generic and parameterized testing in SwiftUI previews.
  • Data Shaping: Enforces pre-localization and formatting of dates and numbers before they reach the SwiftUI View.
  • Form Integration: Native support for adopting shared Fields protocols to ensure unified validation logic across the entire technical stack.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*