Purpose
Every Blazor project generated by this solution's Intent Architect module has a MainLayout.razor that is intentionally thin — it just composes <MainLayoutHeader/>, <MainLayoutSider/>, @Body (plus <MainLayoutFooter/> when a Footer is modeled), inside whatever provider/wrapper markup (e.g. <MudLayout>, <MudMainContent>) the first scaffold generation used. The actual menu content lives as literal, hand-authored markup inside those component files, plus (when a Profile Menu element is modeled) a Profile menu component composed into the Header. There is deliberately no shared nav-item data model — never a NavItem/AppNav list feeding a generic loop.
MainLayout.razor itself, MainLayoutHeader.razor, MainLayoutSider.razor, MainLayoutFooter.razor, and (when modeled) the Profile menu file are each scaffolded exactly once by Software Factory (OverwriteDisabled) — MainLayout.razor fully composed from whichever of Header/Sider/Footer/Profile exist at that time, the others with placeholder/minimal content only (Software Factory no longer sorts Navigation Target Ends into per-region content itself — that resolution is this skill's job, see Step 2). After that first generation, keeping MainLayoutHeader.razor/MainLayoutSider.razor/MainLayoutFooter.razor/the Profile file's literal markup in sync with navigation changes, and keeping MainLayout.razor's Header/Sider/Footer component references in sync as those regions are added, removed, or created by this skill, is entirely this skill's job.
This skill turns a menu description — either free-text prose, or the consolidated Navigation Target End context (route, roles/policies, and each item's verbatim placement comment) Software Factory attaches to MainLayout.razor — into that literal markup, correctly gated by <AuthorizeView> when (and only when) the target project actually has authentication.
MANDATORY: Read Before Making Any Change
STOP — you MUST read all of the following before writing anything:
- _Samples_* (in the SAME folder as this SKILL.md):
app-main-layout-sample.razor— MainLayout's own region-component composition (Header/Sider/conditional Footer/@Body), relevant whenever you're reconciling that file per Step 7app-sider-noauth-sample.razor— Sider with no auth gatingapp-sider-auth-sample.razor— Sider with a mix of gated and ungated itemsapp-header-auth-sample.razor— Header with a gated nav item plus the unconditional Profile-component compositionapp-user-menu-auth-sample.razor— the real Auth Profile menu: modeled Profile-region items plus the fixed Login/Register-vs-Manage/Logout split that lives INSIDE this file (not the Header), relevant whenever you're populating that file per Step 6
- _Target project files:_*
Components/Layout/MainLayout.razor(+.razor.cs) — read its current region-component composition before touching anything else (see Step 7). Its attached AI context is now the single, consolidated list of every Navigation Target End modeled against this Layout (route, roles/policies, and each item's verbatim placement comment) — it is NOT pre-split per region. None of the region files below carry their own AI context any more; you resolve region placement yourself (Step 2) from this one list before populating any of them. That same AI context also states plainly whether theming is enabled or disabled for this Layout — read that fact alongside the navigation list, before Step 4 (it determines whetherMainLayoutHeader.razorshould carry a<ThemeToggle />).Components/Layout/MainLayoutHeader.razor(+.razor.cs)Components/Layout/MainLayoutSider.razor(+.razor.cs)Components/Layout/MainLayoutFooter.razor(+.razor.cs) — only exists if a Footer was modeled, or this skill previously created it (see the create-if-needed rule above)- The Profile menu file — only exists if MainLayout has a modeled Profile Menu child element, or this skill previously created it (see the create-if-needed rule above); the actual filename is
{Layout name}{Profile Menu element name}.razor(commonlyMainLayoutProfile.razor). Path varies:Components/Layout/(NoAuth, or WASM NoAuth after path unification),Components/Account/Shared/(Server Auth), orLayout/in the.Clientproject (WASM Auth — kept separate fromComponents/Layouton purpose, see "WASM Auth specifics" below) Program.cs(and, for a hosted WASM Auth project, the host project'sProgram.cstoo)
Do not proceed with a partial read. Any of items 2–5 may be missing for this project — modeling Header/Sider/Footer/Profile ahead of time is optional, and this skill does not require it. A missing file is only a problem once Step 2 resolves an item's placement comment to that specific canonical region (Header, Sider, Footer, or Profile): when that happens, CREATE the missing .razor file (and its trivial .razor.cs code-behind) yourself — matching the filename/namespace conventions of MainLayout.razor(.cs) and, where another region file already exists in this project, that sibling's conventions too — then populate it exactly as Steps 3–6 already do for an existing file, taking its fixed structural chrome verbatim from the matching sample (never improvised). Only fall back instead of creating when an item's placement comment doesn't resolve to any of the four canonical regions at all (see Step 2's "Region resolution"). Not all of the target files will be present for every solution before you start — some may remain absent throughout (e.g. no footer or profile content was ever described) and that's fine.
There is no ManageLayout.razor nav duplicate to maintain in current-generation projects — post-login "Manage" pages render inside the normal MainLayout/Sider like any other page, there is no separate static-SSR account layout with its own nav copy. If an older project still has a legacy ManageLayout.razor with its own <aside> nav block, treat it like any other file the context doesn't mention: leave it alone unless the user explicitly asks about it.
Step 1 — Detect the Project's Shape
Before touching any markup, determine two independent facts by inspecting Program.cs:
| Fact | How to tell | Why it matters |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Auth capability | Does Program.cs call AddAuthorizationCore() / AddAuthorization() and AddCascadingAuthenticationState()? | If NO: this is a NoAuth project. <AuthorizeView> has no cascading auth state to consume and must never be introduced. If YES: this is an Auth project and <AuthorizeView> is safe anywhere. |
| Hosting model | Is there a separate .Client project referenced by a host project (ProjectReference + AddInteractiveWebAssemblyComponents), or is it a single project? | Hosted WASM Auth has real account/menu content split across host (static-SSR) and .Client (interactive) — see "WASM Auth specifics" below. Blazor Server and standalone WASM don't have this split. |
Never infer auth capability from the project's _name_ (e.g. don't assume "NoAuth" in a folder name means no auth, or vice versa) — always verify against Program.cs, since this skill may be run against a renamed or copied project.
Step 2 — Parse the Menu Description Into Items
The context you are given is the single source of truth.
Rules:
- Generate menu items ONLY from the provided context (free-text menu description) or from the modeled
Navigation Target Endcontext attached toMainLayout.razor. - The sample files in this folder are structural/layout examples only. They demonstrate _how_ to render items, not _which_ items must exist.
- Do not invent or preserve "standard" items by convention (including account/auth items) unless they are present in the context for the region you are populating.
The context you're given will be prose, not a formal schema, along the lines of:
"The sider menu consists of the following:
- a navigation link to the product list page with route
/product-list
- a navigation link to the order list page with route
/order-listwhich requires rolesAdminorWrite"
For each described link, extract:
| Field | How to extract | Default if unstated |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Label | The page/entity name mentioned (title-case it: "product list" → "Product List") | Required — ask if truly ambiguous |
| Href | The literal route given (e.g. ` /product-list `) | Required |
| Region | The item's own placement comment, matched against the closed vocabulary Header/Sider/Footer/Profile (e.g. "sider"/"side menu" → Sider, "footer" → Footer, "profile"/"account menu" → Profile) — see "Region resolution" below | Profile if judged profile/account/auth-related, else Sider — see "Region resolution" |
| Icon | Only if explicitly described (e.g. "with a home icon") — map to the closest Icons.Material.Filled.* member | None — omit the Icon attribute entirely rather than guessing |
| Authorization | Phrases like "requires roles X or Y", "requires policy X", "for logged-in users only" / "requires authentication" | None (item renders unconditionally) |
- _Model-derived invocation:_* when this skill runs because a
Navigation Target Endchanged rather than because of a typed request, the item list isn't prose you're handed directly — it's the AI Context Software Factory attaches toMainLayout.razor(not to the region files — see "MANDATORY" above), in the exact same "a navigation link to the X with route 'Y' [with required role(s)/policies...] (placement comment: "...")" phrasing as the example above, covering every Navigation Target End on the Layout, unsorted by region. Parse each item with the identical rules in the table above, then resolve its Region yourself from its placement comment — see "Region resolution" immediately below. There is noRegionsstereotype any more; the comment is the only placement signal.
Region resolution (CRITICAL)
Software Factory no longer pre-sorts items into region files — MainLayout.razor's attached context is the same full list regardless of which region file you're about to populate. Before extracting Label/Href/Icon/Authorization for a given file (e.g. MainLayoutSider.razor), you must first resolve which of the items in that full list actually belong there:
- Match each item's placement comment against the closed vocabulary Header / Sider / Footer / Profile (synonyms like "side menu" → Sider, "top nav"/"app bar" → Header, "account menu" → Profile are fine — use judgement, but the resolved value must be one of the four).
- No comment, or a comment that doesn't mention a region at all → use judgement, not a fixed keyword list: look at the item's Label and its route/folder location to decide whether it's most likely a profile/account/auth-related screen (illustrative, non-exhaustive examples: "My Profile", "Change Password", "Two-Factor Setup", "Manage Account"). If so → Profile. Otherwise → Sider, the same default as before.
- A comment resolves to one of the four canonical regions but that region's file doesn't exist yet for this project (e.g. resolves to Header but there is no
MainLayoutHeader.razor) → create it (see the "MANDATORY" section above and Steps 3–6's create-vs-populate rules), then populate it normally. This is expected, not a fallback. - A comment's placement text doesn't resolve to any of the four canonical regions at all (unrecognized or genuinely ambiguous wording) → there is no canonical region to create a file for; fall back to the nearest existing menu-surface file (Sider if genuinely ambiguous), place the item there instead, and state plainly in your final response which item this happened to and why. This is the only case where an item's rendered location may differ from its literal comment text.
- Only items resolved to a given file's region belong in that file — an item that resolves elsewhere is simply not rendered into this file (it belongs, or falls back, to a different one).
Authorization phrase mapping:
- "requires roles
AorB" → gate withRoles="A,B"(comma-joined, see Step 4 —AuthorizeView.Rolesis a single comma-delimited string, not a collection) - "requires policy
X" → gate withPolicy="X" - "for logged-in users" / "requires authentication" / "requires login" with no roles/policy → gate with a bare
<AuthorizeView>(noRoles/Policyattribute — matches any authenticated user) - No authorization language at all → do not wrap the item in anything
If the target project is NoAuth (per Step 1) and the context nonetheless describes a role/policy/login requirement for an item: render the item unconditionally anyway (there is no auth infrastructure to gate it with) and say so plainly in your response — do not silently drop the item, and do not add AddAuthorizationCore/AddCascadingAuthenticationState to Program.cs to make the gating "work". That is a much bigger change than a menu edit and is out of scope for this skill.
Step 3 — Populate `MainLayoutSider.razor`
Follow app-sider-noauth-sample.razor or app-sider-auth-sample.razor depending on Step 1's result.
Rules:
- Preserve the outer
<nav class="ux-nav-drawer">wrapper and the single<MudNavMenu>inside it exactly — do not reintroduce a<MudDrawer Open="DrawerOpen" OpenChanged="DrawerOpenChanged" ...>wrapper or anyDrawerOpen/DrawerOpenChangedbinding; that belonged to an older generation of this scaffold and no longer exists inMainLayout.razoror the code-behind. This applies identically when creatingMainLayoutSider.razorfrom scratch (per the MANDATORY section) — take the wrapper verbatim from the matching sample, never improvised. - Every item is a plain
<MudNavLink Href="..." [Icon="..."]>Label</MudNavLink>inside that single<MudNavMenu>. - The root/home link should get
Match="NavLinkMatch.All"(so it doesn't stay highlighted on every route); other links should omitMatchand take MudBlazor's default (Prefix). - Auth project, gated item: wrap only that
<MudNavLink>in<AuthorizeView Roles="..."> <Authorized> ... </Authorized> </AuthorizeView>(orPolicy="...", or bare<AuthorizeView>for "any authenticated user"). Do not add a<NotAuthorized>fragment — the item should render nothing when the viewer doesn't qualify, not an alternate message. - NoAuth project: never emit
<AuthorizeView>here at all, regardless of what the context says (see Step 2's fallback). - Preserve any items already present in the file that the new context doesn't mention, unless the user's instructions say to replace the whole menu — treat this as an additive edit by default.
Region source-of-truth and "mandatory" sync (CRITICAL)
This skill must be region-scoped: a nav item may only be generated into a given region/menu when its placement comment resolves to that region (per Step 2's "Region resolution").
Rules:
- Treat each region/menu (
Header,Sider,Footer,Profile) as a separate, independent output. - Only generate/ensure items for this region (Sider) when the item's comment resolves to Sider — explicitly, via the no-comment default, or via the missing-file fallback (Step 2).
- Never infer region placement from the existing code (e.g. "the header already has links") and never mirror items across regions as a convention.
- Only prevent duplicates within the same region/menu; the same route may legitimately appear in multiple regions if (and only if) the item's comment explicitly places it in more than one.
Step 4 — Populate `MainLayoutHeader.razor`
Follow app-header-auth-sample.razor. Three independent concerns live in this file — do not conflate them:
- Fixed chrome — preserve exactly as-is, in both Auth and NoAuth projects: the drawer-toggle (
<span onclick="navDrawer.toggle()"><MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" /></span>), the brandMudButton, andMudSpacer. None of these carryOnClick/OnToggleEventCallbackparameters in the current scaffold — do not add any; the drawer opens vianavDrawer.toggle()JS interop, with no code-behind wiring inMainLayoutHeader.razor.cs. This chrome applies identically when creatingMainLayoutHeader.razorfrom scratch (per the MANDATORY section) — copy it verbatim fromapp-header-auth-sample.razor, never improvised.
1a. <ThemeToggle /> — conditional on this Layout's theming context, not unconditional chrome: MainLayout.razor's attached AI context (see the MANDATORY section) states plainly whether theming is enabled or disabled for this Layout. Include a bare <ThemeToggle /> only when it's enabled; omit it entirely when disabled. Never add one to a no-theming project's header, and never remove one from a themed project's header. When present, it carries no OnClick/OnToggle wiring — it toggles internally, with no code-behind involvement.
- The Profile component slot — if the Profile menu file exists for this Layout (e.g.
MainLayoutProfile.razor, whether modeled or created directly by this skill — see the MANDATORY read above),MainLayoutHeader.razormust include an unconditional reference to it - Any Header-placed nav items the context describes: render as
<MudButton Href="..." Color="Color.Inherit">Label</MudButton>(MudAppBar is not aMudNavMenu, soMudNavLinkdoesn't fit here), positioned between the brand button and<MudSpacer />. Gate exactly like a Sider item (Step 3'sAuthorizeViewrules), in a NoAuth project never gate at all.
Region source-of-truth and "mandatory" sync (CRITICAL)
Only add/ensure header nav items whose placement comment resolves to Header (per Step 2's "Region resolution") — explicitly, or via the missing-file fallback.
Rules:
- If no item resolves to Header, do not add new header navigation buttons.
- Do not mirror Sider items into the Header by convention.
- Only prevent duplicates within the Header itself.
Step 5 — Populate `MainLayoutFooter.razor`
Only touch this file if the context explicitly describes footer content. Otherwise leave it as the empty placeholder — do not invent footer content. The scaffolded file's body may literally be the placeholder comment // Content to be generated (not real markup at all) until you populate it — that's expected on first read, not a sign something's broken. If MainLayoutFooter.razor doesn't exist yet and an item's placement comment resolves to Footer (per Step 2), create it (and its trivial .razor.cs code-behind, per the MANDATORY section) starting from that same essentially-empty state — there is no bundled sample for Footer, none is needed, since the deterministic scaffold itself is trivial. If footer items are described, apply the same per-item rules as Step 3 (plain links, AuthorizeView-gated only in Auth projects, only for items with a stated requirement), rendered as plain <a>/MudLink elements rather than MudNavLink (footers typically aren't route-highlighted navigation).
Region source-of-truth and "mandatory" sync (CRITICAL)
Only add/ensure footer items whose placement comment resolves to Footer (per Step 2's "Region resolution") — explicitly, or via the missing-file fallback.
Rules:
- If no item resolves to Footer, leave the footer unchanged.
- Do not mirror Sider/Header items into the Footer by convention.
- Only prevent duplicates within the Footer itself.
Step 6 — Populate the Profile Menu file (e.g. `MainLayoutProfile.razor`)
This file exists whenever a Profile Menu was modeled (visible alongside Header/Sider/Footer in the User Interface designer) or whenever this skill has created it directly (see the MANDATORY section) because an item's placement comment resolved to Profile — modeling it ahead of time is optional, not a prerequisite; if neither is true, there is no Profile menu and this step doesn't apply. When present, it's scaffolded exactly like Steps 3-5: a Razor file (named {Layout name}{Profile Menu element name}.razor, e.g. MainLayoutProfile.razor, colocated with the other layout files per the path rules in "MANDATORY" above) generated once with OverwriteDisabled (or, if this skill created it from scratch, started the same way), with a bare, self-closing <UserMenu /> placeholder as its only content — from then on you own filling it in. When creating it fresh, take the fixed <Trigger>/dropdown chrome verbatim from app-user-menu-auth-sample.razor, never improvised.
UserMenu is a shared presentational component shipped from the UI-component library (not auth-specific — it carries no auth knowledge itself): a circuit-free <details>-based dropdown taking a Title (string, defaults to "Account menu"), a Trigger render fragment (the closed-state icon/content), and a ChildContent render fragment (the dropdown's items). It works identically on static-SSR Account pages and interactive pages.
MANDATORY: Any generated <UserMenu> markup MUST include a <Trigger>...</Trigger> node (as shown in app-user-menu-auth-sample.razor). The trigger is not optional; without it the menu surface is incomplete and may render incorrectly.
This menu is populated from Navigation Target Ends whose placement comment resolves to Profile (Step 2). It's primarily meant for profile/account-related pages (e.g. "My Profile", "Settings"), but it can hold any navigable page the context/model assigns to it — apply the same Label/Href/Icon/Authorization extraction as Step 2.
- _NoAuth project_*: render ONLY what the context assigns to the Profile region. No
<AuthorizeView>anywhere in this file. If Profile currently has zero qualifying items, leave the scaffolded placeholder as-is — do not invent content. - _Auth project_*: render ONLY what the context assigns to the Profile region. If (and only if) the context includes auth-gated items, apply
<AuthorizeView>gating to those specific items.
Do not add Login/Register/Manage/Logout by default, even in Auth projects. Only add those if they are present in the provided context (or explicitly modeled into the Profile region).
If the existing Profile menu file already contains a fixed auth block (e.g. Login/Register vs Logout) from past runs, do not treat that as a requirement. Keep or remove it only if the user's current context requires it; otherwise preserve existing content and only add the explicitly described items.
<AuthorizeView>
<Authorized>
<UserMenu>
<Trigger>...</Trigger>
<ChildContent>
<MudStack Spacing="0">
<!-- one item per modeled Profile nav link -->
<!-- fixed Logout form, always last -->
</MudStack>
</ChildContent>
</UserMenu>
</Authorized>
</AuthorizeView>
<AuthorizeView>
<NotAuthorized>
<UserMenu Title="Account">
<Trigger>...</Trigger>
<ChildContent>
<MudStack Spacing="0">
<!-- fixed Login + Register buttons -->
</MudStack>
</ChildContent>
</UserMenu>
</NotAuthorized>
</AuthorizeView>
- Modeled Profile items go inside the first block's
ChildContent, one per item, following the project's existing item pattern (e.g.<MudButton Href="..." Variant="Variant.Text" Color="Color.Inherit" FullWidth="true">Label</MudButton>). Gate an individual item further with<AuthorizeView Roles="...">/Policy="..."only if that specific item's own context said so (nested inside the outerAuthorizedblock) — same Step 2 rules as Sider. If Profile currently has zero qualifying items, the Authorized block'sChildContentstill gets just the fixed Logout form below (never left completely empty in an Auth project). - The fixed Logout form — always the last entry in the Authorized block's
ChildContent, never gated further, never removed, never replaced with anOnClickhandler or client-side auth call:
<form method="post" action="/Account/Logout">
<AntiforgeryToken />
<input type="hidden" name="ReturnUrl" value="@ReturnUrl" />
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Text" Color="Color.Inherit" FullWidth="true">
Logout
</MudButton>
</form>
This requires a ReturnUrl code-behind member — if not already present, add to the file's @code block:
[CascadingParameter]
private HttpContext? HttpContext { get; set; }
private string? ReturnUrl => HttpContext is null ? null : $"{HttpContext.Request.Path}{HttpContext.Request.QueryString}";
- The fixed Login/Register block — always the entire content of the
NotAuthorizedblock'sUserMenu(Title="Account"), never gated further, never removed:
<MudButton Href="/Account/Login" Variant="Variant.Text" Color="Color.Inherit" FullWidth="true">Login</MudButton>
<MudButton Href="/Account/Register" Variant="Variant.Text" Color="Color.Inherit" FullWidth="true">Register</MudButton>
Region source-of-truth and "mandatory" sync (CRITICAL)
Only add/ensure items whose placement comment resolves to Profile (per Step 2's "Region resolution") — explicitly, or via the missing-file fallback.
Rules:
- If no item resolves to Profile, leave the file unchanged.
- Do not mirror Sider/Header/Footer items into the Profile menu by convention.
- Only prevent duplicates within the Profile menu itself.
- _WASM Auth specifics_*: in a hosted WASM Auth project, verify whether this Profile file is duplicated between the host project (static-SSR, used by the Account pages) and the
.Clientproject (interactive, used byMainLayout/MainLayoutHeader) — don't assume a fixed filename pair, confirm by locating both. If duplicated, keep both copies' modeled items in sync.
Step 7 — Sync `MainLayout.razor`'s Composition
MainLayout.razor is scaffolded exactly once by Software Factory (OverwriteDisabled), the same as Header/Sider/Footer/Profile — it used to be regenerated deterministically on every run (so a Sider/Footer being added or removed in the model was reflected automatically), but that's no longer the case. From the first generation onward, keeping it in sync as regions are added or removed is this skill's job too, exactly like Steps 3–6 own the other layout files.
This ownership is deliberately narrow — follow app-main-layout-sample.razor:
- Reconcile only which region components are referenced:
<MainLayoutHeader />,<MainLayoutSider />, and<MainLayoutFooter />. Nothing else in this file is this skill's concern. <MainLayoutHeader />and<MainLayoutSider />are core — they should always be present. Do not remove them.<MainLayoutFooter />is conditional on whetherMainLayoutFooter.razorexists for this Layout (per the MANDATORY read above):- File exists, reference missing → add
<MainLayoutFooter />as the last sibling inside the layout wrapper (see the sample). - File does not exist (no Footer modeled, or it was removed), reference present → remove the stale
<MainLayoutFooter />reference. - File exists and reference already present → leave it alone.
- Never add or remove a
<MainLayoutProfile />reference here — that belongs solely inMainLayoutHeader.razor(Step 4), never inMainLayout.razoritself. - Never touch anything else in the file: the provider components (e.g.
MudThemeProvider/MudDialogProvider/etc.), the layout wrapper (e.g.<MudLayout>,<MudMainContent>), its CSS classes, or where@Bodysits inside that wrapper — was decided by the first scaffold generation and is NOT this skill's concern. Preserve it exactly, whatever shape it happens to be in a given project (it may differ from the shape below). Do not rewrite, reorder, reformat, or "clean up" any of it. In particular,MudThemeProvideritself stays present regardless of whether theming is enabled or disabled (bound to@IsDarkModewhen enabled, hardcodedIsDarkMode="true"when disabled) — that is not an inconsistency to "fix" against the Header's<ThemeToggle />presence/absence; both are independently correct and are never reconciled against each other. - If
MainLayout.razoralready correctly references exactly the region files that exist, make no change to it at all.
Step 8 — CRITICAL: Ensure Idempotence (No Duplicate Items)
When this skill is run repeatedly (or when it is run after a menu file already contains some items), it MUST NOT create duplicates.
Before inserting any new menu item into a region file, you MUST check whether an equivalent item already exists in that same file/region.
De-duplication key (preferred order)
Treat a menu item as a duplicate if any of the following match:
- Same route/href (preferred):
Href="/Account/Login"matches any existing item withHrefequal to/Account/Login.- Match case-insensitively and ignoring a trailing
/.
- Same label (fallback):
- Visible text label matches case-insensitively after trimming whitespace (e.g.
Login==login).
De-duplication scope
- De-duplicate within the same menu surface file only (Header vs Sider vs Footer vs Profile are independent).
- De-duplicate within the same authorization block if the file contains multiple states (e.g.
<Authorized>vs<NotAuthorized>). Never add the same route twice within the same block.
Mandatory behavior
- If a duplicate exists, do NOT add another copy.
- If the context explicitly lists an item that already exists, preserve the existing one (do not remove/recreate it).
Forbidden
- Reintroducing a shared nav-item model (
NavItemrecord,AppNavstatic class, or anyItemsparameter feeding a generic loop) — every menu surface is literal markup by design. - Reintroducing a
<MudDrawer Open="..." OpenChanged="...">wrapper around the Sider's<MudNavMenu>, orOnClick/OnToggleEventCallbackparameters on the Header's drawer-toggle button orThemeToggle— these belonged to an older scaffold generation and no longer exist in the code-behind. - Adding
<ThemeToggle />toMainLayoutHeader.razorfor a Layout whose context states theming is disabled, or removing it from a Layout whose context states theming is enabled. - Adding
<AuthorizeView>,AddAuthorizationCore(), orAddCascadingAuthenticationState()to a project that doesn't already have them, in order to make a described role/policy requirement "work". - Adding an
<AuthorizeView>split toMainLayoutHeader.razorfor the Profile slot — that branching lives inside the Profile file itself (Step 6), never in the Header. - Adding a
<NotAuthorized>fragment to a gated nav item (Sider/Header/Footer link, or an individual modeled Profile item) — items should disappear, not show a fallback message. - Passing
Rolesas anything other than a single comma-delimited string toAuthorizeView(it is not astring[]parameter). - Replacing the WASM
.ClientProfile file's plain link/POST-form pattern with a client-side auth call. - Inventing routes, roles, or policies that weren't in the given context.
- Removing existing menu items the new context doesn't mention (treat as additive unless told otherwise).
- Inventing account/auth menu items (Login/Register/Manage/Logout) that aren't in the context.
- Adding or removing the header's Profile-component reference based on whether the Profile menu has qualifying items — the reference is present whenever the Profile file exists at all, full stop.
- Assigning items to the Profile region (or any region) by convention/mirroring rather than because its own placement comment resolved it there — the one sanctioned exception is the no-comment judgement-based Profile default from Step 2's "Region resolution" (a screen with no placement comment at all, judged profile/account/auth-related from its Label and route/location).
- Creating a region file for a region name that isn't one of the four canonical regions (Header/Sider/Footer/Profile) — an unrecognized placement comment falls back to the nearest existing menu (Step 2); it never creates a new file.
- Skipping creation of a recognized region's file when an item's placement comment resolves to it — a missing Header/Sider/Footer/Profile file is no longer a reason to omit the item; create the file (see the MANDATORY section) instead.
- Inventing or maintaining a
ManageLayout.razor<aside>nav duplicate — that mechanism no longer exists in current-generation projects. - Rewriting, reordering, or restyling any part of
MainLayout.razorbeyond adding/removing a<MainLayoutHeader/>/<MainLayoutSider/>/<MainLayoutFooter/>reference to match which region files currently exist — its provider components, wrapper element(s), CSS classes, and@Bodyplacement are not this skill's concern. - Adding a
<MainLayoutProfile />reference toMainLayout.razor— that reference belongs only inMainLayoutHeader.razor. - Removing
<MainLayoutHeader />or<MainLayoutSider />fromMainLayout.razor— those are core and always present.
Definition of Done
- [ ]
Program.cswas checked to confirm Auth vs NoAuth and hosting model before any edit was made - [ ] Every described item was mapped to Label/Href/Region/Icon/Authorization per Step 2's table
- [ ] Each item's region was resolved from its own placement comment (Step 2's "Region resolution"), not assumed from which file it happened to be read alongside
- [ ] Any item whose comment resolved to a recognized region (Header/Sider/Footer/Profile) with a missing file had that file (and its trivial
.razor.cscode-behind) created and populated, matchingMainLayout.razor/sibling conventions and the matching sample's structural chrome verbatim - [ ] Any item whose comment did not resolve to any of the four canonical regions was handled via the fallback (placed in the nearest existing menu, stated plainly in the response) — no file was created for it
- [ ]
MainLayoutSider.razor's<nav class="ux-nav-drawer">/<MudNavMenu>wrapper was left unchanged, with noMudDrawer/DrawerOpenreintroduced - [ ] Gated Sider/Header/Footer items, and individual gated Profile items, use
<AuthorizeView>with only an<Authorized>fragment — no<NotAuthorized>(except the Profile file's own fixed pair of blocks) - [ ]
AuthorizeView.Rolesis a comma-joined string, not an array literal - [ ] No
AuthorizeView/auth service registration was added to a NoAuth project, even if the context implied a role requirement - [ ]
MainLayoutHeader.razor's fixed drawer-toggle/brand/MudSpacerwere preserved untouched, with no reintroducedOnClick/OnTogglecallbacks - [ ]
<ThemeToggle />was included inMainLayoutHeader.razoriff the Layout's context states theming is enabled, and omitted iff disabled - [ ]
MainLayoutHeader.razorreferences the Profile component (e.g.<MainLayoutProfile />) unconditionally, with noAuthorizeView, iff a Profile menu file exists for this Layout - [ ] The Profile menu file (if modeled) reflects exactly the items assigned to the Profile region and nothing else (including no implied Login/Register/Manage/Logout)
- [ ]
MainLayout.razor's<MainLayoutHeader/>/<MainLayoutSider/>/<MainLayoutFooter/>references were reconciled against which of those files currently exist, with no other part of the file touched - [ ] No
<MainLayoutProfile />reference was added toMainLayout.razoritself - [ ] If editing a hosted WASM Auth project's Profile file, both the host and
.Clientcopies were kept in sync, and the.Clientcopy still uses plain relative links/POST forms, not a client-side auth call - [ ] No shared nav-item data model (
NavItem/AppNav) was reintroduced - [ ] No
ManageLayout.razornav duplicate was created or assumed to exist - [ ] Existing menu items not mentioned in the new context were preserved