/acc:create-unit-of-workfrom acc
Generates Unit of Work pattern components for PHP 8.4 with transactional consistency, aggregate tracking, flush/rollback, and domain event collection.
Ships in acc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Creates Unit of Work pattern infrastructure for transactional consistency across multiple aggregates.
| Scenario | Example |
|---|---|
| Multi-aggregate transactions | Order + Payment + Inventory in single transaction |
| Batch persistence | Flush multiple entity changes at once |
| Change tracking | Detect dirty entities for selective updates |
| Domain event collection | Collect and dispatch events after successful commit |
| Repository coordination | Ensure all repositories share the same transaction |
Determine:
Create in this order:
Domain Layer (src/Domain/Shared/UnitOfWork/)
EntityState.php — State enum (New, Clean, Dirty, Deleted)TransactionManagerInterface.php — Transaction contractDomainEventCollectorInterface.php — Event collection contractApplication Layer (src/Application/Shared/UnitOfWork/)
UnitOfWorkInterface.php — Main portAggregateTracker.php — Identity map and change trackingInfrastructure Layer (src/Infrastructure/Persistence/UnitOfWork/)
DoctrineUnitOfWork.php — Doctrine-based implementationDoctrineTransactionManager.php — Doctrine transaction managerDomainEventCollector.php — Event collector with dispatcherTests
EntityStateTest.phpAggregateTrackerTest.phpDoctrineUnitOfWorkTest.phpFor each context (e.g., Order):
src/Application/{Context}/
└── {Context}UnitOfWorkAware.php (trait or base class)
| Layer | Path |
|---|---|
| Domain Types | src/Domain/Shared/UnitOfWork/ |
| Application Port | src/Application/Shared/UnitOfWork/ |
| Infrastructure | src/Infrastructure/Persistence/UnitOfWork/ |
| Unit Tests | tests/Unit/{Layer}/{Path}/ |
| Component | Pattern | Example |
|---|---|---|
| State Enum | EntityState | EntityState |
| Main Interface | UnitOfWorkInterface | UnitOfWorkInterface |
| Implementation | Doctrine{Name} | DoctrineUnitOfWork |
| Tracker | AggregateTracker | AggregateTracker |
| Transaction | TransactionManagerInterface | TransactionManagerInterface |
| Test | {ClassName}Test | DoctrineUnitOfWorkTest |
interface UnitOfWorkInterface
{
public function begin(): void;
public function commit(): void;
public function rollback(): void;
public function registerNew(object $entity): void;
public function registerDirty(object $entity): void;
public function registerDeleted(object $entity): void;
public function flush(): void;
}
enum EntityState: string
{
case New = 'new';
case Clean = 'clean';
case Dirty = 'dirty';
case Deleted = 'deleted';
public function canTransitionTo(self $next): bool;
}
$unitOfWork->begin();
try {
$order = $orderRepository->findById($orderId);
$order->confirm();
$unitOfWork->registerDirty($order);
$payment = Payment::create($order->totalAmount());
$unitOfWork->registerNew($payment);
$unitOfWork->flush();
$unitOfWork->commit();
} catch (\Throwable $e) {
$unitOfWork->rollback();
throw $e;
}
# Symfony services.yaml
Application\Shared\UnitOfWork\UnitOfWorkInterface:
alias: Infrastructure\Persistence\UnitOfWork\DoctrineUnitOfWork
Domain\Shared\UnitOfWork\TransactionManagerInterface:
alias: Infrastructure\Persistence\UnitOfWork\DoctrineTransactionManager
No dedicated table needed — Unit of Work operates on existing aggregate tables. Requires database that supports transactions (PostgreSQL, MySQL with InnoDB).
For complete PHP templates and test examples, see:
references/templates.md — All component templatesreferences/examples.md — Order + Payment transaction example and unit testsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc283 skills in this plugin
/access-control-knowledgeAccess Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation./adr-knowledgeAction-Domain-Responder pattern knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for ADR (web-specific MVC alternative) audits./adr-templateGenerates Architecture Decision Records (ADR) for PHP projects. Creates structured decision documentation with context, decision, and consequences./analyze-ci-configAnalyzes existing CI/CD configurations. Detects issues in GitHub Actions and GitLab CI files, checks for best practices, caching efficiency, and security concerns./analyze-ci-logsAnalyzes CI/CD pipeline logs to identify failure causes. Parses error messages, detects common failure patterns, and provides fix recommendations./analyze-coupling-cohesionAnalyzes coupling and cohesion metrics in PHP codebases. Calculates Afferent/Efferent coupling (Ca/Ce), LCOM metrics, instability index, and abstractness. Identifies highly coupled modules and low cohesion classes.Other plugins' skills for the same job