---
title: "How to write a SKILL.md file: format, example, and Mods"
description: "Learn the two-part SKILL.md format with a minimal working example, invoke it in Cohub Chat via /skill:name, and share one skill across Spaces using Mods."
lang: "en"
canonical: "https://cohub.live/guides/write-skill-md-file"
image: "https://cohub.live/_seo/og/guides/write-skill-md-file.png"
updated: "2026-12-02"
---

# How to write a SKILL.md file and reuse it across Cohub Spaces

To write a SKILL.md file for Cohub, put a folder with SKILL.md (name and description in front matter, steps in the body) under .agents/skills/ in a Space; to reuse it, save that Space and mount it as a Mod wherever it is needed.

- **Who:** Developers who paste the same instructions into agent chats in more than one project.
- **When:** A procedure works well in one Space and a second project needs the same steps.
- **Why:** A Cohub skill is a folder with a SKILL.md that the agent reads only when a task matches it, and a Mod mounts that folder read-only into other Spaces, so one Save updates all of them.

![Terminal: upload the issue-digest skill folder to a team-skills Space, create a Save, and mount it as a Mod in the web-app and docs-site Spaces](https://cohub.live/_seo/img/guides/skill-share-mod-dark.webp)

Source: <https://cohub.live>

![Terminal: cohub skills ls lists /skill:issue-digest from mod:team-skills in both Spaces; the mounted folder is read-only](https://cohub.live/_seo/img/guides/skill-list-spaces-dark.webp)

Source: <https://cohub.live>

![Terminal: /skill:issue-digest writes a digest in web-app; in docs-site a plain question makes the agent read the mounted SKILL.md, run fetch.sh and write the file](https://cohub.live/_seo/img/guides/skill-invoke-dark.webp)

Source: <https://cohub.live>

A `SKILL.md` file gives an agent a repeatable procedure without pasting the same instructions into every chat. Put one folder per skill under `.agents/skills/` in a Cohub Space, keep the front matter tight so the agent knows when to pick it up, and mount that Space as a read-only Mod whenever other projects need the same workflow. Every command and output below comes from a run on `cohub.live` on 2026-11-17.

## The two parts of a SKILL.md file
As defined in [Cohub core concepts](https://cohub.live/docs/learn/core-concepts), a Skill is a folder with a required `SKILL.md` plus any helper files the steps invoke by relative path. The file itself has two sections:

- **YAML front matter** between `---` fences. Cohub reads three fields:
  - `name`: up to 64 characters of letters, digits, `.`, `_`, and `-`, starting with a letter or digit (defaults to the folder name when omitted).
  - `description`: the single line shown in the agent's skill list—state what the skill does and which requests should trigger it.
  - `disable-model-invocation: true` (optional): removes the skill from automatic selection so it only runs when someone invokes `/skill:<name>`.
- **Markdown body** below the second `---`: the numbered steps the agent receives when the skill runs, covering exact commands, output paths, and stop rules.

## A minimal file that works
Start with the smallest structure that runs end to end:

```markdown
---
name: my-skill
description: <What it does>. Use when <the requests or situations that should trigger it>.
---

# My skill

1. <First step: the exact command or file to read, with paths relative to this folder>.
2. <Where to write the result, and its format>.
3. <What to reply with, and what not to do>.
```

Here is a working skill, `issue-digest`, paired with a sibling `fetch.sh` script so the Markdown stays focused on instructions:

```text
issue-digest/
├── SKILL.md
└── fetch.sh
```

```markdown
---
name: issue-digest
description: Write a dated Markdown digest of the issues and pull requests opened on a GitHub repository in the last N hours. Use when asked for an issue digest, what is new on a repo, or a morning summary of GitHub activity.
---

# Issue digest

1. Run `bash fetch.sh <owner/repo> [hours]` from this skill's directory (default 24 hours). It prints one JSON line per issue or pull request opened in that window. Set `GITHUB_TOKEN` for private repos or higher rate limits.
2. Write `digests/<owner>-<repo>-<YYYY-MM-DD>.md` in the workspace:
   - Title: `# <owner/repo>: <n> new (<YYYY-MM-DD>)`
   - `## Issues`, then `## Pull requests`. Under each, one bullet per item, newest first: `[#<number>](<url>) <title> (@<author>)` and one plain sentence on what it asks for or changes, taken from the body. Write `None.` for an empty section.
   - `## Needs a reply`: open issues with 0 comments, or `None.`
3. Reply with the file path and the same bullets. Don't add opinions or priorities the issues don't state.
```

```bash
#!/usr/bin/env bash
# Prints one JSON line per issue or PR opened on <owner/repo> in the last [hours].
set -euo pipefail
repo="${1:?usage: fetch.sh owner/repo [hours]}"
hours="${2:-24}"
since=$(date -u -d "-${hours} hours" +%Y-%m-%dT%H:%M:%SZ)
auth=()
if [ -n "${GITHUB_TOKEN:-}" ]; then auth=(-H "Authorization: Bearer $GITHUB_TOKEN"); fi
curl -fsSL "${auth[@]}" -H "Accept: application/vnd.github+json" \
  "https://api.github.com/repos/$repo/issues?state=all&since=$since&per_page=100" |
  jq -c --arg since "$since" '.[] | select(.created_at >= $since)
    | {kind: (if .pull_request then "pr" else "issue" end), number, title, url: .html_url,
       author: .user.login, state, comments, body: ((.body // "") | .[:500])}'
```

Upload the folder into `.agents/skills/` of a Space (`team-skills`) and confirm it registers as a `project` skill (`cohub skills ls --space` currently requires the Space ID; passing a slug returns a 500 error):

```bash
cohub -s team-skills spaces files upload issue-digest --dir .agents/skills/issue-digest
cohub skills ls --space "$(cohub -s team-skills spaces get --json | jq -r .id)" | grep issue-digest
```

## Invoking it from a Chat
The [Cohub Chats composer guide](https://cohub.live/docs/workspace/chats) covers mentions, slash commands, and skills in the input bar. Once registered, a skill runs in two ways (shown in the third screenshot above):

- **Explicit slash command**: type `/skill:issue-digest <owner>/<repo> 24` in the composer, or send it with `cohub spaces prompt`. Any text after the name is forwarded to the skill. In `web-app`, that wrote `digests/cohub-2026-11-17.md` with 16 pull requests and no issues.
- **Automatic trigger via `description`**: ask a plain question such as "What was opened on a public repository in the last 24 hours? Keep a dated file of it." In `docs-site`, the agent matched the description, read `/mods/team-skills/.agents/skills/issue-digest/SKILL.md`, ran `fetch.sh`, and wrote the digest.

Note two boundaries: `@space` mentions pull another Space's context into one message without invoking skills, and skills from Mods, user config, or platform defaults require the Space's sandbox (turns running on an external harness only see the Space's own `.agents/skills` folder).

## Sharing it: mount the Space as a Mod
Rather than copying `SKILL.md` into every project, keep shared skills in one library Space (`team-skills`), save it, and mount it read-only in each consuming Space (shown in the first two screenshots above):

```bash
cohub -s team-skills spaces checkpoints create "issue-digest skill"
LIB=$(cohub -s team-skills spaces get --json | jq -r .id)
cohub -s web-app spaces mods add "$LIB" --slug team-skills -y
cohub -s docs-site spaces mods add "$LIB" --slug team-skills -y
```

Both `web-app` and `docs-site` then list `/skill:issue-digest` from `mod:team-skills`, mounted read-only at `/mods/team-skills/.agents/skills/issue-digest`. A Mod always reads the library Space's latest Save: unsaved edits stay local, while running `checkpoints create` propagated to `web-app` within 30 seconds without a restart during testing.

Adding a Mod restarts the target Space's sandbox. On a newly created Space, if `/mods/team-skills` does not appear after `mods add`, check the ID with `cohub -s <space> spaces mods ls` and run `cohub -s <space> spaces mods enable <mod-id> -y` to force a clean mount. Mounting requires read access to the library Space's files.

When two skills share a `name`, later sources take precedence: platform defaults, then Mods in mount order, then user skills, then the Space's own `.agents/skills`. A project can override a shared skill locally and revert by deleting its local folder. For how Mods fit with `@space` mentions and cross-Space handoffs, see [sharing context across Spaces with the context network](https://cohub.live/features/context-network).

## Keeping the file short
The skill body sent to the agent is capped at 100,000 characters, and shorter files stay easier for the agent to follow accurately.

Move fragile shell flags, JSON filtering, and API calls into a sibling script such as `fetch.sh` (`curl` and `jq` already ship in the default sandbox image) and call it by relative path. Keep `SKILL.md` to exact inputs, exact output paths and formatting, and explicit rules on what not to add. Remember that a skill runs with its sandbox's permissions, so external calls need network access and private endpoints need a token in the Space's environment.

Next: run this skill on a schedule and deliver the digest automatically in [a daily GitHub issues digest](https://cohub.live/guides/github-issues-digest).

## Reference in the docs

**This page:** Where a skill should live, in one Space or a shared library Space, and how changes reach the Spaces that use it.

- [Core concepts](https://cohub.live/docs/learn/core-concepts): what a Skill and a Mod are
- [Chats](https://cohub.live/docs/workspace/chats): slash commands, /skill:name and @space mentions in the composer
- [Spaces](https://cohub.live/docs/workspace/spaces): Mods in Space settings and the sandbox restart they cause

## FAQ

### Do Spaces that mount my skill get my edits automatically?

Yes, once you create a Save in the library Space. In our test the mounted copy updated within 30 seconds of the Save, with no sandbox restart. Unsaved edits don't reach other Spaces.

### Can a Space change a shared skill?

Not in place: the Mod is mounted read-only. It can add its own folder with the same name under .agents/skills, which takes priority over the Mod's version in that Space.

## Related

- [Build a daily GitHub issues digest with a scheduled prompt and a Space hook](https://cohub.live/guides/github-issues-digest): To get a GitHub issues digest every morning in Cohub, schedule a prompt that runs a digest skill in a fixed Chat, and add a Space hook that posts each new digest file to a webhook as soon as it is written.
- [Context network: share context between AI workspaces](https://cohub.live/features/context-network): Cohub's context network is how you share context between AI workspaces: @mention a Space for one message, mount it as a read-only Mod, fork a Save into a new Space, or hand work to another Space.
- [How shared AI context works when a team shares one Cohub Space](https://cohub.live/use-cases/team-shared-ai-context): Cohub provides shared AI context for teams: Chats in a Space are visible to its members, the agent works on the same files for everyone, and anyone can continue or fork a teammate's thread.

## Sources

- [Cohub docs: Core concepts (Mod, Skill)](https://cohub.live/docs/learn/core-concepts)
- [Cohub docs: Chats (slash commands and skills, mentions)](https://cohub.live/docs/workspace/chats)
- [Cohub docs: Spaces (Mods in a Space)](https://cohub.live/docs/workspace/spaces)

Updated Dec 2, 2026
