abp-dependency-rules

Validates project reference directions and layer separation in ABP-based .NET solutions.

Updated Jul 21, 2026
One-click install
npx skills add https://github.com/afonsoft/gamehub --skill abp-dependency-rules-afonsoft
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: abp-dependency-rules
Source: https://github.com/afonsoft/gamehub/tree/main/.claude/skills/abp-dependency-rules
Command: npx skills add https://github.com/afonsoft/gamehub --skill abp-dependency-rules-afonsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When working on ABP/ASP.NET Boilerplate solutions, it is easy to introduce incorrect project references—such as injecting DbContext into application services or letting the domain layer depend on application logic—which breaks the layered architecture and makes the codebase hard to maintain. ## Core Features & Use Cases - Layer Dependency Validation: Defines which ABP projects (Domain.Shared, Domain, Application.Contracts, Application, EntityFrameworkCore, HttpApi, Host) may reference each other and flags violations. - Repository Pattern Enforcement: Ensures data access goes through repository interfaces defined in Domain with implementations in EntityFrameworkCore or MongoDB projects, never direct DbContext usage. - Multi-Application Guidance: Covers vertical separation rules for solutions with multiple application layers (e.g., Admin and Public APIs) that share a common domain. - Use Case: When adding a new feature or reviewing a pull request, use this Skill to verify that new entities, DTOs, repository interfaces, and controllers are placed in the correct project and that no cross-layer violations were introduced. ## Quick Start Review my ABP solution structure and check whether the new project references I added follow the correct layer dependency rules.

Frequently Asked Questions about abp-dependency-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if my ABP project references are correct?▼

Verify that references flow downward only: Domain.Shared is referenced by all, Domain by Application and data layers, Application.Contracts by Application and HttpApi, and EntityFrameworkCore only by Host. Any upward reference is a violation.

Where should repository interfaces and implementations go in ABP?▼

Repository interfaces belong in the Domain project, typically extending IRepository<TEntity, TKey>. Implementations belong in the EntityFrameworkCore or MongoDB project, keeping the domain independent of any specific database technology.

Can the Application layer use DbContext directly in ABP?▼

No, application services must use repository abstractions like IBookRepository instead of DbContext. Direct DbContext access breaks database independence and couples the application layer to a specific ORM.

Can Admin and Public application layers reference each other in ABP?▼

No, vertical application layers must not reference each other. They should share logic only through the common Domain project, and each vertical maintains its own DTOs even if they appear similar.

Why is returning IQueryable from a repository interface a problem?▼

Exposing IQueryable leaks persistence details through the abstraction and lets callers bypass the repository's query control. Return concrete types or DTOs instead to keep the data access layer properly encapsulated.