From acc
Generates InMemory repository implementations for PHP 8.4 testing using array storage for CRUD operations and queries without a database.
How this skill is triggered — by the user, by Claude, or both
Slash command
/acc:create-mock-repositoryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generates InMemory (Fake) repository implementations for testing.
Generates InMemory (Fake) repository implementations for testing.
<?php
declare(strict_types=1);
namespace Tests\Fake;
use {RepositoryInterface};
use {Entity};
use {EntityId};
final class InMemory{Entity}Repository implements {RepositoryInterface}
{
/** @var array<string, {Entity}> */
private array $entities = [];
public function save({Entity} $entity): void
{
$this->entities[$entity->id()->toString()] = $entity;
}
public function findById({EntityId} $id): ?{Entity}
{
return $this->entities[$id->toString()] ?? null;
}
public function delete({Entity} $entity): void
{
unset($this->entities[$entity->id()->toString()]);
}
/** @return list<{Entity}> */
public function findAll(): array
{
return array_values($this->entities);
}
public function clear(): void
{
$this->entities = [];
}
}
Read the repository interface:
Generate InMemory implementation:
clear() for test cleanupHandle complex queries:
array_filter for criteriaarray_sliceAdd test helpers (optional):
getAll() — access internal statehas(Id $id) — check existencecount() — entity countFile placement:
tests/Fake/InMemory{Entity}Repository.phptests/Double/ directoryclear() in tearDownreferences/examples.md — Complete repository examples (User, Order, Product)references/other-fakes.md — EventDispatcher, Mailer, Clock fakesnpx claudepluginhub dykyi-roman/awesome-claude-code --plugin accGenerates DDD-compliant Repository interfaces in Domain layer and Doctrine implementations in Infrastructure for PHP 8.4. Includes optional in-memory repos and integration tests.
Generates mocks, stubs, spies, and fakes for test dependency isolation. Supports Jest/Vitest/Sinon, pytest/unittest.mock, Go/gomock, and more.
Generates Repository interfaces and EF Core implementations per aggregate root, with query methods and Unit of Work integration for .NET DDD projects.