# Send FOSMVVM ViewModel Test Generator to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "fosmvvm-viewmodel-test-generator",
    "name": "FOSMVVM ViewModel Test Generator",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/foscomputerservices/fosmvvm-viewmodel-test-generator",
    "canonicalUrl": "https://clawhub.ai/foscomputerservices/fosmvvm-viewmodel-test-generator",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/fosmvvm-viewmodel-test-generator",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=fosmvvm-viewmodel-test-generator",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "reference.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "fosmvvm-viewmodel-test-generator",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T03:12:33.038Z",
      "expiresAt": "2026-05-10T03:12:33.038Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=fosmvvm-viewmodel-test-generator",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=fosmvvm-viewmodel-test-generator",
        "contentDisposition": "attachment; filename=\"fosmvvm-viewmodel-test-generator-2.0.6.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "fosmvvm-viewmodel-test-generator"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/fosmvvm-viewmodel-test-generator"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator",
    "downloadUrl": "https://openagent3.xyz/downloads/fosmvvm-viewmodel-test-generator",
    "agentUrl": "https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent",
    "manifestUrl": "https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent.md"
  }
}
```
## Documentation

### FOSMVVM ViewModel Test Generator

Generate test files for ViewModels following FOSMVVM testing patterns.

### Conceptual Foundation

For full architecture context, see FOSMVVMArchitecture.md | OpenClaw reference

ViewModel testing in FOSMVVM verifies three critical aspects:

Codable round-trip - ViewModel encodes and decodes without data loss
Versioning stability - Structure hasn't changed unexpectedly
Multi-locale translations - All @LocalizedString properties have values in all supported locales

The LocalizableTestCase protocol provides infrastructure that tests all three in a single call.

### When to Use This Skill

Creating tests for new ViewModels
Adding test coverage to existing ViewModels
Verifying localization completeness across locales
Testing ViewModels with embedded/nested child ViewModels
Verifying @LocalizedSubs substitution behavior

### What This Skill Generates

FileLocationPurpose{Name}ViewModelTests.swiftTests/{Target}Tests/Localization/Test suite conforming to LocalizableTestCase{Name}ViewModel.ymlTests/{Target}Tests/TestYAML/YAML translations for test (if needed)

### Standard Pattern (Most Tests)

For most ViewModels, a single line provides complete coverage:

@Test func dashboardViewModel() throws {
    try expectFullViewModelTests(DashboardViewModel.self)
}

This verifies:

Codable encoding/decoding
Versioned ViewModel stability
Translations exist for all locales (en, es by default)

This is sufficient for the vast majority of ViewModel tests.

### Extended Pattern (Specific Formatting Verification)

When testing specific formatting behavior (substitutions, compound strings), add locale-specific assertions:

@Test func greetingWithSubstitution() throws {
    try expectFullViewModelTests(GreetingViewModel.self)

    // Verify specific substitution behavior
    let vm: GreetingViewModel = try .stub()
        .toJSON(encoder: encoder(locale: en))
        .fromJSON()

    #expect(try vm.welcomeMessage.localizedString == "Welcome, John!")
}

This is optional - use only when verifying specific formatting techniques.

### LocalizableTestCase Protocol

Test suites conform to LocalizableTestCase to access testing infrastructure:

import FOSFoundation
@testable import FOSMVVM
import FOSTesting
import Foundation
import Testing
@testable import {ViewModelsTarget}

@Suite("My ViewModel Tests")
struct MyViewModelTests: LocalizableTestCase {
    let locStore: LocalizationStore

    init() throws {
        self.locStore = try Self.loadLocalizationStore(
            bundle: {ViewModelsTarget}.resourceAccess,
            resourceDirectoryName: ""
        )
    }
}

The {ViewModelsTarget}.resourceAccess is the resource accessor defined when creating the ViewModels SPM target (via FOSResourceAccessor build tool plugin).

### What LocalizableTestCase Provides

Property/MethodPurposelocStoreRequired - the localization storelocalesOptional - locales to test (default: en, es)encoder(locale:)Creates a localizing JSONEncoderen, es, enGB, enUSLocale constants

### Testing Methods

MethodUse WhenexpectFullViewModelTests(_:)Primary - complete ViewModel testingexpectTranslations(_:)Translation-only verificationexpectFullFieldValidationModelTests(_:)Testing FieldValidationModel typesexpectFullFormFieldTests(_:)Testing FormField instancesexpectCodable(_:encoder:)Codable round-trip onlyexpectVersionedViewModel(_:encoder:)Versioning stability only

### ViewModels with @LocalizedString

Every ViewModel with @LocalizedString properties needs YAML entries:

@ViewModel
public struct DashboardViewModel: RequestableViewModel {
    @LocalizedString public var pageTitle      // Needs YAML entry
    @LocalizedString public var emptyMessage   // Needs YAML entry
    public let itemCount: Int                   // No YAML needed
}

# DashboardViewModel.yml
en:
  DashboardViewModel:
    pageTitle: "Dashboard"
    emptyMessage: "No items yet"

es:
  DashboardViewModel:
    pageTitle: "Tablero"
    emptyMessage: "No hay elementos todavía"

### Embedded ViewModels

When a ViewModel contains child ViewModels, all types in the hierarchy need YAML entries:

@ViewModel
public struct BoardViewModel: RequestableViewModel {
    @LocalizedString public var title
    public let cards: [CardViewModel]  // Child ViewModel
}

@ViewModel
public struct CardViewModel {
    @LocalizedString public var cardTitle
}

Both BoardViewModel and CardViewModel need YAML entries (can be in same or separate files).

### Private Test ViewModels

When tests define private ViewModel structs for testing specific scenarios, those also need YAML:

// In test file
private struct TestParentViewModel: ViewModel {
    @LocalizedString var title
    let children: [TestChildViewModel]
}

private struct TestChildViewModel: ViewModel {
    @LocalizedString var label
}

Add entries to a test YAML file for these private types.

### How to Use This Skill

Invocation:
/fosmvvm-viewmodel-test-generator

Prerequisites:

ViewModel structure understood from conversation context
Localization properties identified (@LocalizedString, @LocalizedSubs, etc.)
YAML localization files exist or will be created
Child ViewModels identified (if any)

Workflow integration:
This skill is used when adding test coverage for ViewModels. The skill references conversation context automatically—no file paths or Q&A needed. Typically follows fosmvvm-viewmodel-generator.

### Pattern Implementation

This skill references conversation context to determine test structure:

### ViewModel Analysis

From conversation context, the skill identifies:

ViewModels to test (from prior discussion or codebase)
Localization requirements (@LocalizedString properties)
Child ViewModels (embedded within parent)
Substitution behavior (@LocalizedSubs needing specific verification)

### YAML Coverage Check

Verifies completeness:

ViewModel YAML entries (all @LocalizedString properties)
Child ViewModel entries (nested types)
Locale coverage (en, es, or project-specific locales)

### Test File Generation

Creates test suite with:

LocalizableTestCase conformance
Localization store initialization
expectFullViewModelTests() calls for each ViewModel
Optional specific formatting tests (substitutions, compound strings)

### Context Sources

Skill references information from:

Prior conversation: ViewModels discussed or recently created
ViewModel code: If Claude has read ViewModel files into context
YAML files: From codebase analysis of existing localizations
Test patterns: From existing test files in project

### File Templates

See reference.md for complete file templates.

### Testing a Single Top-Level ViewModel

@Test func dashboardViewModel() throws {
    try expectFullViewModelTests(DashboardViewModel.self)
}

### Testing Multiple Related ViewModels

@Test func boardViewModels() throws {
    try expectFullViewModelTests(BoardViewModel.self)
    try expectFullViewModelTests(ColumnViewModel.self)
    try expectFullViewModelTests(CardViewModel.self)
}

### Testing with Custom Locales

var locales: Set<Locale> { [en, es, enGB] }  // Override default

@Test func multiLocaleViewModel() throws {
    try expectFullViewModelTests(MyViewModel.self)
    // Tests en, es, AND en-GB
}

### Testing Substitution Behavior

@Test func greetingSubstitutions() throws {
    try expectFullViewModelTests(GreetingViewModel.self)

    let vm: GreetingViewModel = try .stub(userName: "Alice")
        .toJSON(encoder: encoder(locale: en))
        .fromJSON()

    #expect(try vm.welcomeMessage.localizedString == "Welcome, Alice!")
}

### Testing Embedded ViewModels

@Test func parentWithChildren() throws {
    // Tests parent AND verifies children can be encoded/decoded
    try expectFullViewModelTests(ParentViewModel.self)

    // Optionally verify specific child values
    let vm: ParentViewModel = try .stub()
        .toJSON(encoder: encoder(locale: en))
        .fromJSON()

    #expect(try vm.children[0].label.localizedString == "Child 1")
}

### "Missing Translation" Error

FOSLocalizableError: _pageTitle -- Missing Translation -- en

Cause: YAML entry missing for a @LocalizedString property.

Fix: Add the property to the YAML file:

en:
  MyViewModel:
    pageTitle: "Page Title"  # Add this

### "Is pending localization" Error

Cause: The ViewModel wasn't encoded with a localizing encoder.

Fix: Ensure using encoder(locale:) or expectFullViewModelTests().

### Test Passes But Translations Seem Wrong

Cause: YAML values exist but may have typos or wrong content.

Fix: Add specific assertions to verify exact values:

let vm = try .stub().toJSON(encoder: encoder(locale: en)).fromJSON()
#expect(try vm.title.localizedString == "Expected Value")

### Naming Conventions

ConceptConventionExampleTest suite{Feature}ViewModelTestsDashboardViewModelTestsTest file{Feature}ViewModelTests.swiftDashboardViewModelTests.swiftYAML file{ViewModelName}.ymlDashboardViewModel.ymlTest method{viewModelName}() or descriptivedashboardViewModel()

### See Also

FOSMVVMArchitecture.md - Testing Support - Architecture overview
fosmvvm-viewmodel-generator - For creating ViewModels
fosmvvm-fields-generator - For form validation testing
reference.md - Complete file templates

### Version History

VersionDateChanges1.02025-01-02Initial skill1.12026-01-19Updated LocalizableTestCase example to use {ViewModelsTarget}.resourceAccess pattern.1.22026-01-24Update to context-aware approach (remove file-parsing/Q&A). Skill references conversation context instead of asking questions or accepting file paths.
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: foscomputerservices
- Version: 2.0.6
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T03:12:33.038Z
- Expires at: 2026-05-10T03:12:33.038Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator)
- [Send to Agent page](https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent)
- [JSON manifest](https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/fosmvvm-viewmodel-test-generator/agent.md)
- [Download page](https://openagent3.xyz/downloads/fosmvvm-viewmodel-test-generator)