repository-pattern

Generate EF Core repository interfaces and implementations for aggregate roots.

69|13|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill repository-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repository-pattern
Source: https://github.com/ronnythedev/dotnet-clean-architecture-skills/tree/main/sample/POS/.claude/skills/05-repository-pattern
Command: npx skills add https://github.com/ronnythedev/dotnet-clean-architecture-skills --skill repository-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers spend time duplicating repository scaffolding for each aggregate root, re-implementing CRUD and query logic across Domain and Infrastructure layers. This skill generates a consistent repository contract and EF Core-backed implementation, reducing boilerplate and ensuring alignment with the repository pattern.

Core Features & Use Cases

  • Generates a Domain interface I{Entity}Repository that defines query and command methods (GetByIdAsync, GetAllAsync, Add, Update, Remove, ExistsAsync).
  • Generates an Infrastructure implementation {Entity}Repository that uses EF Core DbContext for data access, with unit-of-work ready integration and cancellation token support.
  • Promotes a per-aggregate-root repository approach (not per-entity) and centralizes data-access concerns behind a single repository per aggregate.

Quick Start

Create repository scaffolding for an aggregate root; for example, generate IProductRepository in the domain and ProductRepository in the infrastructure using EF Core.

Frequently Asked Questions about repository-pattern

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

FAQPage Schema
How do I generate repository patterns for EF Core aggregate roots?

To generate repository patterns for EF Core, this skill creates a Domain interface defining query and command methods alongside an Infrastructure implementation using DbContext. It scaffolds standard CRUD operations with cancellation token support for each aggregate root, reducing boilerplate.

What is the per-aggregate-root repository approach in domain-driven design?

The per-aggregate-root repository approach centralizes data-access behind a single repository for each aggregate, rather than per-entity. This skill enforces this domain-driven design principle by generating one repository interface in the Domain layer and its EF Core implementation in the Infrastructure layer.

Does this repository scaffolding support Unit of Work integration with EF Core?

Yes, this repository scaffolding supports Unit of Work integration with EF Core. The generated Infrastructure repository implementations use DbContext for data access and are designed to work within a Unit of Work pattern, ensuring transactional consistency across aggregate roots.

Can I use this to generate repository interfaces in separate Domain and Infrastructure layers?

Yes, you can use this to generate repository interfaces in separate layers. It explicitly places the repository contract in the Domain layer and the EF Core-backed implementation in the Infrastructure layer, maintaining a clean data-access separation for .NET apps.

What standard CRUD methods are included in the generated EF Core repository implementations?

The standard CRUD methods included are GetByIdAsync, GetAllAsync, Add, Update, Remove, and ExistsAsync. These methods are generated in both the Domain interface and the EF Core-backed Infrastructure implementation, complete with cancellation token support.

Related Skills