본문으로 건너뛰기

.getSkill()

Agent의 구성된 기술(Agent 수준 및 작업 영역 기술 모두)에서 이름으로 특정 기술을 검색합니다.

사용예
사용예에 대한 직접 링크

src/routes/skills.ts
import { agent } from '../mastra/agents'

const skill = await agent.getSkill('code-review')

if (skill) {
console.log(skill.name) // "code-review"
console.log(skill.description) // "Use when reviewing code changes."
console.log(skill.instructions) // Full markdown instructions
}

매개변수
매개변수에 대한 직접 링크

skillName:

string
가져올 Skill의 이름입니다.

options?:

object
Skill 해석을 위한 옵션입니다.
object

requestContext?:

RequestContext
동적 Skill 리졸버에 전달되는 요청 컨텍스트입니다.

반환 값
반환 값에 대한 직접 링크

보고Promise<Skill | null>.

찾으면 Skill 객체를 반환하고, 해당 이름의 Skill이 없으면 null을 반환합니다.

interface Skill {
name: string
description: string
instructions: string
path: string
source: { type: string; projectPath: string }
references: string[]
scripts: string[]
assets: string[]
license?: string
compatibility?: string[]
'user-invocable'?: boolean
metadata?: Record<string, unknown>
}

병합 동작
병합 동작에 대한 직접 링크

Agent 수준 Skill과 Workspace Skill이 모두 구성된 경우 .getSkill()은 병합된 집합을 검색합니다. 이름이 충돌하면 Agent 수준 Skill이 우선합니다.