# Function getSkillsForTask

Skills module exports (Voyager-style skill library) - Issue #528 Split from agents.ts for file size compliance (Issue #285)

- getSkillsForTask(
  agent: IAgent,
  task: Task,
  loader: ISkillLoader,
  ): Result<readonly Skill[], SkillLoaderError>

  Gets skills appropriate for a task execution.

  Loads skills based on the agent's role and the task description, potentially including additional task-relevant skills beyond the agent's default role-based skills.

  #### Parameters

  - agent: IAgent

    The agent that will execute the task

  - task: Task

    The task to get skills for

  - loader: ISkillLoader

    The skill loader to use

  #### Returns Result<readonly Skill[], SkillLoaderError>

  Result with readonly array of skills or SkillLoaderError on failure

  #### Example

      const agent = createAgent({ id: 'agent-1', role: 'code_expert' });
      const task = { id: 'task-1', description: 'Refactor the user service' };
      const loader = createSkillLoader(library);

      const result = getSkillsForTask(agent, task, loader);
      if (result.ok) {
        console.log(`Loaded ${result.value.length} skills for task`);
      }

  - Defined in packages/nexus-agents/src/agents/skills/skill-loader-integration.ts:77