# MentorSkillAttribute class

> Decorates a class to register it as a MentorAgent Skill. A skill class plays a dual role:

- URL: https://docs.mentoragent.net/api/novior-mentoragent-attributes/mentorskillattribute
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent

---

- **Knowledge** — the class (or its linked `SKILL.md`) provides domain instructions: policies, rules, workflows. These are shown to the AI as a catalogue entry and loaded on demand via `load_skill` (progressive disclosure).
- **Tools** — any `[Description]` or `[MentorAction]` methods on the class are automatically registered as L1 tools on the Main Coordinator. The skill provides the HOW (policy + context); the methods provide the DO (execution).

⚠️ When the class has methods, register it in DI so MentorAgent can resolve instances:

```text title="Example"
builder.Services.AddScoped<ExpenseReportSkill>();
```

Usage:

```text title="Example"
// Dual-role skill — knowledge + executable tools
[MentorSkill(
    Name             = "expense-report",
    Description      = "Handles expense report filing, validation, and policy checks",
    InstructionsFile = "Skills/expense-report/SKILL.md")]
public class ExpenseReportSkill
{
    private readonly ExpenseRepository _repo;
    public ExpenseReportSkill(ExpenseRepository repo) => _repo = repo;

    [Description("Submits a new expense report for the current user")]
    public async Task<string> SubmitExpenseReportAsync(
        string category, decimal amount, string notes) { ... }

    [Description("Returns the reimbursement policy for a given expense category")]
    public string GetPolicyForCategory(string category) { ... }
}

// Knowledge-only skill — no methods, just instructions / policy text
[MentorSkill(
    Name        = "refund-policy",
    Description = "Return and refund rules for the online store",
    Instructions = "## Refund Policy\n- Items can be returned within 30 days...")]
public class RefundPolicySkill { }

// Auto-discovery — MentorAgent looks for Skills/{Name}/SKILL.md automatically
[MentorSkill(Name = "shipping-policy", Description = "Shipping and delivery policy")]
public class ShippingPolicySkill { }
```

## Definition

Namespace: `Novior.MentorAgent.Attributes`. Package: `Novior.MentorAgent`.

`public sealed class MentorSkillAttribute : Attribute`

```shell
dotnet add package Novior.MentorAgent
```

## Constructors

`public MentorSkillAttribute()`

## Properties

### `Description`

`public required string Description { get; init; }`

One-sentence description shown to the AI in the skill catalogue. Keep it concise — this is the only text visible before the skill is loaded.

### `Instructions`

`public string? Instructions { get; init; }`

Inline skill instructions (markdown). Takes precedence over [`MentorSkillAttribute.InstructionsFile`](https://docs.mentoragent.net/api/novior-mentoragent-attributes/mentorskillattribute#instructionsfile). Ideal for short skills; use file-based for rich, longer content.

### `InstructionsFile`

`public string? InstructionsFile { get; init; }`

Path to the skill instructions markdown file. Can be absolute or relative to the application's content root. If null, MentorAgent looks for `Skills/{Name}/SKILL.md` automatically.

### `Name`

`public required string Name { get; init; }`

Unique skill name in kebab-case (e.g. "expense-report", "shipping-policy"). Used as the key for the `load_skill` tool call.

---

- Previous: [MentorPageAttribute class](https://docs.mentoragent.net/api/novior-mentoragent-attributes/mentorpageattribute.md)
- Next: [MentorTeamAttribute class](https://docs.mentoragent.net/api/novior-mentoragent-attributes/mentorteamattribute.md)
