Bỏ qua tới nội dung
TakoAPI
Quay lại kỹ năng

fosmvvm-fields-generator

bởi foscomputerservices

Communication
415Lượt tải do clawskills.sh công bố
2Sao
0Lượt xem
0 lượt thíchĐăng nhập để thích kỹ năng này
—Chưa có đánh giá
Đánh giá của bạn

Tóm tắt

Generate FOSMVVM Fields protocols with validation rules, FormField definitions, and localized messages.

Mô tả

Kỹ năng này làm gì

Generates the three files that make up a FOSMVVM Form Specification: a Swift protocol with FormField definitions and validation methods, a messages struct with localized string properties, and a YAML localization file. The generated protocol becomes the single source of truth for a form's fields, constraints, and messages, adopted by request bodies, ViewModels, and persistence models alike.

Defining the protocol once and having request bodies, ViewModels, and database models all adopt it eliminates the drift that occurs when validation logic is duplicated across layers.

Khi nào nên dùng

  • Defining validation rules for a new user registration form
  • Adding field contracts to a Fluent DataModel before wiring up the database
  • Generating localization YAML for a settings edit screen
  • Creating a typed login credentials protocol shared between client and server
  • Scaffolding a search or filter form with keyboard semantics and autofill hints

Quy trình ví dụ

ĐẦU VÀO

User asks: generate fields for an idea creation form with a title and a content body

AGENT
  1. 1

    Identifies form purpose as create, entity as Idea, protocol name as CreateIdeaFields

  2. 2

    Designs two fields: titleField (text, required, length-constrained) and contentField (textArea, required, length-constrained)

  3. 3

    Generates CreateIdeaFields.swift with protocol definition, FormField statics, and validate methods

  4. 4

    Generates CreateIdeaFieldsMessages.swift with @FieldValidationModel struct and @LocalizedString properties

  5. 5

    Generates CreateIdeaFieldsMessages.yml with English titles, placeholders, and validation error strings

ĐẦU RA

Three files placed under Sources/{ViewModelsTarget}/FieldModels/ and Sources/{ResourcesPath}/FieldModels/ covering the full form contract

Cài đặt

clawhub install foscomputerservices/fosmvvm-fields-generator

Chạy lệnh CLI, hoặc dán prompt vào Claude Code, Cursor, Codex hay coding agent bạn đang dùng.

Liên kết