Blazor page adding entity

From IntentArchitect/Intent.Modules.NET · View interactive version

Blazor page adding entity is an AI agent skill from the GitHub repository IntentArchitect/Intent.Modules.NET. Creates Blazor add or create entity pages using MudBlazor forms, preserving existing .razor.cs service and navigation behavior while wiring a valid save flow and model-bound UI. Use when implementing add, create, new, insert, or register entity pages in Blazor.

How to use this skill

Skill file

MANDATORY: Read Samples Before Implementation

STOP - You MUST read ALL sample files in the SAME folder as this SKILL.md before writing ANY code:

  1. add-entity-sample.razor
  2. add-entity-sample.razor.cs

Then read the target component .razor, .razor.cs, and related project files such as models, enums, lookups, services, and shared styles.

If any sample file cannot be accessed: stop immediately, confirm the SKILL.md folder location, retry from that location, and if still inaccessible report which file is missing. Do not proceed with partial implementation or approximation.


Preserve Existing Implementation

Use for: Add or create entity pages in Blazor with MudBlazor

Do NOT use for: Search or list pages, edit forms, dialogs, or non-Blazor projects

Source of truth: Existing .razor.cs file defines service calls, navigation, model structure, and save flow

You MUST NOT:


1. Form: Build From Existing Model Only

Bind inputs only to properties that already exist on model.

Nullable objects:


2. Map Properties to MudBlazor Controls

| Property Type | Control |

|---------------|---------|

| String | MudTextField or MudTextField Lines="..." |

| Boolean | MudSwitch or MudCheckBox |

| Enum | MudSelect with explicit numeric values |

| Lookup | MudSelect using real service-loaded options only |

| Array | Repeatable MudBlazor blocks |

Enum rules:

  1. Locate the enum definition from imports or project search
  2. Read the enum file and verify exact member names and values
  3. Use only verified enum members
  4. For MudSelect, prefer numeric values with explicit casts such as Value="@((int)AddressType.Delivery)"
  5. Never invent enum members from samples

For MudBlazor generic controls such as MudSelect, declare T explicitly when required.


3. Form Validation

Use valid Blazor form patterns with EditForm and the component's existing validation conventions.

Required fields must have:

Save button state:


4. Save Flow

The Save button must call an existing save orchestration method such as Save() or SaveAsync().

That save flow must:

  1. Validate before saving
  2. Call the existing backend method without modifying it
  3. Navigate on success using an existing navigation method when one exists

Forbidden:


5. Child Collections

Render child collections in repeatable MudBlazor UI blocks.

Buttons:

For for loops:


6. Styling

Design context (if design.md is present)

If a design.md file exists in the project, read it before choosing MudBlazor component properties. Use it for:

design.md informs prop choices only — it does not override the sample's layout structure.


Definition of Done

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.