スキル一覧に戻る
narehart

ecs-entities

by narehart

0🍴 0📅 2026年1月8日
GitHubで見るManusで実行

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

  1. Must add to world - Factory must call world.add()
  2. Props interface - All parameters via single props object
  3. Return entity - Return the created entity for chaining
  4. Spread optional components - Use conditional spread for optional components
  5. 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.

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

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

レビュー

💬

レビュー機能は近日公開予定です