> ## Documentation Index
> Fetch the complete documentation index at: https://platform.kimi.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Skills

> Attach versioned skill packages or discover skills from session repositories, and understand their lifecycle and duplicate-name rules.

A **Skill** is a **file-based, reusable capability package** in Kimi Hosted Agents consisting of a `SKILL.md` file plus supporting resource files (scripts, templates, reference docs, and more). You can explicitly attach skills to an agent (attached skills), or use skills discovered from a mounted GitHub repository (repo skills) when creating a session, so the model can follow skill instructions during tasks.

## What is a skill?

Every attached skill is a file archive packaged as an immutable version and containing **exactly one** `SKILL.md`. The YAML frontmatter in `SKILL.md` declares the skill's name and description, while the body contains usage instructions written for the model; all other files in the archive are supporting resources used when executing the skill.

```markdown SKILL.md Example theme={null}
---
name: pdf-report
description: Read PDF files and generate structured summary reports
---

# PDF Summary Report

When the user asks to analyze a PDF file:

1. Run `extract.py` in this directory to extract the body text.
2. Organize the summary under "Background / Key Takeaways / Conclusion".
3. Save the output as a Markdown report in the working directory.
```

When a session runs, the platform injects each skill's name, description, and file path into the model context. Based on that metadata, the model decides when to open `SKILL.md` and use the bundled resources to complete the task.

## Official skills vs. custom skills

