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
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a claude-codeWhat 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
Pageswithout 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.cswith validation and a CSRF token. - Review
Pages/Admin/Index.cshtmlfor over-posting and add[Authorize]. - Rework
OnPostAsyncto follow Post-Redirect-Get withRedirectToPage.
How to install Razor Pages Patterns
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a claude-code2Manually: put the files in place
~/.claude/skills/razor-pages-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/razor-pages-patterns/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a codex2Manually: put the files in place
.agents/skills/razor-pages-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a cursor2Manually: put the files in place
.cursor/skills/razor-pages-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills skills/razor-pages-patterns2Manually: put the files in place
.github/skills/razor-pages-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/razor-pages-patternsManually: put the files in place
.devin/skills/razor-pages-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill razor-pages-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.