Back to list
Dev-Int

create-repository

by Dev-Int

Tests for help and skill :wink:

0🍴 0📅 Jan 16, 2026

SKILL.md


name: create-repository description: Create Repository interface and Finder interface for domain entity persistence. Use when entity needs persistence layer with commands (save, delete) and queries (find, findAll). Generates both Repository (commands) and Finder (queries) following CQRS pattern.

Create Repository

Generate Repository (commands) and Finder (queries) interfaces.


When to Use

  • Entity needs persistence
  • Implementing CQRS pattern
  • Creating persistence layer ports

Inputs/Outputs

InputExampleOutput
bcAdminBC/Entities/Repository/EntityRepository.php
entityArticleBC/UseCases/Gateway/Finder/EntityFinder.php
entityPluralArticlesUsed in findAll{EntityPlural}() method
commands['save', 'delete']-
queries['find', 'findAll']-

Note: entityPlural handles irregular plurals (Category→Categories, Entity→Entities).


Process

StepAction
RepositoryCreate interface in BC/Entities/Repository/ (template: repository.php.tpl)
FinderCreate interface in BC/UseCases/Gateway/Finder/ (template: finder.php.tpl)
Validatemake cs-fixer && make stan

Structures

Repository (commands - throws exceptions):

interface EntityRepository {
    public function getByUuid(ResourceUuid $uuid): Entity; // throws EntityNotFound
    public function save(Entity $entity): void;
    public function delete(Entity $entity): void;
}

Finder (queries - returns null/array):

interface EntityFinder {
    public function find(ResourceUuid|string $uuid): ?Entity;
    public function findAll(): array; // @return Entity[]
    public function findByName(string $name): ?Entity;
}

See: docs/GLOSSARY.md#repository-vs-finder for detailed comparison


Rules

Repository (commands):

  • Location: BC/Entities/Repository/
  • Methods: get*() MUST throw exception if not found
  • Common: getByUuid(), save(), delete()
  • Used in: Use cases that MODIFY state (Create, Update, Delete)

Finder (queries):

  • Location: BC/UseCases/Gateway/Finder/
  • Methods: find*() MAY return null or empty array
  • Common: find(), findAll(), findBy*()
  • Used in: Use cases that READ state (List, Search, Find)

CRITICAL: Repository for writes (throws), Finder for reads (returns null/array)


Templates

  • repository.php.tpl - Repository interface
  • finder.php.tpl - Finder interface

Location: .claude/templates/


References

  • Repository vs Finder: docs/GLOSSARY.md#repository-vs-finder
  • Repository pattern: docs/QUICK_REF.md#repository-pattern
  • Finder pattern: docs/QUICK_REF.md#finder-pattern

  • create-entity - Create entity first
  • create-use-case - Use repository/finder in use case

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon