SKILL.md
Complete implemented SKILL.md schema, AGH metadata, sidecar files, hook declarations, and body conventions.
- Audience
- Operators running durable agent work
- Focus
- Configuration guidance shaped for scanability, day-two clarity, and operator context.
SKILL.md is the portable skill file AGH loads into the skill catalog. A skill directory contains
the file, optional supporting resources, and optional sidecars:
<skill-name>/
SKILL.md
mcp.json
resources/AGH reads standard YAML frontmatter, then keeps the Markdown body available as procedural instructions for agents.
Quick Reference
| Field | Type | Default | Valid values | Description |
|---|---|---|---|---|
name | string | required | Non-empty. | Skill identity and catalog key. |
description | string | empty | Any string. | Catalog description. Missing descriptions log a warning. |
version | string | empty | Any string. | Skill version metadata. |
metadata | object | empty | Any YAML mapping. | Free-form metadata. AGH acts on metadata.agh. |
metadata.agh.mcp_servers | array of MCP server objects | empty | Each object requires name and command. | Skill-declared MCP servers. |
metadata.agh.hooks | array of hook objects | empty | Each object requires valid event and command. | Skill-declared runtime hooks. |
metadata.agh.memory_tags | string array | no runtime default | RFC-only today. | Parsed as metadata only; current runtime does not consume it. |
| Markdown body | Markdown text | empty accepted by parser | Procedural instructions. | Content read when the skill is used and scanned for critical abuse patterns. |
Complete Annotated Example
---
# Required. Used as the skill catalog key.
name: docs-search
# Optional by parser, but missing descriptions log a warning.
description: Search repository documentation and return file-backed answers.
# Optional metadata.
version: "1.0.0"
metadata:
agh:
# Optional. Merged into session MCP servers when the skill is active.
mcp_servers:
- name: docs-files
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
env:
LOG_LEVEL: "info"
# Optional. Declares hooks owned by this skill.
hooks:
- event: session.post_create
command: printf
args: ["docs-search loaded\n"]
mode: async
timeout: 5s
---
# Docs Search
Use this skill when the user asks for an answer that must be grounded in repository docs.
## Workflow
1. Search the relevant docs before answering.
2. Prefer current source and active task documents over archived notes.
3. Cite the file path that supports each factual claim.
## Verification
Return the exact file paths you used and call out any stale or conflicting source.Top-Level Frontmatter
| Field | Type | Default | Valid values | Description |
|---|---|---|---|---|
name | string | none | Non-empty after trimming. | Required. Missing names fail parsing. |
description | string | empty | Any string. | Optional by code, but missing descriptions warn and make the catalog less useful. |
version | string | empty | Any string. | Stored as metadata and used by marketplace provenance/update comparisons when available. |
metadata | object | empty | YAML mapping. | Free-form metadata namespace. AGH-specific fields belong under metadata.agh. |
Unknown top-level fields such as allowed-tools, user-invocable, and argument-hint are
tolerated with warnings but ignored by the current AGH runtime. Do not use those fields for access
control, invocation behavior, or permissions in AGH.
metadata.agh
AGH-specific runtime features are namespaced under metadata.agh so the file remains compatible
with other AgentSkills readers.
| Field | Type | Default | Valid values | Description |
|---|---|---|---|---|
mcp_servers | array of MCP server objects | empty | Objects listed below. | Adds MCP servers when this skill is active and trusted. |
hooks | array of hook objects | empty | Objects listed below. | Adds skill-owned runtime hooks. |
memory_tags | string array | none | RFC-only. | Current code does not use this field. |
Malformed metadata.agh values warn and are ignored when possible. Invalid hook declarations fail
skill parsing because hooks must be safe to register.
metadata.agh.mcp_servers
| Field | Type | Default | Valid values | Description |
|---|---|---|---|---|
name | string | required | Non-empty. | MCP server key. Missing names warn and skip the entry. |
command | string | required | Non-empty. | MCP server command. Missing commands warn and skip the entry. |
args | string array | empty | Strings. | Command arguments. |
env | string map | empty | String keys and values. | Literal environment values. AGH does not expand shell placeholders. |
Skill MCP behavior depends on skill source:
| Source | MCP behavior |
|---|---|
| Bundled, user, additional root, workspace | MCP servers are allowed. |
| Marketplace | MCP servers are blocked unless [skills].allowed_marketplace_mcp includes the skill slug, registry:slug, or verified hash. |
When multiple active skills declare the same trimmed server name, the later skill in source precedence replaces the earlier skill's server. The resolved skill MCP list is then merged into the session MCP list after config, provider, and agent MCP servers.
metadata.agh.hooks
| Field | Type | Default | Valid values | Description |
|---|---|---|---|---|
event | string | required | Current dot-form hook event. | Event that triggers the hook. Legacy names such as on_session_created are rejected. |
command | string | required | Non-empty subprocess command. | Command executed by the hook. |
args | string array | empty | Strings. | Command arguments. |
env | string map | empty | String keys and values. | Explicit hook environment values. |
timeout | duration | 0s; subprocess executor uses 5 seconds when zero. | Non-negative Go duration. | Hook timeout. |
mode | string | async | sync or async; sync only for sync-eligible events. | Dispatch mode. |
priority | integer | Skill source default when omitted. | Integer. | Ordering priority. |
matcher | object | empty | Hook matcher fields. | Narrows eligibility. |
Supported matcher fields are agent_name, agent_type, workspace_id, workspace_root,
session_type, input_class, acp_event_type, turn_id, tool_name, tool_namespace,
tool_read_only, decision_class, message_role, message_delta_type, compaction_reason, and
compaction_strategy.
Marketplace skill hooks are trust-gated by [skills].allowed_marketplace_hooks, using the same
slug, registry:slug, or hash forms as marketplace MCP trust.
Hook Event Names
Use current dot-form event names:
session.pre_create
session.post_create
session.pre_resume
session.post_resume
session.pre_stop
session.post_stop
input.pre_submit
prompt.post_assemble
event.pre_record
event.post_record
automation.job.pre_fire
automation.job.post_fire
automation.trigger.pre_fire
automation.trigger.post_fire
automation.run.completed
automation.run.failed
agent.pre_start
agent.spawned
agent.crashed
agent.stopped
turn.start
turn.end
message.start
message.delta
message.end
tool.pre_call
tool.post_call
tool.post_error
permission.request
permission.resolved
permission.denied
context.pre_compact
context.post_compactMarkdown Body
The body after frontmatter is the procedural instruction payload. The parser accepts an empty body, but an empty skill does not provide useful instructions.
Useful skill bodies usually contain:
| Section | Purpose |
|---|---|
| When to use | Trigger conditions for activating the skill. |
| Inputs | Files, commands, external systems, or assumptions to inspect. |
| Workflow | Ordered steps the agent should follow. |
| Verification | Concrete checks that prove the skill's work is correct. |
| Edge cases | Mistakes to avoid. |
| Resources | Relative files the agent can read from the skill directory. |
AGH scans skill content for critical prompt-injection, destructive command, and credential extraction patterns. Critical warnings block the skill from loading. Warning-level findings are logged. Content over 50,000 characters produces an info warning.
MCP Sidecar
Place mcp.json next to SKILL.md when MCP configuration is generated or easier to maintain as
JSON:
<workspace>/.agh/skills/workspace-files/
SKILL.md
mcp.json{
"mcpServers": {
"workspace-files": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
"env": {
"LOG_LEVEL": "info"
}
}
}
}If frontmatter and sidecar JSON declare the same server name, the sidecar replaces the whole frontmatter server object. See mcp.json for the shared JSON schema.
Skill-local sidecars are loaded only when they resolve inside the skill directory. AGH rejects
SKILL.md, mcp.json, and hashed resource paths that escape the approved skill root through
symlinks.
Marketplace Provenance Sidecar
Marketplace-installed skills include .agh-meta.json next to SKILL.md. Users normally do not
author this file.
{
"hash": "sha256-directory-hash",
"registry": "clawhub",
"slug": "@team/docs-search",
"version": "1.0.0",
"installed_at": "2026-04-16T12:00:00Z"
}All fields are required. AGH recomputes the installed directory hash, excluding .agh-meta.json,
and blocks marketplace skills whose stored hash does not match.
Discovery Limits
| Behavior | Value |
|---|---|
| File name | SKILL.md |
| Maximum scan depth | 4 directories below each scan root |
| Maximum candidates per scan root | 300 |
| Skipped directories | .git, node_modules, and hidden directories except .agh and .agents |
| Filesystem source precedence | Bundled, marketplace, user, additional root, workspace |
Higher-precedence skills with the same name override lower-precedence skills.
Live runtime-registered skills from enabled extensions are an additional overlay layer, but they are not discovered from scan roots. Use Skills Overview for the full active-registry precedence model.
RFC 002 Drift
| Field or behavior | Current implementation |
|---|---|
metadata.agh.memory_tags | RFC-only; current runtime does not consume it. |
allowed-tools | Tolerated as an unknown top-level field, but ignored by AGH. |
user-invocable | Tolerated, but ignored. |
argument-hint | Tolerated, but ignored. |
Legacy hook events on_session_created, on_session_stopped | Rejected. Use session.post_create and session.post_stop. |
| Unknown top-level fields | Warn and continue. |
| Unknown hook fields | Fail hook decoding. |
Related Pages
- config.toml documents skill marketplace trust gates.
- mcp.json documents sidecar validation and replacement.
- Skills Overview explains catalog source precedence.