FOSMVVM Fields Generator

VerifiedSafe

Generate FOSMVVM Fields protocols with validation rules, FormField definitions, and localized messages. Define form contracts once and validate everywhere, ensuring consistent validation across client and server.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#fosmvvm#fields-generation#validation#localization#ios

Recommended for

Automated summary

Generates complete FOSMVVM Fields protocols with validation rules, FormField definitions, and localized messages for iOS forms.

Strengths

  • Defines a single source of truth for forms, used across client and server
  • Integrates validation, localization, and network transmission automatically
  • Reduces code duplication and ensures consistent constraints

Limitations

  • Requires solid understanding of the FOSMVVM architecture
  • Depends on specific project structure (targets, resource paths)
  • Only works with Swift projects using FOSMVVM
When to use it

When defining a new form (create, edit, filter) or adding validation to a request body.

When not to use it

For simple forms without validation or localization, or in projects not using the FOSMVVM architecture.

Security analysis

Safe
Quality score90/100

This skill generates Swift code and YAML localization files based on conversation context; it does not execute any commands or access external resources, posing no security risk.

No concerns found

How this analysis is made

Examples

Generate form fields for a new idea
/fosmvvm-fields-generator
Generate fields for login form
Generate FOSMVVM Fields for a login form with email and password fields requiring validation and localization.

name: fosmvvm-fields-generator description: Generate FOSMVVM Fields protocols with validation rules, FormField definitions, and localized messages. Define form contracts once, validate everywhere. homepage: https://github.com/foscomputerservices/FOSUtilities metadata: {"clawdbot": {"emoji": "📋", "os": ["darwin", "linux"]}}

FOSMVVM Fields Generator

Generate Form Specifications following FOSMVVM patterns.

Conceptual Foundation

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

A Form Specification (implemented as a {Name}Fields protocol) is the single source of truth for user input. It answers:

  1. What data can the user provide? (properties)
  2. How should it be presented? (FormField with type, keyboard, autofill semantics)
  3. What constraints apply? (validation rules)
  4. What messages should be shown? (localized titles, placeholders, errors)

Why This Matters

The Form Specification is defined once, used everywhere:

// Same protocol adopted by different consumers:
struct CreateIdeaRequestBody: ServerRequestBody, IdeaFields { ... }  // HTTP transmission
@ViewModel struct IdeaFormViewModel: IdeaFields { ... }              // Form rendering
final class Idea: Model, IdeaFields { ... }                          // Persistence validation

This ensures:

  • Consistent validation - Same rules on client and server
  • Shared localization - One YAML file, used everywhere
  • Single source of truth - Change once, applies everywhere

Connection to FOSMVVM

Form Specifications integrate with:

  • Localization System - FormField titles/placeholders and validation messages use LocalizableString
  • Validation System - Implements ValidatableModel protocol
  • Request System - RequestBody types adopt Fields for validated transmission
  • ViewModel System - ViewModels adopt Fields for form rendering

When to Use This Skill

  • Defining a new form (create, edit, filter, search)
  • Adding validation to a request body
  • Any type that needs to conform to ValidatableModel
  • When fosmvvm-fluent-datamodel-generator needs form fields for a DataModel

What This Skill Generates

A complete Form Specification consists of 3 files:

| File | Purpose | |------|---------| | {Name}Fields.swift | Protocol + FormField definitions + validation methods | | {Name}FieldsMessages.swift | @FieldValidationModel struct with @LocalizedString properties | | {Name}FieldsMessages.yml | YAML localization (titles, placeholders, error messages) |

Project Structure Configuration

Replace placeholders with your project's actual paths:

| Placeholder | Description | Example | |-------------|-------------|---------| | {ViewModelsTarget} | Shared ViewModels SPM target | ViewModels, SharedViewModels | | {ResourcesPath} | Localization resources path | Sources/Resources |

Expected Structure:

Sources/
  {ViewModelsTarget}/
    FieldModels/
      {Name}Fields.swift
      {Name}FieldsMessages.swift
  {ResourcesPath}/
    FieldModels/
      {Name}FieldsMessages.yml

How to Use This Skill

Invocation: /fosmvvm-fields-generator

Prerequisites:

  • Form purpose understood from conversation context
  • Field requirements discussed (names, types, constraints)
  • Entity relationship identified (what is this form creating/editing)

Workflow integration: This skill is used when defining form validation and user input contracts. The skill references conversation context automatically—no file paths or Q&A needed. Often precedes fosmvvm-fluent-datamodel-generator for form-backed models.

Pattern Implementation

This skill references conversation context to determine Fields protocol structure:

Form Analysis

