[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KG36F5RACFC00QW39W7YHB":3,"skill-same:01M6KG36F5RACFC00QW39W7YHB":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":54,"updatedAt":55,"install":56,"resources":68},"01M6KG36F5RACFC00QW39W7YHB","cross-entity-lookup",null,"Read component data from entities not in the current iteration — either via a snapshot copy (ToComponentDataArray) for simple read-only cases, or via ComponentLookup for random access by entity ID.","dyCuong03\u002Funity-agent-team","dyCuong03","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F137050365?v=4","01M6KFXC85HQHXZJC2VC1KY6EZ","CuongND","01M6KFXCCHP6CD5MTA8NECJC36",8,"MIT","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Funity-dots\u002Fcross-entity-lookup\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"cross entity lookup","lookup","entity","query","for","true","read-only","random","via","id","iteration","component","either","simple","only","snapshot","read","access","data","core","2026-11-10 10:12:30",false,"﻿---\nname: cross-entity-lookup\ndescription: Read component data from entities not in the current iteration — either via a snapshot copy (ToComponentDataArray) for simple read-only cases, or via ComponentLookup for random access by entity ID.\ntags: [core, query]\nmetadata:\n  internal-only: true\n  tier: 3\n---\n\n# Cross-Entity Lookup\n\n## Intent\nRead component data from entities not in the current iteration — either via a snapshot copy (ToComponentDataArray) for simple read-only cases, or via ComponentLookup for random access by entity ID.\n\n## Use When\nSpatial queries, targeting, nearest-neighbour, graph traversal, or any system where entity A needs to read data from entity B that is not co-iterated.\n\n## Avoid When\nThe relationship is static and can be expressed as a component reference (Entity field) — use ComponentLookup with a pre-stored entity handle. Avoid ToComponentDataArray for entity counts above ~10k per frame due to copy cost.\n\n## Senior Pattern\n- Snapshot approach: `var data = query.ToComponentDataArray\u003CT>(Allocator.Temp)` — simple, read-only, disposed at end of OnUpdate.\n- Job-accessible snapshot: `query.ToArchetypeChunkArray(state.WorldUpdateAllocator)` — passes chunk array to job without per-element copy.\n- Random access in job: `ComponentLookup\u003CT> lookup = SystemAPI.GetComponentLookup\u003CT>(true)` — pass to job, access via `lookup[entity]`.\n- Always mark ComponentLookup `[ReadOnly]` in the job if not writing — prevents false write dependencies.\n- Use `state.WorldUpdateAllocator` (not `Allocator.Temp`) for data passed to jobs.\n\n## Code Template\n```csharp\n\u002F\u002F Snapshot read (simple, main-thread):\nvar enemyPositions = m_EnemyQuery\n    .ToComponentDataArray\u003CLocalTransform>(Allocator.Temp);\n\u002F\u002F ... use enemyPositions ...\nenemyPositions.Dispose();\n\n\u002F\u002F ComponentLookup in a job:\n[BurstCompile]\npartial struct TargetingJob : IJobEntity\n{\n    [ReadOnly] public ComponentLookup\u003CHealth> HealthLookup;\n\n    void Execute(ref TargetSelector selector, in PotentialTargets targets)\n    {\n        for (int i = 0; i \u003C targets.Count; i++)\n        {\n            var h = HealthLookup[targets[i]];\n            if (h.Current > 0) { selector.Best = targets[i]; break; }\n        }\n    }\n}\n\n\u002F\u002F In OnUpdate:\nstate.Dependency = new TargetingJob\n{\n    HealthLookup = SystemAPI.GetComponentLookup\u003CHealth>(true)\n}.ScheduleParallel(state.Dependency);\n```\n\n## Anti-Patterns\n- Using Allocator.Temp for data passed to a job — Allocator.Temp is scoped to the main thread frame; jobs may outlive it.\n- Not marking ComponentLookup [ReadOnly] when only reading — serialises parallel jobs unnecessarily.\n- Calling EntityManager.GetComponentData\u003CT>(entity) inside a per-entity loop — one managed call per entity, defeats ECS performance model.\n- ToComponentDataArray on a very large query every frame — O(n) copy cost.\n\n## Runtime Risks\n- Allocator.Temp data in a job: dangling pointer, memory corruption, or safety exception.\n- Non-readonly ComponentLookup in parallel job: safety system reports write conflict.\n\n## Performance Notes\n- Allocator.Temp: cheapest for data created, used, and discarded within one main-thread frame.\n- WorldUpdateAllocator: lives one frame, job-accessible, cheaper than Persistent.\n- ComponentLookup has cache-miss penalty vs sequential iteration — acceptable for sparse lookups, costly for dense O(n²) patterns.\n\n## Architecture Guidance\nCross-entity reads are a common performance hotspot. For dense many-to-many relationships, consider spatial partitioning (NativeMultiHashMap by cell) rather than O(n²) ComponentLookup.\n","# Cross-Entity Lookup\n\n## Intent\nRead component data from entities not in the current iteration — either via a snapshot copy (ToComponentDataArray) for simple read-only cases, or via ComponentLookup for random access by entity ID.\n\n## Use When\nSpatial queries, targeting, nearest-neighbour, graph traversal, or any system where entity A needs to read data from entity B that is not co-iterated.\n\n## Avoid When\nThe relationship is static and can be expressed as a component reference (Entity field) — use ComponentLookup with a pre-stored entity handle. Avoid ToComponentDataArray for entity counts above ~10k per frame due to copy cost.\n\n## Senior Pattern\n- Snapshot approach: `var data = query.ToComponentDataArray\u003CT>(Allocator.Temp)` — simple, read-only, disposed at end of OnUpdate.\n- Job-accessible snapshot: `query.ToArchetypeChunkArray(state.WorldUpdateAllocator)` — passes chunk array to job without per-element copy.\n- Random access in job: `ComponentLookup\u003CT> lookup = SystemAPI.GetComponentLookup\u003CT>(true)` — pass to job, access via `lookup[entity]`.\n- Always mark ComponentLookup `[ReadOnly]` in the job if not writing — prevents false write dependencies.\n- Use `state.WorldUpdateAllocator` (not `Allocator.Temp`) for data passed to jobs.\n\n## Code Template\n```csharp\n\u002F\u002F Snapshot read (simple, main-thread):\nvar enemyPositions = m_EnemyQuery\n    .ToComponentDataArray\u003CLocalTransform>(Allocator.Temp);\n\u002F\u002F ... use enemyPositions ...\nenemyPositions.Dispose();\n\n\u002F\u002F ComponentLookup in a job:\n[BurstCompile]\npartial struct TargetingJob : IJobEntity\n{\n    [ReadOnly] public ComponentLookup\u003CHealth> HealthLookup;\n\n    void Execute(ref TargetSelector selector, in PotentialTargets targets)\n    {\n        for (int i = 0; i \u003C targets.Count; i++)\n        {\n            var h = HealthLookup[targets[i]];\n            if (h.Current > 0) { selector.Best = targets[i]; break; }\n        }\n    }\n}\n\n\u002F\u002F In OnUpdate:\nstate.Dependency = new TargetingJob\n{\n    HealthLookup = SystemAPI.GetComponentLookup\u003CHealth>(true)\n}.ScheduleParallel(state.Dependency);\n```\n\n## Anti-Patterns\n- Using Allocator.Temp for data passed to a job — Allocator.Temp is scoped to the main thread frame; jobs may outlive it.\n- Not marking ComponentLookup [ReadOnly] when only reading — serialises parallel jobs unnecessarily.\n- Calling EntityManager.GetComponentData\u003CT>(entity) inside a per-entity loop — one managed call per entity, defeats ECS performance model.\n- ToComponentDataArray on a very large query every frame — O(n) copy cost.\n\n## Runtime Risks\n- Allocator.Temp data in a job: dangling pointer, memory corruption, or safety exception.\n- Non-readonly ComponentLookup in parallel job: safety system reports write conflict.\n\n## Performance Notes\n- Allocator.Temp: cheapest for data created, used, and discarded within one main-thread frame.\n- WorldUpdateAllocator: lives one frame, job-accessible, cheaper than Persistent.\n- ComponentLookup has cache-miss penalty vs sequential iteration — acceptable for sparse lookups, costly for dense O(n²) patterns.\n\n## Architecture Guidance\nCross-entity reads are a common performance hotspot. For dense many-to-many relationships, consider spatial partitioning (NativeMultiHashMap by cell) rather than O(n²) ComponentLookup.\n",{"name":5,"tags":44,"metadata":45,"description":7},[38,22],{"tier":46,"internal-only":47},3,true,"main","fe4746b9f07e6c7c2b6d3932002183af9b9f6fa2",".claude\u002Fskills\u002Funity-dots\u002Fcross-entity-lookup",0,"https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team","https:\u002F\u002Fgithub.com\u002FdyCuong03","Game developer","2026-07-25 22:22:25",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":47},[58,61,64],{"tool":59,"command":60},"npx","npx skills add dyCuong03\u002Funity-agent-team --skill cross-entity-lookup",{"tool":62,"command":63},"bunx","bunx skills add dyCuong03\u002Funity-agent-team --skill cross-entity-lookup",{"tool":65,"command":66},"pnpm","pnpm dlx skills add dyCuong03\u002Funity-agent-team --skill cross-entity-lookup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Funity-dots\u002Fcross-entity-lookup\u002FSKILL.md",[],[70,95,119,138,156,177],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":39},"01M6KH55FFS00ET877QSMRYGX4","dots-update-groups","How to choose the right ECS system group and ordering so per-frame and per-fixed-step work is deterministic and never races its own readers. Covers InitializationSystemGroup \u002F SimulationSystemGroup \u002F PresentationSystemGroup \u002F FixedStepSimulationSystemGroup \u002F VariableRateSimulationSystemGroup, UpdateBefore \u002F UpdateAfter peer ordering, OrderFirst \u002F OrderLast group-boundary placement, RateManager, and the cross-group ordering trap. Use when adding an ISystem, fixing \"value visible one frame late\" bugs, or coupling simulation to a fixed timestep.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Fworkspace\u002Fdots-program\u002Fscratch\u002Fwave-2-orchestrator-drafts\u002Fdots-update-groups\u002FSKILL.md",[],[77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94],"update","dots update groups","boundary","simulation","how","system","choose","work","use","never","peer","deterministic","how to","coupling","ecs","bugs","frame","value",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":39},"01M6KH50PWYEFQDCGYBZ0326F1","dots-transform-patterns","The Entities 1.x transform model — LocalTransform (writable input) vs LocalToWorld (system-owned matrix), Parent\u002FChild hierarchy, reparenting cost, uniform vs non-uniform scale (PostTransformMatrix), and when to opt out with custom transform systems. Use when designing parent\u002Fchild hierarchies, runtime reparenting (mount\u002Fdismount\u002Fsocket), or choosing transform components at the Baker boundary.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Fworkspace\u002Fdots-program\u002Fscratch\u002Fwave-2-orchestrator-drafts\u002Fdots-transform-patterns\u002FSKILL.md",[],[102,103,104,105,79,82,106,107,85,108,109,110,111,112,113,114,115,116,117,118],"patterns","transform","dots transform patterns","components","mount","model","cost","runtime","systems","input","with","matrix","socket","at","child","custom","hierarchy",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":39},"01M6KH4VW4MA14DQW4KQYPFT0S","dots-singleton-patterns","Model cross-system shared configuration and game state as a single-entity component with a strict single-writer contract. Covers RequireForUpdate gating, SystemAPI.GetSingleton \u002F GetSingletonRW \u002F HasSingleton \u002F TryGetSingleton, bake-time vs runtime-created vs ECB-system singletons, the \"exactly one entity\" runtime invariant, and the single-writer rule. Use when designing frame-stable global config, shared mutable state, or any component intended to exist on exactly one entity.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Fworkspace\u002Fdots-program\u002Fscratch\u002Fwave-2-orchestrator-drafts\u002Fdots-singleton-patterns\u002FSKILL.md",[],[102,126,127,30,128,129,130,82,107,85,131,132,133,109,134,135,112,93,136,137],"singleton","dots singleton patterns","config","state","game","writer","time","shared","contract","as","ecb","gating",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":39},"01M6KH4PR076AYNDZHD63HHWX6","dots-hybrid-bridge","The one-way bridge between DOTS-owned runtime state and Unity-owned presentation. Covers UnityObjectRef for managed asset refs in components, the DOTS-writes \u002F Unity-reads ownership rule, when to use managed IComponentData vs UnityObjectRef vs CompanionComponent, baker-bridge vs runtime-bridge, and SubScene boundary rules. Use when an entity must reference Unity assets (Mesh, Material, AudioClip, ScriptableObject), a MonoBehaviour view must read entity state, or input\u002FUI must trigger ECS work.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Fworkspace\u002Fdots-program\u002Fscratch\u002Fwave-2-orchestrator-drafts\u002Fdots-hybrid-bridge\u002FSKILL.md",[],[145,146,147,148,105,129,79,149,150,84,35,151,85,109,152,153,111,154,23,155],"bridge","hybrid","dots hybrid bridge","mesh","assets","Rules","view","trigger","unity","material","managed",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":39},"01M6KH4FGRQ9AP2ND5H5HX4D83","dots-event-driven-ecs","Model one-frame events and external requests in ECS without dual ownership, polling, or persistent state leaks. Covers request-tag pattern with ECB, enableable command components (no structural change), event buffers (IBufferElementData), explicit consumer ownership, one-frame latency rules, and the banned C# event \u002F UnityEvent \u002F static bus anti-patterns. Use when input\u002FUI\u002Fnetwork must trigger ECS work, when a one-frame signal fans out to N consumers (damage, hit, collision), or when state changes must be processed exactly once.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Fworkspace\u002Fdots-program\u002Fscratch\u002Fwave-2-orchestrator-drafts\u002Fdots-event-driven-ecs\u002FSKILL.md",[],[163,164,91,165,166,105,167,168,169,107,84,170,171,102,172,173,111,174,175,176],"event driven","driven","event","dots event driven ecs","change","ui","network","command","anti-patterns","pattern","structural","events","static","request",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":39},"01M6KH4BWRGCEBJ8PKCKCSGT33","valid_skill","A complete, well-formed test fixture skill for SkillHub validation testing. Covers basic task routing and code review for Unity projects.","https:\u002F\u002Fgithub.com\u002FdyCuong03\u002Funity-agent-team\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_skill\u002FSKILL.md",[],[184,185,186,187,188,189,190,191,192,193,194,195,196,197,153,198,23],"valid skill","valid","code review","testing","review","test","routing","code","validation","projects","fixture skill","task","fixture","basic","complete"]