← Back to list

ecs-entities
by narehart
⭐ 0🍴 0📅 Jan 8, 2026
SKILL.md
name: ecs-entities description: Create ECS entity factory functions that add entities to the world
ECS Entities
Write entity factory functions in src/ecs/entities/ that create and add entities to the world.
Requirements
- File naming:
*Entity.ts(e.g.,itemEntity.ts) - Must call:
world.add()to add the entity - One entity type per file
Pattern
import { world } from '../world';
import type { Entity } from '../world';
interface CreateEntityNameProps {
// required properties
id: string;
// optional properties
optionalProp?: string | undefined;
}
export function createEntityName(props: CreateEntityNameProps): Entity {
const { id, optionalProp } = props;
const entity = world.add({
id,
// Required components
componentA: {
/* ... */
},
componentB: {
/* ... */
},
// Optional components
...(optionalProp !== undefined && {
optionalComponent: { value: optionalProp },
}),
});
return entity;
}
Rules
- Must add to world - Factory must call
world.add() - Props interface - All parameters via single props object
- Return entity - Return the created entity for chaining
- Spread optional components - Use conditional spread for optional components
- No business logic - Entity creation only, no validation or side effects
Component Structure
Components are data-only interfaces defined in src/ecs/components/:
// In src/ecs/components/ItemComponent.ts
export interface ItemComponent {
name: string;
width: number;
height: number;
stackable: boolean;
}
Add to Entity type in src/ecs/world.ts.
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/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