name: neo-dotnet-mvc
description: >
Use this skill when building, debugging, refactoring, or reviewing ASP.NET Core
MVC apps with Razor views, controllers, ViewModels, validation, Tag Helpers,
View Components, layouts, or server-rendered workflows.
compatibility: "Supports .NET 6.0 through 10.0 environments. Requires .NET SDK installed locally."
metadata:
version: "1.0.0"
category: "Framework"
.NET MVC Expert Skill
Trigger On
- The user requests to create, debug, refactor, or review ASP.NET Core MVC applications.
- The project contains
Views and Controllers directories and inherits from Controller (not ControllerBase). - The target framework is .NET 6.0 (LTS) and above.
- There is a need to optimize Server-Side Rendering (SSR) performance or improve view organizational structure.
Workflow
- Perceive (Architecture Awareness):
- Check
.csproj to identify TargetFramework. - Analyze
Views/Shared to confirm existing configurations for layouts and partial views. - Identify whether Tag Helpers and static resource versioning are enabled.
- Reason (Planning Phase):
- Evaluate whether complex Partial Views need to be migrated to View Components.
- Determine whether custom Tag Helpers are needed to simplify UI logic.
- Choose an appropriate ViewModel organization method based on project scale.
- Act (Execution Phase):
- Write high-quality controllers and strongly-typed views.
- Implement data validation (Data Annotations) and integrate them into ViewModels.
- Configure and use Tag Helpers to ensure the semantic correctness of forms and links.
- Validate (Standard Validation):
- Validate whether page rendering conforms to the expected HTML structure.
- Check whether model validation correctly operates on both the frontend and backend.
- Ensure Antiforgery tokens are correctly applied to all state-modifying requests.
Feature Roadmap (.NET 6 - 10)
.NET 6 & 7 (Foundation)
- Tag Helpers: Declarative HTML attribute extensions.
- View Components: Logic-driven UI block modularization.
- Cache Tag Helper: Server-side view fragment caching.
- Nullable Views: Better Razor null safety support.
.NET 8 & 9 (Productivity)
- Blazor Integration: Hybrid development support for MVC and Blazor components.
- Antiforgery Improvements: Global anti-forgery automatic validation optimization.
- Keyed Services in Controllers: Finer-grained dependency injection support.
- Native AOT for MVC: Metadata compilation optimization tailored for AOT.
.NET 10+ (Version-Specific Features)
- Extension Members for IHtmlHelper: Extending view helper functions.
- Advanced Serialization in Views: Performance optimization for large view models.
Coding Standards
- Strongly Typed Views: All views must have an explicit
@model. - ViewModel Separation: Strictly prohibit exposing database entities directly to views.
- Naming: View models must end with
ViewModel, action methods prioritize asynchronous patterns. - Formatting: Follow the Allman style and use Tag Helpers instead of HTML Helpers.
Deliver
- Version-Optimized MVC Code: Provide modernized controllers, models, and views suitable for the target version.
- UI Architecture Suggestions: Provide design suggestions for view components and Tag Helpers.
- Validation Logic: Provide a complete model validation and error prompting implementation plan.
Validate
- Ensure the code complies with C# 10+ syntax standards.
- Validate endpoints correctly handle model validation failures and return form states.
- Confirm static resources and scripts are correctly cached via
asp-append-version.
Documentation
Official References
Internal References