agentleFS
mag1artmag1art/skills/aspnet-mvc/SKILL.md

aspnet-mvc

Skill1 starsChanged 3 months agoApache-2.0View on GitHub

Use for classic ASP.NET MVC 5 or ASP.NET Core MVC applications built with controllers, Razor views, model binding, filters, and server-rendered HTML.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 16 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈16

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use for server-rendered MVC applications, controllers, Razor views, view models, routing, model binding, validation, filters, areas, …

    line 26
  2. Distinctive:

    Do not use for a pure Web API, Blazor-only UI, Razor Pages-only project, or frontend code with no MVC boundary.

    line 30
  3. Distinctive:

    Do not mix APIs between the two generations.

    line 36
  4. Distinctive:

    Keep controller actions focused on HTTP/input orchestration.

    line 43
  5. Distinctive:

    Keep Razor views focused on presentation and use partials or view components for reusable UI.

    line 45
  6. Distinctive:

    Test routing, binding, validation, authorization, status/redirect behavior, and important rendered output.

    line 46
  7. Distinctive:

    Run build, tests, and a smoke test through the real host.

    line 47
  8. Distinctive:

    Use explicit action names, route constraints, and appropriate HTTP verbs.

    line 51
  9. Distinctive:

    Never bind domain entities directly for writes.

    line 53
  10. Distinctive:

    Keep GET actions side-effect free.

    line 56
  11. Distinctive:

    Do not expose exception details or internal IDs unnecessarily.

    line 57
  12. Distinctive:

    Use strongly typed views and display/editor templates.

    line 61
  13. Distinctive:

    Do not trust hidden fields for authorization or ownership.

    line 64
  14. Distinctive:

    Keep localization, date, number, and culture behavior explicit.

    line 65
  15. Distinctive:

    Avoid database calls from views.

    line 66
  16. Distinctive:

    Verify runtime generation, routing, binding and validation, antiforgery, authorization, output encoding, error handling, performance, …

    line 85

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ASP.NET MVC

When to Use

Use for server-rendered MVC applications, controllers, Razor views, view models, routing, model binding, validation, filters, areas, layouts, and migration from classic ASP.NET MVC to ASP.NET Core MVC.

When Not to Use

Do not use for a pure Web API, Blazor-only UI, Razor Pages-only project, or frontend code with no MVC boundary.

Identify the Runtime

Classic ASP.NET MVC 5 usually has System.Web, Global.asax, Web.config, App_Start, and packages.config. ASP.NET Core MVC usually has a Microsoft.NET.Sdk.Web project, Program.cs, appsettings.json, and middleware registration.

Do not mix APIs between the two generations. System.Web.Mvc attributes and HttpContext types are not interchangeable with Microsoft.AspNetCore.Mvc.

Workflow

  1. Identify runtime, target framework, hosting model, route style, view engine, authentication, and dependency injection setup.
  2. Preserve existing conventions before introducing newer patterns.
  3. Separate request models, domain models, and view models.
  4. Keep controller actions focused on HTTP/input orchestration; put business logic in services.
  5. Validate model state and authorization before side effects.
  6. Keep Razor views focused on presentation and use partials or view components for reusable UI.
  7. Test routing, binding, validation, authorization, status/redirect behavior, and important rendered output.
  8. Run build, tests, and a smoke test through the real host.

Controller and Action Rules

  • Use explicit action names, route constraints, and appropriate HTTP verbs.
  • Return the correct result: View, PartialView, Redirect, File, NotFound, BadRequest, or ProblemDetails.
  • Never bind domain entities directly for writes; use input models and explicit mapping.
  • Protect POST forms with antiforgery tokens when cookie authentication is used.
  • Validate authorization at resource/action level.
  • Keep GET actions side-effect free.
  • Do not expose exception details or internal IDs unnecessarily.

Razor and Model Binding

  • Use strongly typed views and display/editor templates.
  • Encode output by default; treat Html.Raw as a security-sensitive exception.
  • Validate both client-side and server-side.
  • Do not trust hidden fields for authorization or ownership.
  • Keep localization, date, number, and culture behavior explicit.
  • Avoid database calls from views.

ASP.NET Core MVC Setup

Inspect Program.cs for AddControllersWithViews, authentication, authorization, static files, routing, and MapControllerRoute. Keep middleware order explicit and configure antiforgery, HTTPS, error handling, caching, and security headers deliberately.

Classic MVC 5 Notes

Inspect Web.config, Global.asax, FilterConfig, RouteConfig, BundleConfig, Areas, and dependency-injection bootstrap. Respect IIS hosting, System.Web lifecycle, machine-key, Forms Authentication, and MVC 5 package constraints.

Migration Notes

  • Replace System.Web and HttpModules/HttpHandlers with ASP.NET Core middleware and services.
  • Replace Web.config configuration with appsettings, options, environment variables, and secret providers.
  • Rework routing, filters, authentication, session, caching, bundling, and static-file behavior instead of only changing namespaces.
  • Port views incrementally and test encoding, model binding, antiforgery, authorization, and URL generation.

Quality Gate

Verify runtime generation, routing, binding and validation, antiforgery, authorization, output encoding, error handling, performance, tests, and production configuration.

Example: MVC POST with Validation and Anti-Forgery

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(
    CreateOrderViewModel model,
    CancellationToken ct)
{
    if (!ModelState.IsValid)
        return View(model);

    var orderId = await _orders.CreateAsync(model, ct);
    return RedirectToAction(nameof(Details), new { id = orderId });
}

For classic MVC, verify anti-forgery configuration and binding behavior. For ASP.NET Core MVC, prefer validated request models, explicit authorization policies, async actions, and a service layer. Do not bind domain entities directly from form input.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.