name: unity-dev-expert-tests
skill: unity-dev-expert
version: 1.0.0
cases:
  - id: no-alloc-in-update
    description: Should reject allocations in Update
    prompt: "I'm calling FindObjectsOfType<Enemy>() every frame in Update() to count enemies. Is that fine?"
    expected:
      contains_any:
        - allocat
        - GC
        - cache
        - pool
        - FindObjects
      min_length: 80
    tags: [core, performance]

  - id: physics-in-fixedupdate
    description: Should require physics in FixedUpdate
    prompt: "I'm adding force to a Rigidbody in Update(). The movement feels jittery at different framerates. Why?"
    expected:
      contains_any:
        - FixedUpdate
        - fixed timestep
        - framerate
        - physics
      min_length: 80
    tags: [core, physics]

  - id: ecs-for-large-counts
    description: Should recommend ECS for large entity counts
    prompt: "I need to simulate 50,000 projectiles simultaneously. How should I approach this?"
    expected:
      contains_any:
        - ECS
        - DOTS
        - Burst
        - Jobs
        - entities
      min_length: 100
    tags: [core, performance]

  - id: coroutine-cleanup
    description: Should require coroutine cleanup in OnDisable
    prompt: "My coroutine keeps running after the GameObject is disabled. How do I handle this?"
    expected:
      contains_any:
        - OnDisable
        - StopCoroutine
        - OnEnable
        - cleanup
      min_length: 80
    tags: [core, architecture]

  - id: server-authoritative
    description: Should enforce server authority in multiplayer
    prompt: "Can I apply damage directly on the client when the player clicks to shoot?"
    expected:
      contains_any:
        - server
        - ServerRpc
        - authoritative
        - validate
        - cheat
      not_contains:
        - yes, you can apply
        - that's fine
      min_length: 80
    tags: [core, networking]

  - id: coding-easy-object-pool
    description: "Coding challenge (easy): Write a generic object pool for Unity"
    prompt: "Write a C# generic ObjectPool<T> class for Unity where T is a Component. It should: pre-instantiate a configurable number of objects, provide Get() and Return() methods, disable returned objects and enable gotten ones, auto-expand when the pool is empty, and parent pooled objects under a container GameObject for scene hierarchy cleanliness."
    expected:
      contains_any:
        - Queue
        - Stack
        - SetActive
        - Instantiate
        - GetComponent
        - pool
      contains:
        - class
      not_contains:
        - "I can't write"
      min_length: 100
    tags:
      - coding-easy

  - id: coding-medium-state-machine
    description: "Coding challenge (medium): Implement a ScriptableObject-based state machine for AI"
    prompt: "Write a Unity AI state machine using ScriptableObject-based states. Each state should be a ScriptableObject with Enter, Execute, and Exit methods. The StateMachine MonoBehaviour should support: state transitions with conditions, a global state that runs alongside the current state, a history stack for returning to previous states, and transition cooldowns to prevent rapid state flickering."
    expected:
      contains_any:
        - ScriptableObject
        - MonoBehaviour
        - Enter
        - Exit
        - transition
        - state
      contains:
        - class
      min_length: 200
    tags:
      - coding-medium

  - id: coding-hard-ecs-damage
    description: "Coding challenge (hard): Implement a DOTS/ECS damage system for thousands of entities"
    prompt: "Write a Unity DOTS/ECS system that processes damage for thousands of entities per frame. It should: use IComponentData for Health and DamageEvent components, process damage in a Burst-compiled IJobEntity, support damage types (physical, fire, poison) with resistance calculations, emit death events when health reaches zero, and use an EntityCommandBuffer for structural changes. Target zero GC allocations."
    expected:
      contains_any:
        - IComponentData
        - IJobEntity
        - Burst
        - EntityCommandBuffer
        - SystemBase
        - partial struct
      contains:
        - struct
      min_length: 300
    tags:
      - coding-hard
