ai-rules/README.md
This folder contains AI rules (Cursor .mdc format) for ABP based solutions. These rules help AI assistants understand ABP-specific patterns, conventions, and best practices when working with ABP-based applications.
This folder serves as a central repository for ABP-specific AI rules. The community can contribute, improve, and maintain these rules collaboratively.
When you create a new ABP solution, these rules are included in your project based on your configuration. This provides AI assistants with ABP-specific context, helping them generate code that follows ABP conventions.
Important: These rules are ABP-specific. They don't cover general .NET or ASP.NET Core patterns—AI assistants already know those. Instead, they focus on ABP's unique architecture, module system, and conventions.
Large language models don't retain memory between completions. Rules provide persistent, reusable context at the prompt level.
When applied, rule contents are included at the start of the model context. This gives the AI consistent guidance for generating code, interpreting edits, or helping with workflows.
IApplicationService contracts.ai-rules/
├── README.md
├── common/ # Rules for all ABP projects
│ ├── abp-core.mdc # Core ABP conventions (alwaysApply: true)
│ ├── ddd-patterns.mdc # DDD patterns (Entity, AggregateRoot, Repository)
│ ├── application-layer.mdc # Application services, DTOs, validation
│ ├── authorization.mdc # Permissions and authorization
│ ├── multi-tenancy.mdc # Multi-tenant entities and data isolation
│ ├── infrastructure.mdc # Settings, Features, Caching, Events, Jobs
│ ├── dependency-rules.mdc # Layer dependencies and guardrails
│ ├── development-flow.mdc # Development workflow
│ └── cli-commands.mdc # ABP CLI commands reference
├── ui/ # UI-specific rules (applied by globs)
│ ├── blazor.mdc # Blazor UI patterns
│ ├── angular.mdc # Angular UI patterns
│ └── mvc.mdc # MVC/Razor Pages patterns
├── data/ # Data layer rules (applied by globs)
│ ├── ef-core.mdc # Entity Framework Core patterns
│ └── mongodb.mdc # MongoDB patterns
├── testing/ # Testing rules
│ └── patterns.mdc # Unit and integration test patterns
└── template-specific/ # Template-specific rules
├── app-nolayers.mdc # Single-layer app template
├── module.mdc # Module template
└── microservice.mdc # Microservice template
Each rule is a markdown file with frontmatter metadata:
---
description: "Describes when this rule should apply - used by AI to decide relevance"
globs: "src/**/*.cs"
alwaysApply: false
---
# Rule Title
Your rule content here...
| Property | Description |
|---|---|
description | Brief description of what the rule covers. Used by AI to determine relevance. |
globs | File patterns that trigger this rule (e.g., **/*.cs, *.Domain/**). |
alwaysApply | If true, rule is always included. If false, AI decides based on context. |
| Type | When Applied |
|---|---|
| Always Apply | Every chat session (alwaysApply: true) |
| Apply Intelligently | When AI decides it's relevant based on description |
| Apply to Specific Files | When file matches globs pattern |
| Apply Manually | When @-mentioned in chat (e.g., @my-rule) |
Core ABP patterns that apply to all DDD-based templates (app, module, microservice):
abp-core.mdc - Always applied, covers module system, DI conventions, base classesddd-patterns.mdc - Entity, AggregateRoot, Repository, Domain Servicesapplication-layer.mdc - Application services, DTOs, validation, error handlingauthorization.mdc - Permission system and authorizationinfrastructure.mdc - Settings, Features, Caching, Events, Background Jobsdependency-rules.mdc - Layer dependencies and project structuredevelopment-flow.mdc - Development workflow for adding featuresblazor.mdc - Applied to **/*.razor, **/Blazor/**/*.csangular.mdc - Applied to **/angular/**/*.tsmvc.mdc - Applied to **/*.cshtml, **/Pages/**/*.csef-core.mdc - Applied to **/*.EntityFrameworkCore/**/*.csmongodb.mdc - Applied to **/*.MongoDB/**/*.csapp-nolayers.mdc - For single-layer web application templatemodule.mdc - For reusable module templatemicroservice.mdc - For microservice templateGood rules are focused, actionable, and scoped:
dotnet and npm.We welcome community contributions to improve these rules! You can open a PR to add new rules or improve existing ones.
Please review our Contribution Guide and Code of Conduct before contributing.