Saltar al contenido
Skillpedia
APIs y servidores (backend)5,8 mil · #14571

create-datadriven-aspnetcore

Qué hace

Esta skill escribe código de crear, leer, actualizar y eliminar para un modelo de datos de ASP.NET Core, incluidos páginas, vistas, componentes y endpoints de API. Está pensada para desarrolladores de .NET que necesitan pantallas de datos y APIs respaldadas por una base de datos.

Cuándo usarla

  • ✓Cuando quieres páginas para crear, editar, listar y eliminar un modelo en un proyecto de ASP.NET Core.
  • ✓Cuando quieres endpoints de API para un modelo respaldado por Entity Framework.
  • ✓Cuando quieres páginas Razor, vistas MVC o componentes Blazor generados para encajar con tu proyecto.

Link de la skill

https://github.com/dotnet/skills/blob/main/plugins/dotnet-data/skills/create-datadriven-aspnetcore/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/dotnet/skills/blob/main/plugins/dotnet-data/skills/create-datadriven-aspnetcore/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Añade páginas CRUD para el modelo Product en mi proyecto de ASP.NET Core, usando mi diseño y mi CSS existentes.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El agente lee el framework CSS, el diseño y el contexto de datos del proyecto, escribe las páginas o los endpoints para que encajen con el código existente y usa comandos estándar de dotnet para compilar y para las migraciones.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Generate or Scaffold ASP.NET Core Code

Generate ASP.NET Core scaffolded code — controllers, views, Razor Pages, Blazor components, Minimal API endpoints. The generated code matches the project's existing CSS framework, layout conventions, and coding patterns. No CLI-based scaffolding/code-generation tools are used; standard dotnet CLI commands for build, restore, and migrations are still expected.

When to Use

  • Adding CRUD pages, views, or components for a model in an ASP.NET Core project
  • Scaffolding API controllers or Minimal API endpoints with Entity Framework Core
  • Generating Razor Pages, MVC views, or Blazor components backed by a DbContext

When Not to Use

  • The project is not an ASP.NET Core project
  • You need to scaffold non-web artifacts (class libraries, console apps, etc.)

Inputs

Input Required Description
Scaffolding request Yes Natural-language description of what to scaffold (see format below)
Project file path Yes Full path to the target .csproj file
Solution root path Recommended Path to the solution root for multi-project solutions

Scaffolding Request Format

The scaffolding request should be a natural-language description of what to scaffold. The request must include the target project path and enough detail for the agent to generate the correct code. Examples:

Razor Pages with EF:

Scaffold Razor Pages with CRUD for the `<ModelName>` model (from `<Namespace>`) in project `<path-to-csproj>`.
Create a new DbContext `<DbContextName>` using <database-provider>.
Also scaffold CRUD for any entity that `<ModelName>` depends on via required foreign keys, so parent entities can be created first.

Blazor CRUD components:

Scaffold Blazor CRUD components for the `<ModelName>` model (from `<Namespace>`) in project `<path-to-csproj>`.
Create a new DbContext `<DbContextName>` using <database-provider>.

Minimal API endpoints:

Scaffold Minimal API endpoints for the `<ModelName>` model (from `<Namespace>`) in project `<path-to-csproj>`.
Name the endpoints class `<EndpointsClassName>`.
Create a new DbContext `<DbContextName>` using <database-provider>.
Enable OpenAPI support.

MVC Controller with views:

Scaffold an MVC controller with views and Entity Framework for the `<ModelName>` model (from `<Namespace>`) in project `<path-to-csproj>`.
Name the controller `<ControllerName>`.
Use existing DbContext `<DbContextName>`.
Generate views.

Empty items (no EF):

Scaffold an empty Razor Page named `<PageName>` in project `<path-to-csproj>`.

Workflow

Step 1: Understand the Scaffolding Request

Parse the scaffolding request to identify:

  • Scaffolder type: Razor Pages, Blazor components, MVC controller, Minimal API, empty page/view/component
  • Model class and its namespace
  • DbContext: new or existing, database provider (SQLite, SQL Server, etc.)
  • Named items: controller name, endpoints class name, page name, view name, area name
  • Options: OpenAPI, async actions, partial view, custom layout
  • FK scope: whether to also scaffold CRUD for parent entities referenced by required foreign keys

Execution Checklists

Complete the applicable checklist in order. Do not stop after creating only the requested child resource when a required foreign key makes a parent resource necessary.

All EF scaffolders

  1. Inspect the project file, Program.cs, target model, validation attributes, navigation properties, and foreign keys before editing.
  2. Reuse the requested existing DbContext; otherwise create the requested context. Add only the required provider package and register it with AddDbContext using the requested provider and connection string. You will need to add Microsoft.EntityFrameworkCore.Design (PrivateAssets="all") when migrations are needed and it's missing.
  3. Generate complete CRUD for the requested entity and every required parent entity: list, details, create, edit, and delete.
  4. Use the EF migration lifecycle: create a migration and apply it. Never call EnsureCreated or seed the database in Program.cs.
  5. Restore, build, and test the generated project. Fix errors before reporting completion.

MVC, Razor Pages, and Blazor

  1. Inspect the existing layout, CSS, and representative UI before generating markup.
  2. Generate the complete child and required-parent UI flows, including a navigation path to each resource so user
Preguntas frecuentes

¿Usa el comando de andamiaje?

No. Escribe el código directamente en lugar de usar las herramientas de andamiaje de ASP.NET Core.

¿Encaja con el estilo de mi proyecto?

Sí. Respeta el framework CSS, el diseño y los patrones de código existentes.

¿Necesita una base de datos?

Sí. El código generado está respaldado por Entity Framework y un contexto de base de datos.

Detalles

Descripción original del autor

Generate or scaffold ASP.NET Core code — Razor Pages, Blazor components, MVC controllers, views, and Minimal API endpoints — without using ASP.NET Core CLI scaffolding/code-generation 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

repo: dotnet/skills

Popularidad

Estrellas en GitHub
5,8 mil
Posición en el ranking
#14571
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas