Skip to main content

Overview

Skills are SKILL.md files (YAML frontmatter + markdown prompt) that extend the agent’s behavior through prompt-level instructions. Unlike code-level tools (WASM/MCP), skills operate in the LLM context and are subject to trust-based authority attenuation.

Trust Model

Skills have two trust states that determine their authority:
  • Trusted: User-placed skills (local/workspace) with full tool access
  • Installed: Registry/external skills, restricted to read-only tools
The effective tool ceiling is determined by the lowest-trust active skill, preventing privilege escalation through skill mixing.

Trust Assignment

Skill trust is determined by location:

SKILL.md Format

Structure

Frontmatter Fields

Required

  • name: Alphanumeric, hyphens, underscores, dots. Max 64 chars. Pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$

Optional

  • version: Semantic version (default: "0.0.0")
  • description: Short summary
  • activation: When to activate this skill
  • metadata: OpenClaw-specific metadata (gating requirements)

Activation Criteria

Limits (enforced at load time):
  • Keywords: Max 20, min length 3 chars
  • Patterns: Max 5 regex patterns
  • Tags: Max 10, min length 3 chars
  • Token budget: Max 2x declared max_context_tokens

Gating Requirements

Skills can declare dependencies:
Skills failing gating checks are skipped during discovery.

Discovery and Loading

Directory Layouts

Two layouts are supported:

Flat Layout

Subdirectory Layout

Discovery Order

Earlier locations win on name collision:
  1. Workspace skills (<workspace>/skills/) - Trusted
  2. User skills (~/.ironclaw/skills/) - Trusted
  3. Installed skills (~/.ironclaw/installed_skills/) - Installed

Load-Time Validation

  1. File size: Max 64 KiB
  2. Name validation: Matches ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$
  3. Frontmatter parsing: Valid YAML
  4. Activation limits: Keywords/patterns/tags within caps
  5. Token budget: Prompt size < 2x declared max_context_tokens
  6. Gating checks: Required bins/env/config present
  7. Symlink rejection: No symlinks allowed
  8. Line ending normalization: CRLF → LF

Loading Pipeline

Activation and Selection

Scoring Algorithm

Selection Process

  1. Score all skills against incoming message
  2. Filter skills with score > 0
  3. Sort by score (descending)
  4. Take top N skills (default: 3)
  5. Check total token budget
  6. Return selected skills

Tool Attenuation

When skills are active, tool access is restricted:
Read-only tools:
  • Read
  • Glob
  • Grep
  • WebFetch
  • SkillCatalog
Write tools (blocked for Installed skills):
  • Write
  • Edit
  • Bash
  • Task
  • All other tools

Skill Injection

Skills are injected into the LLM context:

Security: Tag Breakout Prevention

Skill content is escaped to prevent tag injection:
This prevents skills from:
  • Closing their own </skill> tag prematurely
  • Injecting fake <skill trust="trusted"> blocks
  • Breaking out via mixed case, whitespace, or null bytes

Managing Skills

Via CLI

Via Tool Call

The agent can manage skills:

Programmatic API

Creating Skills

Simple Skill

Advanced Skill

ClawHub Integration

Skills can be published to and installed from ClawHub:
Published skills are installed to ~/.ironclaw/installed_skills/ with Installed trust.

Best Practices

Skill Design

  1. Focused scope: One skill per domain (writing, code review, etc.)
  2. Clear activation: Use specific keywords and patterns
  3. Token budget: Keep prompts under 2000 tokens
  4. Gating: Declare binary/config dependencies
  5. Examples: Include example interactions in the prompt

Security

  1. Trust isolation: Don’t mix trusted and installed skills for sensitive tasks
  2. Review installed skills: Always review skill content before installing
  3. Workspace override: Place custom versions in workspace to override installed skills
  4. Symlink prohibition: Never use symlinks in skills directories

Performance

  1. Keyword limits: Use < 10 keywords per skill
  2. Pattern complexity: Avoid complex regex (max 64 KiB compiled size)
  3. Token budget: Larger prompts consume more context window
  4. Selective activation: Use precise patterns to avoid activating unnecessarily

Troubleshooting

Skill Not Loading

Skill Not Activating

Tool Access Denied

Cause: Installed skill is active, restricting tools to read-only. Solution:
  1. Override the skill by placing a trusted version in workspace/user dir
  2. Remove the installed skill
  3. Use read-only tools only

Source Code

Key files:
  • src/skills/mod.rs - Module overview, types, escaping
  • src/skills/registry.rs - Discovery, loading, management
  • src/skills/parser.rs - SKILL.md parsing
  • src/skills/selector.rs - Activation scoring and selection
  • src/skills/attenuation.rs - Tool restriction based on trust
  • src/skills/gating.rs - Dependency checks (bins/env/config)
  • src/skills/catalog.rs - ClawHub integration