跳到正文
TakoAPI
返回技能列表

fosmvvm-viewmodel-generator

由 foscomputerservices 提供

Coding Agents & IDEs
455下载量由 clawskills.sh 提供
2星标
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Generate FOSMVVM ViewModels for SwiftUI screens, pages, and components.

描述

该技能的功能

Scaffolds ViewModels for SwiftUI screens following FOSMVVM architecture. Handles both server-hosted and client-hosted modes, generating the correct combination of ViewModel structs, Request types, localization YAML, and factory files. Covers display ViewModels, form ViewModels, child ViewModels, and error display patterns.

It encodes the multi-file structure, hosting mode decision, and protocol adoption rules of FOSMVVM so developers don't have to manually reason through each placement decision.

何时使用

  • Generating a new page ViewModel that fetches data from a server API
  • Scaffolding a settings screen ViewModel backed by local device state
  • Creating a client-hosted error display ViewModel from a caught ResponseError
  • Adding a card or row child ViewModel nested inside a parent list ViewModel
  • Producing localization YAML alongside a new ViewModel struct

示例工作流

输入

User asks: Create a ViewModel for a user profile screen that loads data from the server

智能体
  1. 1

    Determine hosting mode: data comes from server, so server-hosted

  2. 2

    Design ViewModel properties: @LocalizedString for page title, stored properties for profile data, LocalizableDate for join date

  3. 3

    Generate UserProfileViewModel.swift with RequestableViewModel conformance and vmId

  4. 4

    Generate UserProfileRequest.swift with the associated ViewModelRequest type

  5. 5

    Generate UserProfileViewModel.yml with English localization keys

  6. 6

    Generate UserProfileViewModel+Factory.swift with hand-written factory querying the database

输出

Four files: UserProfileViewModel.swift, UserProfileRequest.swift, UserProfileViewModel.yml, UserProfileViewModel+Factory.swift

安装

clawhub install foscomputerservices/fosmvvm-viewmodel-generator

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接