# Skill registry

**Last updated:** 2026-11-21T09:54:10-03:00 (UTC-3)

Distribute skills (instruction packages with a `SKILL.md`, like Claude Code's) to the right teams, with immutable revisions, explicit publishing, and a hash of every file. The admin publishes; each team sees only the skills it was given. The gateway stores and delivers: it does not install, does not execute, and does not call a model.

| Flag | What it turns on |
| --- | --- |
| `skill_registry` | Reading; requires `ui` and PostgreSQL |
| `skill_management` | Creating, publishing, and reverting (global admin) |
| `skill_entitlements` | Also requires the `skill_registry` entitlement in the team's [plan](/docs/features/entitlements/) |
| `skill_signing` | Publishing and downloading need a verified publisher signature; see [Signing](#signing) |

## How to use it

1. In **Skills**, the global admin creates a draft with an ID, name, owning team, the teams that receive it (grants), and the files.
2. Review the content and the grants. **Publishing** is a separate action; saving another draft keeps the previous publication until the new one is published.
3. Members of the granted teams see only the published revision, with a text preview and the hashes.
4. **Download** delivers a JSON file with the files.

Being the owner does not grant access: include the owning team in the grants if it should read the skill too.

From the YAML:

```yaml
features:
  skill_registry: true
  skill_management: true
skills:
  - id: request-investigation
    team: platform                 # ID of an active team
    name: Investigate a request
    description: Playbook for analyzing authorized metadata
    published: false
    allowed_teams: [platform]
    files:
      - path: SKILL.md
        content: |
          # Investigate a request
          1. Find the request ID in the authorized explorer.
          2. Check the trace ID, model, provider, and HTTP result.
          3. Record which data is missing before concluding the cause.
```

| Key | Default | What it does |
| --- | --- | --- |
| `skills[].id` | required | Unique identifier of the skill |
| `skills[].team` | required | ID of the active team that owns it |
| `skills[].name` | required | Display name |
| `skills[].description` | empty | Text shown in the inventory |
| `skills[].published` | `false` | Whether teams with access see and download it |
| `skills[].disabled` | `false` | Hides the skill without deleting its revisions |
| `skills[].allowed_teams` | `[]` | Teams besides the owner that may read and download the published skill |
| `skills[].files[].path` | required | Relative file path inside the package (rules below); one file must be `SKILL.md` |
| `skills[].files[].content` | required | The file's UTF-8 text |

**API reference**, in the console, has examples for inventory, detail, versions, download, draft, publishing, and reverting.

## Files

| Rule | Limit |
| --- | --- |
| Required file | `SKILL.md` at the root |
| Extensions | `.md`, `.txt`, `.json`, `.yaml`, `.yml` |
| Paths | Relative, unique, no `..`, `.`, or backslash |
| Files per skill | up to 32, 16 KiB each, 128 KiB total |
| Skills | up to 1,000, with 100 revisions each |

**Provenance** (optional) records where the package came from. The gateway does not fetch the source.

| Key | What it does |
| --- | --- |
| `skills[].provenance.source_url` | HTTPS address of the source repository, without query or fragment, up to 2048 bytes |
| `skills[].provenance.immutable_ref` | The commit the files came from, a 40- or 64-character SHA |
| `skills[].provenance.files_sha256` | Optional SHA-256 of the files as the gateway hashes them; when set, the declared files must match it |
 The gateway always computes the hash of the files and of the revision: this proves the package's identity, not its authorship.

## Signing

A publisher can sign a skill offline with an Ed25519 key, and the operator decides which publisher keys the gateway trusts. With `skill_signing` on, only revisions whose signature verifies with a trusted key can be published or downloaded.

The signature covers the skill ID, name, description and files (through `files_sha256`). It does not cover the owner team, the grants or the `disabled`/`published` flags: those are the administrator's distribution decisions, so changing grants keeps the signature valid, and changing a file, the name or the description needs a new signature.

1. The publisher creates a key with the offline tool (it is not part of the gateway server):

   ```bash
   go run ./cmd/skillsign keygen -private-key publisher.key
   # {"public_key":"<base64 public key>"}
   ```

2. The operator trusts that public key in the startup YAML and turns the flag on:

   ```yaml
   features:
     skill_signing: true
   skill_signing:
     trusted_keys:
       - id: publisher-1            # 1-64 lowercase letters, digits, '.', '_' or '-'
         public_key: <base64 public key>
   ```

3. The publisher signs the skill JSON (the `skill` object of the draft) and the admin saves the printed JSON as a draft, or pastes the key ID and signature in the editor's **Publisher key ID** and **Signature** fields:

   ```bash
   go run ./cmd/skillsign sign -private-key publisher.key -key-id publisher-1 skill.json > signed.json
   ```

   `skillsign payload skill.json` prints the exact bytes that are signed (`ai-gateway skill signature v1`, a newline, then the hex SHA-256 of `{"description","files_sha256","id","name"}`), for signing with another tool or a hardware key.

| Field | Default | Rule |
| --- | --- | --- |
| `skills[].signature.key_id` | none | 1-64 lowercase letters, digits, `.`, `_` or `-` |
| `skills[].signature.value` | none | Base64 (standard, padded) 64-byte Ed25519 signature |
| `skill_signing.trusted_keys[].id` | none | Unique, same pattern as `key_id`; at most 16 keys |
| `skill_signing.trusted_keys[].public_key` | none | Base64 32-byte Ed25519 public key |

The trusted keys are read only from the startup YAML: no API or console action can add one, and a change needs a restart of every replica. `skill_signing` needs `skill_registry` and at least one trusted key; while it is on, a skill declared `published: true` in YAML must carry a verified signature, or the configuration is refused (so turning the flag on with such a skill fails instead of hiding it).

What happens with the flag on:

| Action | Unsigned | Verified | Untrusted key or bad signature |
| --- | --- | --- | --- |
| Save a draft | Allowed | Allowed | `422 invalid_skill_signature` |
| Publish | `409 signature_required` | Allowed | `409 signature_required` |
| Download the bundle | `409 signature_required` | Allowed | `409 signature_required` |

The check at publication runs inside the publish transaction, on the exact revision being published. With the flag off, signatures are stored and shown but not required.

Signing gates publication and the two delivery channels (the bundle and the [installable feed](/docs/features/skill-marketplace/)). The skill detail and version reads still show the files to the readers the registry already authorizes, with the signature status, so a reviewer can see what is not verified.

The skill detail always reports `signature_status` (`unsigned`, `verified`, `untrusted_key` or `invalid`), the `signature_key_id` and `signing_required`; the console shows it under the skill name and disables **Download JSON bundle** when a required signature is missing.

**Revoking a key:** remove it from `trusted_keys` and restart. Everything it signed becomes `untrusted_key`: it can no longer be published, downloaded as a bundle or installed from the feed until it is signed again by a trusted key. To withdraw one skill instead, disable it.

## Synchronization and integrity

- The bundle answers with `ETag: "<content_hash>"`, the hash of the current revision. A client that keeps a copy sends `If-None-Match` with that tag and gets `304 Not Modified` while the publication is unchanged; any change of files, metadata, grants or signature is a new tag.
- A scoped reader only ever receives the current publication; asking for an older revision answers 404, so a client holding stale content learns it on the next sync.
- Every read recomputes the hashes of the stored revision. A row changed outside the gateway (database edit, corruption) answers `409 skill_integrity_failed` and its content is never returned.
- Replicas read the same PostgreSQL rows, so a publication, a disable or a restart without a revoked key applies to the next request on every replica.

## Who can do what

- The global admin manages; the global admin and viewer inspect drafts and history.
- Team roles see only the current publication granted to their team. The inventory does not reveal drafts.
- With `skill_entitlements`, the team receiving the grant needs the `skill_registry` entitlement in its plan; without it, the skill disappears from the inventory and the detail returns 404.
- Changes go into the audit log, without copying the content.

## Limits

- **Untrusted content:** a skill can contain instructions the client will follow. Distributing it does not prove it is safe. Do not store credentials here.
- No direct per-team writing (members propose through [submissions](/docs/features/skill-submissions/)), ZIP upload, Git sync, or execution. Coding-agent clients install through the [skills feed](/docs/features/skill-marketplace/). A signature proves which trusted key signed the content, not that the content is safe.
- If the YAML changes, team readers stop seeing the skill until the admin reviews it and saves or reverts.

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `GET /api/v1/admin/skills` | Lists the skills the caller may read |
| `GET /api/v1/admin/skills/{id}/bundle` | Downloads a skill revision as one package |
| `GET /api/v1/admin/skills/{id}/versions` | Lists a skill's revisions |
| `GET /api/v1/admin/skills/{id}/versions/{revision}` | Reads one earlier revision |
| `GET /api/v1/admin/skills/{id}` | Reads one skill; scoped roles see only its current published revision |
| `PUT /api/v1/admin/skills/{id}` | Saves a new revision of a skill at the current version |
| `DELETE /api/v1/admin/skills/{id}` | Removes a console skill, or reverts a YAML one to its declaration |

## See also

- [Skill submissions](/docs/features/skill-submissions/): members propose, a content scan runs, an admin approves or rejects.
- [Installable skills feed](/docs/features/skill-marketplace/): install granted skills in a coding-agent client.
- [Provider-native skills](/docs/features/native-skills/): skills a provider runs itself, named in a Messages request; separate from this registry.
- [MCP and agents](/docs/features/feature-mcp-agents/).
- [Plans](/docs/features/entitlements/).


## Typed files, provenance and grants

Skill files, provenance and team grants retain their existing typed schemas. A skill still requires a safe `SKILL.md` entry, bounded UTF-8 file bytes and explicitly validated immutable provenance when supplied. Shared [parameter definitions](/docs/reference/parameter-registry/) do not invent content, publication, ownership or grant defaults. Private files and hashes are not global parameter values; existing versioning, publication, authorized reads and plan ceilings remain authoritative. Schema consolidation adds no execution, archive download or network fetch.
