Adding scaffold-generate-aspnet/SKILL.md - #133
Conversation
This should be picked up when a prompt requests to generate content for ASP.NET Core that uses a database. This skill will ensure that best practices are followed when using ASP.NET Core + EF. For example without this skill it's common for copilot to initialize the database in Program.cs instead of using migrations.
There was a problem hiding this comment.
Pull request overview
This PR adds a new skill (scaffold-generate-aspnet) that guides Copilot to generate ASP.NET Core code—including Razor Pages, Blazor components, MVC controllers, views, and Minimal API endpoints—without using CLI scaffolding tools. The skill emphasizes best practices such as using EF Core migrations instead of database seeding in Program.cs, matching existing project CSS frameworks and conventions, and properly handling Blazor-specific patterns like [SupplyParameterFromForm] properties.
Changes:
- Adds comprehensive skill documentation for ASP.NET Core code generation, with detailed workflows covering UI scaffolders (Razor Pages, Blazor, MVC) and API scaffolders (Minimal API, MVC controllers)
- Provides example scaffolding request formats and step-by-step instructions for discovering project conventions, generating code, setting up Entity Framework, creating test
.httpfiles, and verifying the scaffolded code - Includes validation checklists and common pitfalls tables to help ensure generated code follows best practices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@sayedihashimi thanks for this skill, please run and past the skill evaluation output in this PR (eng/skill-validator). |
Add 4 evaluation scenarios covering: - Razor Pages CRUD with EF Core and SQLite - Minimal API endpoints with OpenAPI - Blazor CRUD components with SupplyParameterFromForm - Advisory guidance on EF migration best practices Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Rewrite prompts in natural human language - Remove CLI tool restriction rubrics (baseline may use CLI tools) - Remove package restriction assertions and rubrics - Remove Blazor-specific assertions (SupplyParameterFromForm, AddInteractiveServerComponents) - Remove Advisory EF migration scenario - Keep rubrics focused on quality outcomes the skill should improve Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Create .NET 10 projects with model classes for each test scenario: - razor-pages-crud: Razor Pages webapp with Product/Category models (FK relationship) - minimal-api: Web API with TodoItem model - blazor-crud: Blazor Web App with Employee/Department models (FK relationship) Projects created via dotnet new with vendor libraries (wwwroot/lib) removed. Eval scenarios updated to use copy_test_files and reference fixture project paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add detailed instructions in Step 4 for enriching Minimal API and MVC API endpoints with OpenAPI metadata: WithName, WithTags, WithDescription, Produces, and ProducesValidationProblem. Includes a code example. Update eval rubric to expect rich OpenAPI metadata on generated endpoints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Here is the output of the skill-validator |
timheuer
left a comment
There was a problem hiding this comment.
Is there any ending reference links that would be helpful here to even make it better for scaffolding or EF rules?
| description: Generate or scaffold ASP.NET Core code — Razor Pages, Blazor components, MVC controllers, views, and Minimal API endpoints — entirely through Copilot without CLI tools. Use when (1) adding CRUD pages, views, or API endpoints backed by Entity Framework (EF Core) and a database, (2) generating code to create, read, update, and delete data using a DbContext, (3) scaffolding UI components that match the project's existing CSS framework and coding patterns, or (4) creating data-driven forms, tables, and navigation for a model class. Do not use for non-ASP.NET projects or when CLI-based scaffolding with `dotnet scaffold` is preferred. | ||
| --- | ||
|
|
||
| # Generate or Scaffold ASP.NET Core Code with Copilot |
There was a problem hiding this comment.
As a general skill, specifying Copilot might not be great here. 'entirely through Copilot' seems confusing.
There was a problem hiding this comment.
I have fixed this.
I added two references one to EF DbContext info and the other OpenAPI in ASP.NET Core. |
|
@BrennanConroy @adityamandaleeka - please review |
This should be picked up when a prompt requests to generate content for ASP.NET Core that uses a database. This skill will ensure that best practices are followed when using ASP.NET Core + EF. For example without this skill it's common for copilot to initialize the database in Program.cs instead of using migrations.