/vibe:ghcopilot-instr-csharp-razorpagesfrom vibe
Provides Razor Pages conventions: handler-based PageModels, async/await, Post-Redirect-Get, model binding with Input Models to prevent overposting, and naming conventions.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
CreateModel, OnPostAsync, OnPostDeleteAsync)._ prefix on private fields per the .NET convention (_context, _logger).IEmailService).OnPost/Async affixes when routed. OnPostJoinListAsync is reached as handler=JoinList.[BindProperty] on EF or domain entities directly. An attacker can post extra fields like IsAdmin or Secret and the binder will happily set them, even if the form doesn't render them.TryUpdateModelAsync<T> with an explicit allow-list of properties is another option, especially in edit scenarios.[Bind] for edits. Excluded properties get reset to default(T) rather than left alone, which is rarely what you want. Prefer Input Models.[BindProperty(SupportsGet = true)] broadly. Razor Pages skips GET binding by default for a reason; opt in per-property and validate what comes in.TryParse or a TypeConverter so they bind from route and query values. Without one, the binder treats them as complex types and binding silently fails. One of those bugs that wastes an afternoon.[BindRequired] and [Required] aren't the same thing. [BindRequired] errors when the source value is absent from the posted form; [Required] validates that the bound value isn't null/empty. [BindRequired] only applies to form binding, since JSON and XML go through input formatters instead.RedirectToPage("./Index"), never Page(). Returning Page() on success means a browser refresh resubmits the form.public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid) return Page(); // re-render on error
await _service.CreateAsync(Input);
return RedirectToPage("./Index"); // PRG on success
}
if (!ModelState.IsValid) return Page();. Client-side validation can be bypassed; the server is authoritative.OnGetAsync(int id)) for single-request route or query values. Use [BindProperty] for POST data that needs to round-trip back to the view on validation errors.OnPostDeleteAsync, OnPostApproveAsync) need the asp-page-handler tag helper on the submit button. Without it, plain buttons fall back to OnPostAsync or 404.OnGet does expensive work, add a lightweight OnHead. Razor Pages falls back to OnGet for HEAD requests otherwise, so every probe pays the full GET cost.[ActionFilter] attributes are silently ignored on page handlers. Use IPageFilter / IAsyncPageFilter, or register global conventions through options.Conventions in Program.cs.Pages/Shared/, not Views/Shared/. Razor Pages resolves views hierarchically from the page's folder up through Pages/, and mixing in MVC conventions just fights the framework.Layout in Pages/_ViewStart.cshtml. Use Pages/_ViewImports.cshtml for @namespace, @addTagHelper, and shared directives..cshtml and .cshtml.cs colocated. Per-page locality is one of the main reasons to use Razor Pages in the first place, and splitting them across folders throws that away.@ expression HTML encoding. Don't reach for @Html.Raw() on user-supplied content; it disables encoding and opens the door to XSS.<form method="post"> and the Form Tag Helper so the antiforgery token gets injected automatically. For AJAX or fetch, render the token with @Html.AntiForgeryToken() and send it as the RequestVerificationToken header.appsettings.json. Use appsettings.{Environment}.json for environment overrides, User Secrets (dotnet user-secrets) locally, and Azure Key Vault or environment variables in production. Bind via IOptions<T>.DbContext), that instance leaks across requests. Common bug in PageModel-adjacent services.DbContext as Singleton. The default AddDbContext registration is Scoped for a reason..Select(...) before returning them to the view. Passing entities with navigation properties straight through causes lazy-loading exceptions, N+1 queries, or serialization cycles when the view renders..AsNoTracking() on read-only queries like list pages or details pages without edit. The change tracker has overhead you don't need there.FindAsync(key) over FirstOrDefaultAsync(x => x.Id == key) when fetching by primary key without Include. FindAsync checks the change tracker first.TempData is for one-shot, cross-redirect messages like flash notifications after a PRG. It's read-once, cookie-serialized by default, and not a substitute for session storage.ISession. For per-request data, HttpContext.Items. For shared state within a single request, request-scoped DI services.TempData.Keep() or TempData.Peek() when a value needs to survive multiple redirects without being consumed.PageModel classes directly. Instantiate them with mocked dependencies (Moq, NSubstitute) and assert on the returned IActionResult: PageResult for re-renders, RedirectToPageResult for successful PRG, NotFoundResult for 404 paths.WebApplicationFactory<TEntryPoint> with Microsoft.AspNetCore.Mvc.Testing.ModelState, populate it manually with PageModel.ModelState.AddModelError(...). The binding pipeline doesn't run in unit tests.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
razor-pages, aspnet-core, csharp, model-binding, post-redirect-get
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job