apex-enterprise-patterns

Implement fflib enterprise patterns for Salesforce Apex apps.

2|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill apex-enterprise-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: apex-enterprise-patterns
Source: https://github.com/bhanu91221/claude-sfdx-iq/tree/main/skills/apex-enterprise-patterns
Command: npx skills add https://github.com/bhanu91221/claude-sfdx-iq --skill apex-enterprise-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a structured architecture for Salesforce Apex apps by implementing fflib enterprise patterns (Application factory, UnitOfWork, Selector base, Domain base, and Service layer).

Core Features & Use Cases

  • Multi-layer architecture with Service, Domain, Selector, and UnitOfWork for scalable, maintainable code
  • Application factory wiring that enables easy mocking in tests
  • Consistent DML batching, testability, and pattern-guided best practices across Salesforce implementations

Quick Start

Install the apex-enterprise-patterns module in your Salesforce project and start wiring services with the Application factory, Domain, Selector, and UnitOfWork.

Frequently Asked Questions about apex-enterprise-patterns

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

FAQPage Schema
How do I structure Salesforce Apex applications using enterprise patterns?

Salesforce Apex applications are structured using fflib enterprise patterns that separate logic into Service, Domain, Selector, and UnitOfWork layers, enabling scalable architecture and consistent domain-driven behavior across multiple sObjects.

How do I mock Apex classes for unit testing in Salesforce?

Mocking Apex classes for unit testing is achieved through the fflib Application factory, which wires dependencies and allows test classes to inject mock implementations of Domain, Selector, and Service layers.

When do I need fflib patterns for Salesforce Apex?

You need fflib patterns for complex Salesforce deployments requiring scalable architecture, structured layering, testability, and consistent DML batching orchestration across multiple sObjects.

What is the Apex UnitOfWork pattern and how does it manage DML?

The Apex UnitOfWork pattern manages DML by orchestrating consistent database transactions and batching operations, ensuring that record updates across domain layers are committed or rolled back together.

Can I use Apex enterprise patterns for existing Salesforce implementations?

Yes, Apex enterprise patterns can be applied to existing Salesforce implementations by progressively wiring services with the Application factory, Domain constructors, and Selector base to refactor logic into structured layers.