Blazor page view entity

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

Blazor page view entity is an AI agent skill from the GitHub repository IntentArchitect/Intent.Modules.NET. Implements Blazor read-only view entity pages using MudBlazor layout, preserving existing .razor.cs data loading, service, and navigation behavior while rendering a structured non-editable detail view. Use when creating or implementing view, detail, inspect, or read-only display entity pages in Blaz

How to use this skill

Skill file

MANDATORY: Read Samples Before Implementation

STOP — you MUST read ALL of the following before writing ANY code:

Samples (in the SAME folder as this SKILL.md):

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

Target component and project files:

  1. The target .razor and .razor.cs
  2. Related project files: DTOs, enums

Design and styling context (search the project — these are NOT in the SKILL.md folder):

  1. design.md — search for this file anywhere in the project; read it in full if found; if absent, note the absence and continue without design context
  2. ux-tokens.css, ux-base.css, ux-components.css — read from the project's wwwroot folder if present; note any that are absent

If any sample file (items 1–2) 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.

If items 5–6 are not found: note the absence and continue — they are reference context, not blocking.


MANDATORY: Match Sample Layout (Visual Structure)

When a sample exists, you MUST match the sample's visual structure, not only its data-loading behavior.

Required process:

  1. Reuse the sample's top-level component layout (hero header + main card) unless the user explicitly requests otherwise.
  2. If the sample uses shared utility classes (e.g. ux-gradient-primary, ux-fade-in-up), verify they exist by grepping for the class name as a substring (e.g. ux-gradient-primary) across all CSS files under wwwroot (including ux-tokens.css, ux-base.css, and ux-components.css). CSS utility classes are often defined as compound selectors (e.g. .mud-paper.ux-gradient-primary), so search for the class name alone, not the full selector. If the class name appears anywhere in any CSS file, it exists and must be used.

Required baseline layout (when supported by the target app):

Forbidden:


Preserve Existing Implementation

Use for: Read-only view or detail entity pages in Blazor with MudBlazor

Do NOT use for: Add or edit forms, search pages, dialogs, or non-Blazor projects

Source of truth: Existing .razor.cs file defines data loading, service calls, navigation, and the DTO structure

You MUST NOT:


1. Data Loading

Load data through existing lifecycle methods and backing methods such as OnInitializedAsync(), OnParametersSetAsync(), or explicit load methods already present in .razor.cs.

Show a loading indicator while the data object is null, using the same pattern as the sample (MudProgressCircular inside a centered MudStack).

Do not display entity content until the data object is non-null.


2. Map DTO Properties to Read-Only Display

Render all scalar DTO properties as labeled read-only fields using MudText:

| Property Type | Display |

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

| String / number | MudText Typo="Typo.body1" with MudText Typo="Typo.overline" label above |

| Boolean / status | MudChip with conditional Color and Variant |

| Enum | Resolved display label (not raw integer) in MudChip or MudText |

| Nullable object | Conditional section rendered only when non-null |

| Collection | Iterated with @foreach, each item in a MudPaper card |

Chip rules:

Enum rules:


3. Nullable Object Sections

Render optional nested objects inside an @if guard matching the existing null check in the backing class.

Do not render nested fields outside their guard block.


4. Child Collections

Render child collections with @foreach inside a guarded @if block.


5. Navigation Actions

Render navigation buttons at the bottom of the card in a right-aligned MudStack:

Button placement:


6. Styling

Design and styling context

Apply the design token and CSS utility context from the files you read in the mandatory phase. Use var(--token) for all inline Style= attributes — never hardcode hex values. Verify utility classes (e.g. ux-fade-in-up, ux-gradient-primary) exist before applying. The design context informs styling choices only — it does not override 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.