Skip to main content
skill CX Codex

Razor Pages Patterns — Claude Code skill: what it does, how to install

The Razor Pages Patterns skill gives the agent a fixed set of rules for ASP.NET Core Razor Pages: page layout, PageModel design, binding and validation, form security. Fits projects on .NET 8+ with Razor Pages as the UI.

no license 121 installs ★ 92 updated 2026-02-27

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a claude-code
Open on GitHub

What Razor Pages Patterns does

The skill steers the agent toward a page-first layout whenever it writes or reviews Razor Pages code. Pages sit under Pages in topical subfolders, services arrive through the PageModel constructor, and handlers stay short and async. [BindProperty] gets used sparingly so a POST cannot set fields it should not touch.

Validation runs on data annotations plus a ModelState.IsValid check that sends the user back to the form with errors. Routing uses @page templates and RedirectToPage after a successful submission. Security means CSRF tokens in every form, [Authorize] on PageModels, HSTS with HTTPS redirection. Separate parts cover logging through ILogger<PageModel> and a shared /Error page, response caching and PageModel unit tests with mocks.

Everything assumes .NET 8+ with nullable reference types switched on. On an older target the advice about minimal hosting and null-safe code will not match your startup.

What it helps with

  • lay out pages under Pages without mixing them with API controllers
  • drop stray [BindProperty] uses that allow over-posting
  • wire a CSRF token and [Authorize] into a page
  • make handlers async and inject services through the constructor
  • unit test a PageModel with mocked dependencies

Example prompts for the agent

  • Create a PageModel for the signup form at Pages/Account/Register.cshtml.cs with validation and a CSRF token.
  • Review Pages/Admin/Index.cshtml for over-posting and add [Authorize].
  • Rework OnPostAsync to follow Post-Redirect-Get with RedirectToPage.

How to install Razor Pages Patterns

1Skills CLI (Vercel)

npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a claude-code

2Manually: put the files in place

~/.claude/skills/razor-pages-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/razor-pages-patterns/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about Razor Pages Patterns

How do I install Razor Pages Patterns in Claude Code?

Run npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a claude-code. The skill file then sits at ~/.claude/skills/razor-pages-patterns/SKILL.md.

What does Razor Pages Patterns do?

It hands the agent a rulebook for ASP.NET Core Razor Pages: project layout, lean PageModels, binding and validation, routing, error handling and tests. The agent applies it while writing new code or reviewing what is already there.

Which .NET version does it need?

It targets .NET 8+ with nullable reference types enabled, since part of the guidance covers minimal hosting and null-safe code.

Similar skills

All skills for Backend and APIs →
csharp-razorpages official github csharp-razorpages configures GitHub Copilot to write idiomatic Razor Pages across .cshtml and .cshtml.cs files. It enforces PageModel conventions, secure model binding, and clean data queries. CX Codex +1 ★ 41,430repo stars dependency-injection-patterns Aaronontheweb dependency-injection-patterns is a Claude Code skill that groups ASP.NET Core dependency registrations into Add* extension methods. It applies when organizing DI setup or sharing configuration with tests. CX Codex +1 715installs create-datadriven-aspnetcore dotnet create-datadriven-aspnetcore generates ASP.NET Core CRUD code — Razor Pages, Blazor components, controllers, and Minimal APIs — aligned with project styles and EF Core without CLI generators. CX Codex +1 3,900installs aspnet-core official openai Guides building, refactoring, and architecting ASP.NET Core apps using official Microsoft patterns. Helpful for Minimal APIs, Blazor, and migrations. CX Codex +1 4,300installs dotnet-architect rmyndharis dotnet-architect — a skill for Claude Code, Codex, Cursor, GitHub Copilot, and Gemini CLI that gives the agent the role of a senior .NET backend architect: C#, ASP.NET Core, Entity Framework, Dapper, and enterprise patterns. CX Codex +1 353installs csharp official github csharp — a rule that pins Copilot to one C# style: naming, nullable types, formatting and ASP.NET Core patterns. Useful when the agent writes differently in every file. CX Codex +1 ★ 41,430repo stars

From the same set24

The whole set →
dotnet-architecture-patterns dotnet-architecture-patterns guides scalable .NET Minimal API architecture using vertical slices, route groups, endpoint filters, and structured error handling. CX Codex +1 125installs dotnet-csharp-dependency-injection dotnet-csharp-dependency-injection guides Microsoft DI in .NET, from service lifetimes and keyed registrations to decoration and hosted workers. CX Codex +1 125installs bootstrap5-ui bootstrap5-ui provides Bootstrap 5.3 layout patterns and component snippets for HTML and ASP.NET Core Razor views. CX Codex +1 122installs dotnet-performance-patterns dotnet-performance-patterns is a Claude Code skill for .NET 8+ architecture patterns that reduce allocations using Span, Memory, and ArrayPool. CX Codex +1 122installs dotnet-solid-principles dotnet-solid-principles — a skill for Claude Code that applies SOLID, DRY, and SRP principles in .NET projects. Detects C# anti-patterns and suggests specific refactoring steps. CX Codex +1 112installs dotnet-integration-testing The dotnet-integration-testing Claude Code skill covers .NET integration tests against real infrastructure. Ask for API test setup with an in-process server or a database running in Docker. CX Codex +1 111installs signalr-integration The signalr-integration skill provides SignalR patterns for ASP.NET Core Razor Pages, including hubs and client connections. Use it when adding live notifications or order updates. CX Codex +1 107installs dotnet-blazor-patterns The dotnet-blazor-patterns Claude Code skill covers Blazor project setup, hosting choices, and render modes. It applies to routing, prerendering, and streaming-render tasks. CX Codex +1 104installs

Project sponsors

Companies that keep this analytics open