Base solution for your next web application
Open Closed

AI and asp.net zero #12636


User avatar
0
KieranIrl created

Hi Folks, Is there any more information as to how we can develop aspnet zero with AI tools? I've found this https://aspnetzero.com/AI but it doesn't go into specifics. Thanks,

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

6 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @KieranIrl

    Thanks for your interest. The page you found at aspnetzero.com/AI is a good starting point. Let me give you a deeper look at what's available and how to use AI tools effectively with ASP.NET Zero.

    What's Included in the Repository

    Starting from the latest versions, the ASP.NET Zero repository ships with built in AI configurations for all major AI powered coding tools. The latest configurations will be included in version 15.2, which we plan to release very soon. Version 15.1 contains the older configuration. If your project is running an older version, you can apply the changes made in this pull request to your project to make it more compatible with AI tools in your ASP.NET Zero project.

    Related Pull Request: https://github.com/aspnetzero/aspnet-zero-core/pull/5911

    | AI Tool | Configuration Location | What's Included | |---|---|---| | GitHub Copilot | copilot-instructions.md + prompts | Architecture rules + 15 ready to use prompts | | Cursor | .cursor | 7 specialized agents, 15 commands, rules, 20 domain skills | | Windsurf | .windsurf | Rules, 15 workflows, 20 domain skills | | Claude Code | .claude | Rules, 15 commands, flows, guidelines, knowledge base, 20 skills | | VS Code Copilot (Agent Mode) | .agent | 7 agents, 15 commands, rules, 20 skills |

    These files are automatically picked up by each tool, no manual setup required.

    What Do These Configurations Do?

    1. Architecture Enforcement: The AI understands ASP.NET Zero's strict layer separation (Core → Application → EF Core → Web) and will never generate code that violates it. It knows not to put business logic in controllers, not to mix entities with DTOs, etc.

    2. 20 Domain Specific Skills: These are detailed pattern guides covering:

      • Entity creation, DTO patterns, Application Service CRUD patterns
      • Mapperly mapping, EF Core patterns, Permission & Localization patterns
      • Angular components/tables/modals, React components/state management
      • xUnit testing with Shouldly & NSubstitute
      • Multi-tenancy, error handling, clean code, and more
    3. 15 Ready-to-Use Commands/Prompts: You can invoke these directly from your AI tool:

      • add-feature — End-to-end feature generation (entity → DTOs → app service → permissions → localization → tests)
      • generate-entity — Scaffold a domain entity with DbContext & migration
      • generate-appservice — Full CRUD app service with interface, DTOs, mappers
      • generate-permission — Complete permission set (constants, registration, localization)
      • generate-angular-crud — Angular page with PrimeNG table, modal, routing
      • generate-react-crud — React page with Ant Design table/modal
      • generate-tests — xUnit tests for an existing app service
      • generate-migration — EF Core migration
      • smart-debug — AI-powered root cause analysis
      • review-pre-push — Quality checks before pushing
      • And more...
    4. Specialized Agents (Cursor / VS Code Agent Mode): Pre-configured agents like:

      • aspnetzero-developer — General ASP.NET Zero development
      • backend-architect — Architecture decisions
      • angular-developer / react-developer — Frontend-specific
      • code-reviewer — Code review with ABP best practices
      • qa-engineer — Test generation
      • debugger — Troubleshooting

    How to Use

    GitHub Copilot (VS Code / Visual Studio or Terminal):

    • Open Copilot Chat and it automatically uses the instructions from copilot-instructions.md
    • Type # and select a prompt like generate-appservice or add-feature
    • Copilot will generate code following ASP.NET Zero patterns

    Cursor:

    • Rules from rules load automatically
    • Use /command-name (e.g., /generate-entity) to invoke commands
    • Switch to specialized agents like @aspnetzero-developer or @backend-architect

    Windsurf:

    • Rules from rules load automatically
    • Use workflows (e.g., generate-appservice) for guided code generation

    Claude Code:

    • Instructions from rules load automatically
    • Use /command-name for code generation commands
    • Claude has additional flows, guidelines, and a knowledge base for deeper context

    Practical Example

    Say you want to add a "Product" entity with full CRUD. Using the add-feature command in any supported tool:

    1. Invoke the command and describe: "Product entity with Name (string, required, max 256), Price (decimal, required), Description (string, optional, max 2000)"
    2. The AI will generate:
      • Entity in Core project
      • DTOs in Application.Shared
      • App Service interface + implementation in Application
      • Permission constants + registration
      • Localization entries in XML
      • DbContext registration + EF migration
      • Unit tests
      • Optionally: Angular or React CRUD page

    All following ASP.NET Zero conventions.

    Tips

    • Make sure you're using the latest ASP.NET Zero template to get the AI configuration files (recommended)
    • The AI configurations are designed to work out of the box, just open the repo in your preferred AI enabled editor
    • You can customize the skills and rules to match your specific project conventions
    • Always review generated code, especially migrations and permission configurations

    Hope this helps. Let us know if you have any specific questions about using these tools.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    KieranIrl created

    Very useful, thank you for the response

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    smartech created

    How can I handle Editions and features linking with Subscriptions ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @smartech

    These are automatically connected. When you create an Edition, you can select features for this edition as well. Then, when a Tenant is assigned to an Edition (either by purchasing a subscription or manual assignment via admin UI), Tenant will have features of the assigned Edition. If that doesn't answer your question, please create a new question and provide details.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    smartech created

    I mean how can do it with AI to create new features or editions by using a predefined skill or prompt

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @smartech,

    Yes, you can create new Features and Editions with AI using the built in ASP.NET Zero skills and commands.

    For example, instead of manually implementing a feature, you can use the add-feature command and provide a detailed description of the feature you want to introduce.

    Example prompt:

    Create a new feature called "AdvancedReporting".

    Feature details:

    • Boolean feature (enabled/disabled)
    • Available only for Premium and Enterprise editions
    • Default value: false
    • Add localization entries
    • Register the feature in AppFeatureProvider
    • Add permission checks in the reporting application service
    • Create unit tests for feature availability

    The AI will generate the required feature definition, localization entries, registrations, and related permission checks following ASP.NET Zero conventions.

    For creating a new Edition, you can use a prompt such as:

    Create a new Edition called "Professional".

    Include the following features: Example

    • AdvancedReporting = true
    • ApiAccess = true
    • MaxUserCount = 50

    Generate the required seed data, localization entries, and edition configuration.

    Currently there isn't a dedicated generate-edition command, but the existing add-feature and general ASP.NET Zero development skills already understand the Feature/Edition architecture and can scaffold most of the required implementation.

    For best results, provide:

    • Feature name
    • Feature type (boolean, numeric, string)
    • Default value
    • Which editions should include it
    • Any related permissions or UI restrictions

    The more explicit the requirements, the better the generated code will align with ASP.NET Zero's Feature and Edition system.

    Additionally, the ASP.NET Zero AI skills are not limited to the application code itself. They are also designed around the underlying ASP.NET Boilerplate framework used by ASP.NET Zero. Since the skills and knowledge base incorporate common ASP.NET Boilerplate patterns, modules, and architectural conventions, the AI can better understand concepts such as Features, Editions, Permissions, Multi Tenancy, Settings, Authorization, Background Jobs, and other framework specific components. This allows it to generate code that is more consistent with both ASP.NET Zero and the underlying ASP.NET Boilerplate architecture.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)