ecs-job-patterns

Enforce Unity DOTS ECS job dependency chaining and safe job struct usage.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill ecs-job-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ecs-job-patterns
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/ecs-job-patterns
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill ecs-job-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

ecs-job-patterns helps prevent common DOTS/ECS threading and scheduling mistakes by standardizing how Unity jobs use dependencies, avoid sync points, and perform structural changes safely.

Core Features & Use Cases

  • Job scheduling with dependency discipline: Reads state.Dependency before scheduling, writes the resulting JobHandle back to state.Dependency, and avoids unsafe .Complete() calls inside OnUpdate.
  • Structural changes via ECB: Performs AddComponent/RemoveComponent/entity creation-destruction using EntityCommandBuffer.ParallelWriter rather than calling EntityManager from jobs, with correct playback group selection.
  • Correct component access patterns: Uses ComponentLookup<T> for random component access in jobs (including updating it each OnUpdate), and uses SystemAPI.Query / SystemAPI.GetSingleton for the appropriate access type.
  • Update-order guardrails: Flags architecture risk when changing UpdateBefore/UpdateAfter/UpdateInGroup without approved plan constraints.

Quick Start

Ask the agent to implement an ECS job that schedules from state.Dependency, uses EntityCommandBuffer.ParallelWriter for structural changes, and updates ComponentLookup at the start of OnUpdate.

Frequently Asked Questions about ecs-job-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I schedule safe Unity ECS jobs without causing sync points?

Schedule safe ECS jobs by reading `state.Dependency` before scheduling, writing the resulting `JobHandle` back to it, and avoiding `.Complete()` calls inside `OnUpdate` to prevent sync points.

How do I perform structural changes inside Unity DOTS jobs?

Perform structural changes inside Unity DOTS jobs by using `EntityCommandBuffer.ParallelWriter` rather than calling `EntityManager` directly, ensuring safe entity creation and component modification.

Why do I need to update ComponentLookup every OnUpdate in Unity ECS?

You must update `ComponentLookup` each `OnUpdate` before passing it into jobs to ensure safe random component access, reflecting the latest structural changes within dependency-sensitive pipelines.

What is the correct way to chain dependencies in a multi-system ECS pipeline?

Chaining dependencies in a multi-system ECS pipeline requires reading and writing `state.Dependency` correctly and respecting `UpdateBefore` and `UpdateAfter` attributes to maintain safe job execution order.

Can I use EntityManager directly inside IJobEntity or IJobChunk?

No, using `EntityManager` directly inside `IJobEntity` or `IJobChunk` is unsafe. You must use an `EntityCommandBuffer.ParallelWriter` singleton matched to the intended playback group.

What are the limitations of changing UpdateBefore or UpdateAfter attributes in ECS?

Changing `UpdateBefore`, `UpdateAfter`, or `UpdateInGroup` introduces architecture risk by disrupting dependency-sensitive pipelines, requiring an approved plan constraint to maintain safe job scheduling.