data-access

Select persistence patterns to keep infrastructure logic out of domain code.

1|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Entelligentsia/skillforge --skill data-access-entelligentsia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-access
Source: https://github.com/Entelligentsia/skillforge/tree/main/design-patterns/skills/data-access
Command: npx skills add https://github.com/Entelligentsia/skillforge --skill data-access-entelligentsia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps teams decide how to place persistence logic within a domain, avoiding leaks of infrastructure code into business logic and ensuring testability by selecting the appropriate pattern before implementing storage integration.

Core Features & Use Cases

  • Guidance on when to apply Repository, Unit of Work, Data Mapper, or Active Record depending on domain boundaries and storage needs.
  • Practical decision criteria and real-world scenarios showing how to choose the right pattern for evolving codebases.
  • Clear rules for when each pattern is preferred, with examples illustrating domain- and infrastructure-separation.

Quick Start

Analyze an existing domain module and decide which persistence pattern (Repository, Unit of Work, Data Mapper, or Active Record) to apply before adding storage logic.

Frequently Asked Questions about data-access

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

FAQPage Schema
How do I choose the right persistence pattern to keep infrastructure logic out of my domain code?

To choose the right persistence pattern, you evaluate domain boundaries and storage needs against criteria for Repository, Unit of Work, Data Mapper, and Active Record. This prevents infrastructure logic from leaking into your business domain code.

What is the difference between Repository, Unit of Work, Data Mapper, and Active Record patterns?

The difference lies in separation level: Active Record tightly couples domain models to storage, while Data Mapper isolates them entirely. Repository abstracts collections, and Unit of Work coordinates transactional writes, guiding distinct persistence strategies.

When should I use the Active Record pattern instead of the Repository pattern?

You should use the Active Record pattern when domain boundaries are simple and tightly align with storage tables, whereas the Repository pattern is preferred when you need stricter infrastructure separation and complex domain querying.

How do I apply persistence patterns to ensure realistic database testing?

You apply persistence patterns like Repository or Data Mapper to isolate domain logic, allowing tests to run against realistic databases without tightly coupling business rules to specific storage infrastructure.

What is the best way to refactor domain models that intertwine with storage concerns?

The best way to refactor domain models intertwined with storage is to analyze the existing module and select an appropriate pattern, such as Data Mapper or Unit of Work, to separate business logic from infrastructure before adding storage integration.