# How Skill Installation Works for AI Agent Integration in OfficeCLI

> Learn how OfficeCLI's skill installation system enables AI agent integration. Discover how assistant guides are copied to personal skill directories for on-demand asset retrieval.

- Repository: [OfficeAI/OfficeCLI](https://github.com/iofficeai/OfficeCLI)
- Tags: internals
- Published: 2026-08-03

---

**OfficeCLI's skill installation system copies pre-built assistant guides from embedded resources into each AI agent's personal skill directory, enabling models to invoke `load_skill <skill>` to retrieve documentation and bundled assets on demand.**

The iOfficeAI/OfficeCLI repository provides a command-line interface that bridges Microsoft Office automation with AI agents like Claude, Copilot, and Cursor. The **skill installation** mechanism sits at the heart of this integration, allowing developers to package reusable Office automation expertise and distribute it to language models through a standardized protocol.

## Skill Architecture Overview

OfficeCLI organizes capabilities as **skills** — self-contained packages stored under the `skills/` directory. Each skill contains:

- A [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) file with instructions, API references, and usage patterns
- Optional bundled assets in a `reference/` subdirectory (templates, helper scripts, example files)

These resources are embedded into the CLI binary via `officecli.csproj` (lines 46‑48), ensuring portable distribution without external file dependencies.

## Command Dispatch Flow

The CLI parses `officecli skills …` subcommands in [`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs) (lines 96‑212). When the first argument matches `skill` or `skills`, execution routes to the `SkillInstaller` class.

```bash

# Primary skill commands

officecli skills list
officecli skills install <skill-name>
officecli skills install <skill-name> <agent-alias>

```

The argument parser distinguishes between global installation (all detected agents) and targeted installation (specific agent only) at lines 169‑194.

## Agent Detection and Mapping

The `SkillInstaller` class maintains a static mapping of known agent aliases to filesystem locations. This map appears near the top of [`src/officecli/Core/SkillInstaller.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/SkillInstaller.cs) (lines 26‑41):

| Alias | Target Directory |
|-------|------------------|
| `claude` | `~/.claude/skills/` |
| `copilot` | `~/.copilot/skills/` |
| `cursor` | `~/.cursor/skills/` |
| `pi` | `~/.pi/skills/` |

The installer scans for directory existence at runtime, building a dynamic list of **detected agents** rather than requiring pre-configuration.

## Core Installation Methods

### `InstallSkill(string skillName)`

Located at lines 101‑108 of [`SkillInstaller.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SkillInstaller.cs), this method:

1. Locates the embedded [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) resource for the specified skill
2. Iterates through all detected agents
3. Copies the skill files to each agent's `skills/` subdirectory
4. Generates the **trigger phrase** for MCP injection

### `InstallSkillForAgent(string skillName, string agentAlias)`

Called when an explicit agent argument is provided, targeting a single installation destination.

### `LoadSkillFile(string skillName, string relativePath)`

Supports the model-side `load_skill` invocation. When `relativePath` is null, streams the full [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md); otherwise extracts a specific bundled asset.

## Trigger Generation for MCP Integration

Lines 80‑98 of [`SkillInstaller.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SkillInstaller.cs) handle **trigger summarization** — the critical bridge between the CLI and model behavior. The system:

- Extracts a one-line summary from each [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md)
- Injects this trigger into the Model-Client-Protocol (MCP) description
- Enables automatic skill selection without requiring the model to parse full documentation

This compact trigger (typically under 200 characters) allows the AI to recognize **when** to call `load_skill` based on user intent.

## Practical Usage Examples

### List available skills and installation status

```bash
officecli skills list

```

Internally invokes `SkillInstaller.ListAvailableSkills()` (lines 110‑145), comparing embedded skill names against files present in each detected agent's directory.

### Install a skill for all detected agents

```bash
officecli skills install morph-ppt

```

Copies the [`morph-ppt/SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/morph-ppt/SKILL.md) and any `morph-ppt/reference/*` files to every agent location where the skill is not already present.

### Target a specific agent

```bash
officecli skills install morph-ppt claude

```

Bypasses agent detection, writing directly to `~/.claude/skills/morph-ppt/`.

### Model-side skill invocation

```text
load_skill morph-ppt

```

Returns the complete [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) content to the model's context window.

### Retrieve specific reference files

```text
load_skill morph-ppt --path reference/morph-helpers.py

```

Streams a single bundled asset rather than the full documentation, reducing token usage for targeted operations.

## Bundled Asset Handling

Binary resources are declared in `src/officecli/officecli.csproj` (lines 46‑48) using MSBuild's `EmbeddedResource` element:

```xml
<ItemGroup>
  <EmbeddedResource Include="skills\**\*" />
</ItemGroup>

```

At runtime, `SkillInstaller` uses assembly resource streaming to extract these files without unpacking to temporary disk locations. This approach supports GLB 3D models, PPTX templates, and Python helper scripts as first-class skill components.

## Source File Reference

| File | Responsibility |
|------|----------------|
| [`src/officecli/Program.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Program.cs) | CLI argument parsing, command routing |
| [`src/officecli/Core/SkillInstaller.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/src/officecli/Core/SkillInstaller.cs) | Installation logic, agent mapping, trigger generation |
| `src/officecli/officecli.csproj` | Resource embedding configuration |
| `skills/<name>/SKILL.md` | Per-skill documentation |
| `skills/<name>/reference/` | Optional supporting files |

## Summary

- **OfficeCLI skill installation** copies embedded [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) guides and assets into AI agent directories
- **Agent detection** is dynamic, scanning for known directory patterns rather than static configuration
- **Trigger phrases** injected via MCP enable models to auto-select skills based on context
- **Two installation modes** support both global deployment and targeted single-agent updates
- **`load_skill` endpoint** provides on-demand documentation retrieval with optional file-specific access

## Frequently Asked Questions

### What AI agents are supported by OfficeCLI skill installation?

OfficeCLI recognizes Claude, Copilot, Cursor, Pi, and extensible aliases through the static mapping in [`SkillInstaller.cs`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SkillInstaller.cs) (lines 26‑41). The system detects agents by checking for their configuration directories at runtime, so new agents can be added by updating this mapping and recompiling.

### How does the `load_skill` command work from the model's perspective?

The model receives an MCP description containing trigger phrases for each installed skill. When user context matches a trigger, the model calls `load_skill <skill>`, and OfficeCLI streams the [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) content to the model's context window via stdout. The model can also request specific files with `--path` to minimize token consumption.

### Where are skill files actually stored on disk?

Each agent maintains its own skill directory: `~/.claude/skills/`, `~/.copilot/skills/`, etc. OfficeCLI mirrors the embedded `skills/` structure into these locations, creating subdirectories per skill containing [`SKILL.md`](https://github.com/iOfficeAI/OfficeCLI/blob/main/SKILL.md) and any `reference/` contents.

### Can skills include binary files like PowerPoint templates?

Yes. The `officecli.csproj` embeds all files under `skills/**` as resources, and `LoadSkillFile` handles binary streaming. Skills commonly package `.pptx` templates, `.glb` 3D models, and `.py` helper scripts alongside their documentation.