Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AMAP ML SkillClaw Skill Injection

From Leeroopedia
Knowledge Sources
Domains Prompt_Engineering, Skill_Management
Last Updated 2026-10-22 00:00 GMT

Overview

A skill injection mechanism that appends a structured XML skill catalog to the LLM system message, enabling the model to discover and lazily load relevant skills on demand.

Description

Skill injection addresses the problem of making a large skill library available to an LLM without consuming excessive context tokens. Instead of injecting full skill content, the SkillClaw pattern injects a compact XML catalog listing skill names, descriptions, and file locations. The model is instructed to use a `read` tool to load at most one relevant SKILL.md file when needed (lazy loading). This mirrors OpenClaw's native injection behavior. The catalog format uses `<available_skills>` XML with `<name>`, `<description>`, and `<location>` per entry, fitting within a configurable character budget (`max_skills_prompt_chars`).

Usage

Use this principle when designing systems that need:

  • Large skill libraries that can't all fit in context
  • Lazy-loading patterns where the model decides what to read
  • Structured skill catalogs for LLM consumption
  • Context-efficient skill discovery

Theoretical Basis

The injection pattern is a variant of Retrieval-Augmented Generation (RAG) where:

  1. Catalog injection: A compact index (names + descriptions) is always present in the system message
  2. Lazy loading: The model uses a `read` tool to fetch full skill content only when relevant
  3. Budget control: The catalog size is bounded by `max_chars`; if exceeded, a compact format (names + locations only) is used
# Abstract algorithm (NOT real implementation)
def inject_skills(messages, skill_manager, max_chars):
    full_catalog = build_xml_catalog(skill_manager.get_all_skills())
    if len(full_catalog) <= max_chars:
        catalog = full_catalog
    else:
        catalog = build_compact_catalog(skill_manager.get_all_skills())
    instructions = "Use the read tool to load at most one SKILL.md when relevant."
    skill_text = catalog + instructions
    # Append to existing system message or insert new one
    return append_to_system_message(messages, skill_text)

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment