← 返回 Skills 市场
foscomputerservices

FOSMVVM Fields Generator

作者 David Hunt · GitHub ↗ · v2.0.6
darwinlinux ✓ 安全检测通过
626
总下载
2
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install fosmvvm-fields-generator
功能描述
Generate FOSMVVM Fields protocols defining form fields, input types, validation rules, and localized messages for consistent, reusable form specifications.
使用说明 (SKILL.md)

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\x3CString?> { .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.
安全使用建议
This skill is an instruction-only code/template generator for Swift (FOSMVVM) form specifications and is internally consistent. Before use: (1) Provide explicit form field requirements in the conversation so the generator doesn't guess; (2) review all generated Swift/YAML output before committing to your repository (ensure imports like FOSFoundation/FOSMVVM match your project and licensing); (3) place the localization YAML and Swift files in the project locations you control; (4) be aware the agent uses conversation context to produce output — limit prompts to the minimum required data to avoid accidental inclusion of unrelated sensitive information. No credentials or installs are required, so there are no hidden exfiltration vectors in the skill itself.
功能分析
Type: OpenClaw Skill Name: fosmvvm-fields-generator Version: 2.0.6 The skill 'fosmvvm-fields-generator' is designed to generate Swift code and YAML files for FOSMVVM form specifications, including validation rules and localization. The `SKILL.md` and `reference.md` files provide detailed instructions and templates for this code generation process. There is no evidence of data exfiltration, malicious execution, persistence mechanisms, or prompt injection attempts against the OpenClaw agent. The content is purely descriptive and focused on its stated purpose of generating application-level code, aligning with a benign classification.
能力评估
Purpose & Capability
Name and description match the observed behavior: SKILL.md and reference templates produce Swift protocols, localized message structs, and YAML files for form specifications. The skill does not request unrelated credentials, binaries, or config paths.
Instruction Scope
Instructions rely on conversation context to infer form fields and generate code templates. This is expected for a generator, but the phrasing ('references conversation context automatically—no file paths or Q&A needed') is broad and gives the agent discretion; to avoid accidental guesses, provide explicit field requirements in the conversation or supply spec files into the agent context before invoking.
Install Mechanism
No install spec and no code files are included (instruction-only). Nothing is downloaded or written by the skill itself — generation happens as textual output, which is low-risk.
Credentials
The skill declares no required environment variables, no credentials, and no config paths. The templates reference project placeholders (targets, resource paths) which are expected for code generation.
Persistence & Privilege
Flags show default behavior (always:false, model invocation allowed). The skill does not request permanent presence or system-level changes and does not modify other skills or system settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install fosmvvm-fields-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /fosmvvm-fields-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.6
Initial ClawHub release
元数据
Slug fosmvvm-fields-generator
版本 2.0.6
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

FOSMVVM Fields Generator 是什么?

Generate FOSMVVM Fields protocols defining form fields, input types, validation rules, and localized messages for consistent, reusable form specifications. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 626 次。

如何安装 FOSMVVM Fields Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install fosmvvm-fields-generator」即可一键安装,无需额外配置。

FOSMVVM Fields Generator 是免费的吗?

是的,FOSMVVM Fields Generator 完全免费(开源免费),可自由下载、安装和使用。

FOSMVVM Fields Generator 支持哪些平台?

FOSMVVM Fields Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(darwin, linux)。

谁开发了 FOSMVVM Fields Generator?

由 David Hunt(@foscomputerservices)开发并维护,当前版本 v2.0.6。

💬 留言讨论