acc-create-repository
Generates DDD Repository interfaces and implementation stubs for PHP 8.5. Creates domain interfaces in Domain layer, implementation in Infrastructure.
Best use case
acc-create-repository is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Generates DDD Repository interfaces and implementation stubs for PHP 8.5. Creates domain interfaces in Domain layer, implementation in Infrastructure.
Teams using acc-create-repository should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/acc-create-repository/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How acc-create-repository Compares
| Feature / Agent | acc-create-repository | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generates DDD Repository interfaces and implementation stubs for PHP 8.5. Creates domain interfaces in Domain layer, implementation in Infrastructure.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Repository Generator
Generate DDD-compliant Repository interfaces and implementation stubs.
## Repository Characteristics
- **Interface in Domain**: Contract defined in Domain layer
- **Implementation in Infrastructure**: Doctrine/Eloquent/etc. implementation
- **Works with Aggregates**: Not entities directly
- **Collection-like**: Find, save, remove operations
- **No business logic**: Only persistence operations
---
## Generation Process
### Step 1: Generate Interface
**Path:** `src/Domain/{BoundedContext}/Repository/`
1. `{AggregateRoot}RepositoryInterface.php` — Domain contract
### Step 2: Generate Implementation
**Path:** `src/Infrastructure/Persistence/Doctrine/`
1. `Doctrine{AggregateRoot}Repository.php` — Doctrine implementation
### Step 3: Generate In-Memory Repository (Optional)
**Path:** `tests/Infrastructure/Persistence/`
1. `InMemory{AggregateRoot}Repository.php` — For unit testing
### Step 4: Generate Integration Tests
**Path:** `tests/Integration/Infrastructure/Persistence/`
---
## File Placement
| Component | Path |
|-----------|------|
| Interface | `src/Domain/{BoundedContext}/Repository/` |
| Doctrine Impl | `src/Infrastructure/Persistence/Doctrine/` |
| In-Memory | `tests/Infrastructure/Persistence/` |
| Integration Tests | `tests/Integration/Infrastructure/Persistence/` |
---
## Naming Conventions
| Component | Pattern | Example |
|-----------|---------|---------|
| Interface | `{AggregateRoot}RepositoryInterface` | `OrderRepositoryInterface` |
| Doctrine Impl | `Doctrine{AggregateRoot}Repository` | `DoctrineOrderRepository` |
| In-Memory | `InMemory{AggregateRoot}Repository` | `InMemoryOrderRepository` |
---
## Quick Template Reference
### Interface
```php
interface {AggregateRoot}RepositoryInterface
{
public function findById({AggregateRoot}Id $id): ?{AggregateRoot};
public function save({AggregateRoot} $aggregate): void;
public function remove({AggregateRoot} $aggregate): void;
public function nextIdentity(): {AggregateRoot}Id;
}
```
### Doctrine Implementation
```php
final readonly class Doctrine{AggregateRoot}Repository implements {AggregateRoot}RepositoryInterface
{
public function __construct(
private EntityManagerInterface $em
) {}
public function findById({AggregateRoot}Id $id): ?{AggregateRoot}
{
return $this->em->find({AggregateRoot}::class, $id->value);
}
public function save({AggregateRoot} $aggregate): void
{
$this->em->persist($aggregate);
$this->em->flush();
}
public function remove({AggregateRoot} $aggregate): void
{
$this->em->remove($aggregate);
$this->em->flush();
}
public function nextIdentity(): {AggregateRoot}Id
{
return {AggregateRoot}Id::generate();
}
}
```
### In-Memory Implementation
```php
final class InMemory{AggregateRoot}Repository implements {AggregateRoot}RepositoryInterface
{
private array $items = [];
public function findById({AggregateRoot}Id $id): ?{AggregateRoot}
{
return $this->items[$id->value] ?? null;
}
public function save({AggregateRoot} $aggregate): void
{
$this->items[$aggregate->id()->value] = $aggregate;
}
public function clear(): void
{
$this->items = [];
}
}
```
---
## Design Rules
| Rule | Good | Bad |
|------|------|-----|
| Layer Placement | Interface in Domain | Interface in Infrastructure |
| Aggregate Scope | Repository per aggregate root | Repository per entity |
| Query Methods | Simple filters | Business logic in queries |
| Identity | `nextIdentity()` method | External ID generation |
---
## Anti-patterns to Avoid
| Anti-pattern | Problem | Solution |
|--------------|---------|----------|
| Entity Repository | Bypasses aggregate | Only aggregate roots |
| Business Queries | Logic in repository | Use Specification pattern |
| Infrastructure Leak | Domain depends on ORM | Interface in Domain |
| Generic Repository | Too abstract | Specific per aggregate |
| Missing nextIdentity | Can't generate IDs | Add to interface |
---
## References
For complete PHP templates and examples, see:
- `references/templates.md` — Interface, Doctrine, In-Memory, Test templates
- `references/examples.md` — Order, User repositories with Doctrine and In-Memory implementationsRelated Skills
add-repository
Add a new Git repository to the message registry for automatic message type loading. Use when the user wants to support message types from a new ROS2 repository, or when adding support for a new message package.
acc-create-value-object
Generates DDD Value Objects for PHP 8.5. Creates immutable, self-validating objects with equality comparison. Includes unit tests.
acc-create-use-case
Generates Application Use Cases for PHP 8.5. Creates orchestration services that coordinate domain objects, handle transactions, and dispatch events. Includes unit tests.
acc-create-unit-test
Generates PHPUnit unit tests for PHP 8.5. Creates isolated tests with AAA pattern, proper naming, attributes, and one behavior per test. Supports Value Objects, Entities, Services.
acc-create-test-double
Generates test doubles (Mocks, Stubs, Fakes, Spies) for PHP 8.5. Creates appropriate double type based on testing needs with PHPUnit MockBuilder patterns.
acc-create-test-builder
Generates Test Data Builder and Object Mother patterns for PHP 8.5. Creates fluent builders with sensible defaults and factory methods for test data creation.
acc-create-strategy
Generates Strategy pattern for PHP 8.5. Creates interchangeable algorithm families with context class, strategy interface, and concrete implementations. Includes unit tests.
acc-create-state
Generates State pattern for PHP 8.5. Creates state machines with context, state interface, and concrete states for behavior changes. Includes unit tests.
acc-create-specification
Generates DDD Specification for PHP 8.5. Creates reusable business rule objects for validation, filtering, and querying with composite pattern support. Includes unit tests.
acc-create-saga-pattern
Generates Saga pattern components for PHP 8.5. Creates Saga interfaces, steps, orchestrator, state management, and compensation logic with unit tests.
acc-create-retry-pattern
Generates Retry pattern for PHP 8.5. Creates resilience component with exponential backoff, jitter, and configurable retry strategies. Includes unit tests.
acc-create-responder
Generates ADR Responder classes for PHP 8.5. Creates HTTP response builders with PSR-7/PSR-17 support. Includes unit tests.