Skills explicitly attached to an agent (attached skills) fall into two categories by source, sharing the same versioning, file layout, and mounting rules. Repo skills discovered from GitHub repositories follow a different lifecycle; see [Use skills from GitHub repositories](#use-skills-from-github-repositories).

| | Official skills | Custom skills |
| - | - | - |
| Source | Maintained by the platform | Created by you via the API |
| Visibility | Enabled official skills are visible to all users | Visible only to members of your project |
| Archive | **Not allowed** (write endpoints return `404`) | Allowed |
| Referenced by agents | Allowed | Allowed for project members |

> [!NOTE]
>
> Official skills are read-only: you can inspect their `SKILL.md` content and reference them directly, but you cannot update or archive them. If you need customizations, create your own custom skill based on the official skill's content.

## Immutable versions and version pinning

Like agents, attached skills use immutable versions, and the two mechanisms work together:

* **Immutable upon creation**: Creating a skill produces its first immutable version; custom skill contents cannot be modified after creation.
* **Agents reference skill versions**: When creating or updating an agent, omitting `version` pins the latest version available at write time; specifying an exact version pins that version; explicitly passing `"latest"` preserves that value and re-resolves it whenever the agent is read or woken up.
* **Sessions freeze agent versions**: A session freezes the agent version active at creation time. When an exact skill version is pinned, skill files inside the session never change, even after interruption and recovery.
* **Revising means creating a new skill**: To revise a skill, archive the old skill, create a new skill (with a new ID and its own version history), and update the agent's skill reference to generate a new agent version. Existing exact-version references continue using the skill version pinned at the time and remain unaffected.

## Mount agent-referenced skills

When a session starts, the platform mounts each resolved attached skill version **read-only** at a fixed path in the cloud sandbox:

```text theme={null}
/mnt/agents/skills/<skill-name>/
```

* Each skill is mounted into its own directory named after the skill's `name` declared in `SKILL.md`.
* Files are **loaded on demand** on first access rather than downloaded all at once.
* Mounts are read-only—no process in the session can modify skill files.
* An agent cannot reference the same skill more than once, and two attached skills with the same `name` collide on the same mount path, causing agent creation or update requests to be rejected. For duplicate-name rules involving repo skills, see the next section.

## Use skills from GitHub repositories

When you create a session with a mounted [GitHub repository](https://platform.kimi.ai/docs/hosted-agents/github.md), the platform discovers `SKILL.md` files once the repository is prepared for the first time, parses their names and descriptions, and records each skill's path along with its repository and the first successfully checked-out commit. During discovery, at most 1 MiB of each `SKILL.md` is read to parse its frontmatter; files that remain parseable after truncation are included, while incomplete or unparseable files are skipped. Reading the full file later is still subject to the limits of the file-reading tool.

Repo skills stay in their respective repository directories rather than using the `/mnt/agents/skills/` path. A normal resume does not rescan repositories, and adding or updating skills in the remote repository does not automatically refresh the set discovered in the current session; create a new session to refresh it.

When a repo skill and an attached skill share the same name, both are retained; repo skills with the same name from different repositories are retained as well. The skill list injected into the model distinguishes skills by their `SKILL.md` paths rather than overwriting or deduplicating them by name. This coexistence rule applies only to session-level skill aggregation and model injection; it does not relax the naming or mounting rules of the skill catalog and attached skills.

## API endpoints

The endpoints below manage only attached skills in the platform. Repo skills have no separate catalog management endpoints; their discovery and refresh follow the lifecycle of the repository session.

| Operation | Method and path |
| - | - |
| List skills | `GET /v1/skills` |
| Get skill | `GET /v1/skills/{id}` |
| List version history | `GET /v1/skills/{id}/versions` |
| Get version `SKILL.md` | `GET /v1/skills/{id}/versions/{version}/content` |
| Create skill | `POST /v1/skills` |
| Archive skill | `POST /v1/skills/{id}/archive` |
| Delete skill | `DELETE /v1/skills/{id}` |

> [!NOTE]
>
> Archive and delete apply only to custom skills; calling them on an official skill returns `404`. Both endpoints perform the same archive operation: they return `204` with an empty response body, prevent new agent versions from referencing the archived skill, and leave existing exact-version references working.

The examples below read your API key from the `KIMI_API_KEY` environment variable.

## Create a custom skill

To create a skill, submit a `multipart/form-data` request with a required **`file`** part: a `.zip` or `.skill` binary package containing `SKILL.md` and any supporting resource files. The package must contain **exactly one** `SKILL.md`—if `SKILL.md` is missing or a second one is present, creation fails with `400`.

The platform parses `name` and `description` from the `SKILL.md` frontmatter as the model-facing metadata for that version. A successful request returns `{"skill": Skill, "version": SkillVersion}`; save `skill.id` to reference the skill in your agents.

```bash cURL theme={null}
curl -X POST https://api.moonshot.ai/v1/skills \
  -H "Authorization: Bearer $KIMI_API_KEY" \
  -H "kimi-api-version: 2026-09-01-beta" \
  -F "file=@pdf-report.skill"
```

```bash CLI theme={null}
kha skills create pdf-report.skill
```

## Revise a custom skill

Custom skills cannot be modified after creation. When you need to make changes, archive the old skill, create a new skill from the updated package, and update the skill reference on your agent to produce a new agent version—existing agent versions and sessions remain unaffected. Official skills are always read-only and do not follow this workflow.

## Reference skills in an agent

When creating or updating an agent, declare skill references in the `skills` array. `version` can be omitted, pinned, or set to `"latest"`:

```json theme={null}
{
  "skills": [
    { "skill_id": "skill_01h455vb4pex5vsknk084sn02q", "version": "latest" },
    { "skill_id": "skill_01h455vb4pex5vsknk084sn02r", "version": "1" }
  ]
}
```

The first entry references the skill created above; the second entry references another skill with its version pinned to `"1"`.

When referencing attached skills through an agent's `skills` array, agent creation or update requests are rejected in any of the following cases:

* A referenced skill is not visible or has been archived, or the specified version does not exist.
* The same `skill_id` is referenced more than once within the same agent.
* Two attached skills have the same `name` (causing a mount path conflict).

Skills have only two statuses: `active` and `archived`. If a skill is later archived, previously established exact-version references remain unaffected.

## Archive a skill

You can archive custom skills that are no longer maintained. Once archived, **new agent versions can no longer reference the skill**, while existing exact-version references continue to work.

```bash cURL theme={null}
curl -X POST https://api.moonshot.ai/v1/skills/skill_01h455vb4pex5vsknk084sn02q/archive \
  -H "Authorization: Bearer $KIMI_API_KEY" \
  -H "kimi-api-version: 2026-09-01-beta"
```

```bash CLI theme={null}
kha skills archive skill_01h455vb4pex5vsknk084sn02q
```

## Limits

| Item | Maximum |
| - | - |
| Uploaded archive size (`file`) | 64 MiB |
| Total uncompressed size | 128 MiB |
| Files per archive | 256 |

## Next steps

> [card] [Attach skills to an agent](https://platform.kimi.ai/docs/hosted-agents/agents.md)
>
> Reference skills in your agent configuration and pin versions.

> [card] [Start a task with skills](https://platform.kimi.ai/docs/hosted-agents/sessions.md)
>
> Launch a task using an agent with attached skills.

> [card] [Inspect sandbox file layout](https://platform.kimi.ai/docs/hosted-agents/sandbox-reference.md)
>
> Explore the cloud sandbox filesystem and mount path layout.

> [card] [Configure tools](https://platform.kimi.ai/docs/hosted-agents/tools.md)
>
> Learn how to configure the built-in toolset.
