← スキル一覧に戻る

create-entity
by Dev-Int
Tests for help and skill :wink:
⭐ 0🍴 0📅 2026年1月16日
SKILL.md
name: create-entity description: Create a new immutable domain entity following DDD patterns. Use when user needs to create a new business entity with domain logic, value objects, and behavior methods. Generates entity class with private constructor, static factory, and domain methods.
Create Entity
Generate immutable domain entity following DDD patterns.
When to Use
- New business entity
- Domain model in BC
- Aggregate root
- Entity with domain behavior
Inputs/Outputs
| Input | Example | Output |
|---|---|---|
| bc | Admin | BC/Entities/EntityName.php |
| entity | Article | - |
| fields | ['uuid' => 'ResourceUuid', 'name' => 'NameField'] | - |
| behaviors | ['rename', 'activate'] | - |
Process
| Step | Action |
|---|---|
| Create | Use template: entity.php.tpl |
| Validate | make cs-fixer && make stan |
Structure
Entity (final, private constructor, static factory):
final class EntityName {
private function __construct(
private ResourceUuid $uuid,
private NameField $name,
) {}
public static function create(string $name): self {
return new self(ResourceUuid::generate(), NameField::fromString($name));
}
public function uuid(): ResourceUuid { return $this->uuid; }
public function name(): NameField { return $this->name; }
public function rename(string $name): void {
$this->name = NameField::fromString($name);
}
}
See: docs/GLOSSARY.md#entity for detailed definition
Rules
Class Structure:
finalclass, private constructor- Static factory:
create(),createFrom*(),reconstitute() - No public properties, no setters
Methods:
- Getters return Value Objects:
name()(notgetName()) - Behaviors modify state:
rename(),activate(),deactivate() - Validate in behaviors, encapsulate business rules
Value Objects:
- Use existing VOs:
Shared\Entities\VO\(ResourceUuid, NameField, EmailField, PriceField) - Create new VO if needed (skill:
create-value-object)
Templates
entity.php.tpl
Location: .claude/templates/
References
- Entity definition:
docs/GLOSSARY.md#entity - Entity pattern:
docs/QUICK_REF.md#entity-pattern - Architecture:
docs/architecture.md#entity
Related Skills
create-value-object- Create new Value Objectcreate-use-case- Create use case using entitycreate-repository- Create repository for entity
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓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
レビュー
💬
レビュー機能は近日公開予定です