From conversation context, the skill identifies:

  • Form purpose (create, edit, filter, login, settings)
  • Entity relation (User, Idea, Document - what's being created/edited)
  • Protocol naming (CreateIdeaFields, UpdateProfile, LoginCredentials)

Field Design

For each field from requirements:

  • Property specification (name, type, optional vs required)
  • Presentation type (FormFieldType: text, textArea, select, checkbox)
  • Input semantics (FormInputType: email, password, tel, date)
  • Constraints (required, length range, value range, date range)
  • Localization (title, placeholder, validation error messages)

File Generation Order

  1. Fields protocol with FormField definitions and validation
  2. FieldsMessages struct with @LocalizedString properties
  3. FieldsMessages YAML with localized strings

Context Sources

Skill references information from:

  • Prior conversation: Form requirements, field specifications discussed
  • Specification files: If Claude has read form specs into context
  • Existing patterns: From codebase analysis of similar Fields protocols

Key Patterns

Protocol Structure

public protocol {Name}Fields: ValidatableModel, Codable, Sendable {
    var fieldName: FieldType { get set }
    var {name}ValidationMessages: {Name}FieldsMessages { get }
}

FormField Definition

static var contentField: FormField<String?> { .init(
    fieldId: .init(id: "content"),
    title: .localized(for: {Name}FieldsMessages.self, propertyName: "content", messageKey: "title"),
    placeholder: .localized(for: {Name}FieldsMessages.self, propertyName: "content", messageKey: "placeholder"),
    type: .textArea(inputType: .text),
    options: [
        .required(value: true)
    ] + FormInputOption.rangeLength(contentRange)
) }

FormField Types Reference

| FormFieldType | Use Case | |---------------|----------| | .text(inputType:) | Single-line input | | .textArea(inputType:) | Multi-line input | | .checkbox | Boolean toggle | | .select | Dropdown selection | | .colorPicker | Color selection |

FormInputType Reference (common ones)

| FormInputType | Keyboard/Autofill | |---------------|-------------------| | .text | Default keyboard | | .emailAddress | Email keyboard, email autofill | | .password | Secure entry | | .tel | Phone keyboard | | .url | URL keyboard | | .date, .datetimeLocal | Date picker | | .givenName, .familyName | Name autofill |

Validation Method Pattern

internal func validateContent(_ fields: [FormFieldBase]?) -> [ValidationResult]? {
    guard fields == nil || (fields?.contains(Self.contentField) == true) else {
        return nil
    }

    var result = [ValidationResult]()

    if content.isEmpty {
        result.append(.init(
            status: .error,
            field: Self.contentField,
            message: {name}ValidationMessages.contentRequiredMessage
        ))
    } else if !Self.contentRange.contains(NSString(string: content).length) {
        result.append(.init(
            status: .error,
            field: Self.contentField,
            message: {name}ValidationMessages.contentOutOfRangeMessage
        ))
    }

    return result.isEmpty ? nil : result
}

Messages Struct Pattern

@FieldValidationModel public struct {Name}FieldsMessages {
    @LocalizedString("content", messageGroup: "validationMessages", messageKey: "required")
    public var contentRequiredMessage

    @LocalizedString("content", messageGroup: "validationMessages", messageKey: "outOfRange")
    public var contentOutOfRangeMessage
}

YAML Structure

en:
  {Name}FieldsMessages:
    content:
      title: "Content"
      placeholder: "Enter your content..."
      validationMessages:
        required: "Content is required"
        outOfRange: "Content must be between 1 and 10,000 characters"

Naming Conventions

| Concept | Convention | Example | |---------|------------|---------| | Protocol | {Name}Fields | IdeaFields, CreateIdeaFields | | Messages struct | {Name}FieldsMessages | IdeaFieldsMessages | | Messages property | {name}ValidationMessages | ideaValidationMessages | | Field definition | {fieldName}Field | contentField | | Range constant | {fieldName}Range | contentRange | | Validate method | validate{FieldName} | validateContent | | Required message | {fieldName}RequiredMessage | contentRequiredMessage | | OutOfRange message | {fieldName}OutOfRangeMessage | contentOutOfRangeMessage |

See Also

Version History

| Version | Date | Changes | |---------|------|---------| | 1.0 | 2024-12-24 | Initial skill | | 2.0 | 2024-12-26 | Rewritten with conceptual foundation; generalized from Kairos-specific | | 2.1 | 2026-01-24 | Update to context-aware approach (remove file-parsing/Q&A). Skill references conversation context instead of asking questions or accepting file paths. |

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/fosmvvm-fields-generator-mm5t89xs' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/fosmvvm-fields-generator-mm5t89xs/download' --output '.skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md.part' && mv '.skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md.part' '.skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md' && test -s '.skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/fosmvvm-fields-generator' && cp -R '.skill-downloads/fosmvvm-fields-generator-mm5t89xs' '.claude/skills/fosmvvm-fields-generator'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/fosmvvm-fields-generator-mm5t89xs'

openskills read 'fosmvvm-fields-generator-mm5t89xs'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/fosmvvm-fields-generator-mm5t89xs/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills