Razor Pages Patterns

Guide ASP.NET Core Razor Pages development with best practices for structure, validation, and security.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill razor-pages-patterns-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Razor Pages Patterns
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/razor-pages-patterns
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill razor-pages-patterns-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common pitfalls in ASP.NET Core Razor Pages development, ensuring applications are secure, maintainable, and performant.

Core Features & Use Cases

  • Best Practices Enforcement: Guides developers on project structure, PageModel design, validation, security, and error handling.
  • Production-Ready Code: Promotes patterns for building scalable and robust web applications using Razor Pages.
  • Use Case: When starting a new ASP.NET Core web application that will primarily use Razor Pages, apply these patterns to establish a solid foundation for development.

Quick Start

Apply the Razor Pages Patterns skill to refactor the provided PageModel for improved security and maintainability.

Frequently Asked Questions about Razor Pages Patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for structuring ASP.NET Core Razor Pages applications?

Best practices for ASP.NET Core Razor Pages focus on optimal project structure, PageModel design, model binding, validation, and error handling to ensure applications are secure, maintainable, and performant in production environments.

How do I secure ASP.NET Core Razor Pages with authentication and authorization?

Securing ASP.NET Core Razor Pages involves applying specific patterns for authentication and authorization within your PageModels. This Skill provides guidance on implementing these security measures to protect production-grade web applications.

How do I design PageModels and handlers in Razor Pages for maintainability?

Designing maintainable PageModels and handlers in Razor Pages requires following structural patterns that enforce separation of concerns and robust lifecycle management. This Skill guides developers on refactoring PageModels for improved maintainability and security.

Can I use these Razor Pages patterns to refactor existing ASP.NET Core web apps?

Yes, you can apply these Razor Pages patterns to refactor existing ASP.NET Core applications. The guidance focuses on improving security, model binding, validation, and overall maintainability for both new projects and current codebases.

When should I use ASP.NET Core Razor Pages instead of other web UI frameworks?

You should use ASP.NET Core Razor Pages when building web applications that require a solid foundation with structured PageModels, robust validation, and built-in security patterns. It is ideal for production-grade apps prioritizing maintainability and performance.