Zero Labs
Industry News / Technology

Agent Skills — Part 2: Bridging Skills with Production Tool Ecosystems

Source · Towards AI By Kihyeon Myung

From the publisher’s feed, collected in the ZeroLabs newsroom.

Generated by author.The complete implementation is available hereIntroductionSkills solve context scaling by loading expertise on demand into a single agent loop instead of splitting the agent itself (see Part 1 for the full argument). But the native implementation assumes filesystem access and bash execution — a runtime most production agents don’t share. The tools that teams actually rely on live behind @tool decorators, MCP servers, and protocol layers that Skills can’t reach out of the box.This post builds the connecting layer. The goal: preserve Skills’ progressive disclosure for discovery while routing execution through existing tool infrastructure — without rewriting either side.How the pieces fit togetherThe integration needs to satisfy two requirements simultaneously.First, maintain the progressive disclosure approach to discovery. This is what makes Skills scale — the agent sees a compact catalog of skill names, not dozens of tool schemas, and loads detailed instructions only when a capability is needed. A single agent loop should be able to support a growing number of skills without degrading tool selection accuracy or bloating the context with irrelevant schemas. Each skill provides layered information: a one-line description for routing, full instructions when activated, reference documents on demand.Second, preserve the tool-calling execution mechanism that agents already rely on. Production agents call @tool-decorated Python functions, communicate with MCP servers over standardized protocols, and depend on the authentication, error handling, and runtime infrastructure built around them. The native Skill system handles execution through filesystem operations — tools live as scripts in the skill directory and run via bash. That path doesn't reach existing tool implementations.These two requirements pull against each other because of where tools live in each model. Progressive disclosure works by deferring tool visibility — the agent shouldn’t see a tool’s schema until it activates the relevant skill. But standard tool-calling works by registering all tools upfront in the agent’s configuration, making them available from the first turn.You can’t defer what the framework expects to be present at initialization. And you can’t load tools dynamically if the execution path assumes they were statically declared. The integration layer needs to decouple these two moments — the moment the agent learns about a tool and the moment the framework can execute it — so they can happen independently.SkillRegistry bridging progressive disclosure and tool execution. Diagram by author.On the discovery side, the registry works the same way Skills do. It scans the skills/ directory at startup to build a Level 1 catalog — skill names and one-line descriptions — that gets injected into the system prompt. When the agent activates a skill, the registry loads the SKILL.md body (Level 2): the comprehensive domain knowledge packaged for that capability, including workflows, tool references, constraints, and anti-patterns. From there, the agent can go deeper — loading reference documents for specific subtasks, or inspecting the actual source code of tool implementations to understand their behavior before calling them (Level 3).On the execution side, the agent reads the skill’s detailed guidelines, decides which tool to use, and calls skill_executor with the tool name and parameters. The tools themselves aren't registered in the agent's tool config — the agent has no direct access to them. But the executor invokes them in a way that's compatible with standard tool-calling mechanics: a direct function call for local @tool functions, a protocol call through the MCP client for remote server tools. This means existing tools — regardless of whether they're local functions or MCP server endpoints — can be reused within the skill system without modification. The SkillRegistry sits in the middle, connecting the agent's skill-level decisions to the actual tool implementations.The agent sees none of this complexity. Its context contains the skill catalog, two meta-tools, and whatever non-skill tools need to remain always available.Building the bridgeBuilding the bridge requires working through the agent’s experience from the outside in: how the agent discovers skills, how it activates one and receives domain knowledge, how it goes deeper when needed, and how it executes the actual tools behind the skill. The last step wires everything together at agent initialization.The skill catalogThe agent needs to know what skills exist without loading their full instructions. The catalog is built by scanning the skills/ directory at startup, reading only the SKILL.md frontmatter — name and description — and assembling a compact list for the system prompt.Each skill is a directory with a SKILL.md file. The frontmatter declares the skill’s identity; the body contains detailed instructions that load later:# skills/web-search/SKILL.md---name: web-searchdescription: Search the web using DuckDuckGo for current information.---# Web Search## Usage Guidelines- Use specific, targeted search queries for best results- Combine with the url-fetcher skill to read full page content...A more complex skill includes reference documents alongside its SKILL.md. The powerpoint-presentations skill, for instance, has a design guide and an editing guide that the agent can load later for specific subtasks:skills/powerpoint-presentations/ ├── SKILL.md ← instructions + tool reference ├── design-guide.md ← visual element code patterns └── editing-guide.md ← slide editing workflowsAt startup, the registry scans these directories and parses only the frontmatter — name, description, and whether the skill is tool-backed or instruction-only. The SKILL.md body and reference files are not read at this stage. From the parsed metadata, it generates the catalog that gets injected into the system prompt:## Available Skills Use skill_dispatcher to activate a skill, then skill_executor to run its tools. - **web-search**: Search the web using DuckDuckGo for current information - **powerpoint-presentations**: Create, modify, and manage PowerPoint presentations - **weather**: Get current weather and forecasts for any location - **gmail**: Send, read, and manage Gmail messages ...Twenty skills produce roughly twenty lines. Compare this to shipping forty-plus tool JSON schemas on every turn — the catalog carries enough information for routing decisions at a fraction of the token cost.Activating a skillWhen the agent decides it needs a capability, it calls skill_dispatcher with the skill name. The dispatcher loads the SKILL.md body from disk, collects the tool schemas for that skill, and returns both in a single response:@tooldef skill_dispatcher(skill_name: str, reference: str = "", source: str = "") -> str: """Activate a skill, read a reference document, or read a tool's source code.""" instructions = _registry.load_instructions(skill_name) tools = _registry.get_tools(skill_name) tool_schemas = [] for t in tools: spec = getattr(t, "tool_spec", None) if spec and isinstance(spec, dict): schema = spec.get("inputSchema", {}).get("json", {}) tool_schemas.append({ "name": t.tool_name, "description": spec.get("description", ""), "parameters": schema, }) result = { "skill": skill_name, "instructions": instructions, "available_tools": tool_schemas, "next_step": "Use skill_executor to call tools or run scripts.", } if sources := _registry.list_sources(skill_name): result["available_sources"] = [s["function"] for s in sources] if references := _registry.list_references(skill_name): result["available_references"] = references if scripts := _registry.list_scripts(skill_name): result["available_scripts"] = scripts return json.dumps(result)In short, one call loads everything the agent needs to use a skill: what to do, what tools are available, and what deeper resources exist. The instructions field contains the full SKILL.md body — the procedural knowledge for that capability. The available_tools field contains the JSON schemas the agent needs to construct valid calls. And the response also lists what's available at Level 3: reference documents and source code the agent can request later if the task requires deeper context.A simple skill like web-search returns a short set of usage guidelines and a single tool schema. A complex skill like visual-design returns over a hundred lines of instructions — library compatibility matrices, color palettes, typography rules, a QA checklist — alongside schemas for multiple tools. The dispatcher doesn’t differentiate; it loads whatever the SKILL.md contains and lets the depth of the instructions match the complexity of the capability.For instruction-only skills like doc-coauthoring(Skill authored by Anthropic), the response contains detailed behavioral guidelines but an empty tool list. The agent follows the loaded instructions directly — no executor call needed.Going deeperThe dispatcher response includes available_references and available_sources — a manifest of Level 3 resources the agent can request if the task demands them. The agent calls skill_dispatcher again with the reference or source parameter to load a specific resource.Reference documents are additional markdown files in the skill directory. When the powerpoint-presentations skill’s instructions tell the agent to follow a specific design system, the agent loads it on demand:skill_dispatcher(skill_name="powerpoint-presentations", reference="design-guide.md")The registry reads the file from the skill’s directory, with path traversal protection to ensure only files within that directory are accessible.Source code inspection works differently. During initialization, the registry captures references to local tool functions — the actual Python objects, not file paths. When the agent wants to understand a tool’s implementation before calling it, it requests the source:skill_dispatcher(skill_name="powerpoint-presentations", source="create_presentation")The registry calls inspect.getsource() on the captured function reference and returns the full implementation. This gives the agent visibility into exactly what a tool does — useful when the SKILL.md instructions aren't enough to determine the right parameters for an edge case, or when the agent needs to understand output format before processing the result.Executing toolsAfter activating a skill and reading its instructions, the agent calls tools through skill_executor. From the agent's perspective, every call looks the same — a skill name, a tool name, and the input parameters:skill_executor(skill_name="web-search", tool_name="web_search", tool_input={...}) skill_executor(skill_name="weather", tool_name="get_today_weather", tool_input={...})Behind this uniform interface, the executor routes to different backends — MCP tools, local Python functions, or local scripts (.py/.sh files). It checks whether the target tool has an MCP client attached — if so, it delegates to the MCP server through the standard protocol. Otherwise, it invokes the local Python function directly:@tool(context=True)def skill_executor( tool_context, skill_name, tool_name=None, tool_input=None, script_name=None, script_input=None): # MCP tool, local tool, or script execution # (implementation details omitted for brevity) tools = _registry.get_tools(skill_name) target_tool = next(t for t in tools if t.tool_name == tool_name) if hasattr(target_tool, 'mcp_client'): # MCP tool — delegate to the remote server mcp_result = target_tool.mcp_client.call_tool_sync( tool_use_id=tool_context.tool_use.get("toolUseId", "skill-exec"), name=target_tool.mcp_tool.name, arguments=tool_input, ) texts = [p["text"] for p in mcp_result.get("content", []) if p.get("text")] return "\n".join(texts) else: # Local tool — direct function call func = target_tool._tool_func return func(**tool_input)The actual implementation handles a few additional concerns — injecting ToolContext for tools that need access to the agent's session state, running async tools through an event loop — but the core logic is this branching. The agent never sees the distinction. It follows the skill's instructions, decides which tool to call, and the executor takes care of the rest.The executor also forwards the agent’s full runtime context to local tools that need it — session state, conversation history, model configuration — so they behave identically to direct tool calls.Wiring it upThe pieces so far — skill directories, the dispatcher, the executor — need to be connected at agent initialization. This is where tools get classified, the registry gets populated, and the agent’s interface gets replaced.The first step is tagging tools with skill membership. Local tools declare their skill through a decorator or batch registration. Both mechanisms do the same thing — attach a _skill_name attribute:# Single tool per skill@skill("web-search")@toolasync def web_search(query: str, max_results: int = 5) -> str: ...# Multiple tools per skillregister_skill("powerpoint-presentations", tools=[ create_presentation, analyze_presentation, add_slide, delete_slides, move_slide, ...])MCP tools can’t be decorated — their implementations live on remote servers, while skill definitions live locally. Connecting remote tools to local skills requires a separate mapping table:MCP_TOOL_SKILL_MAP = { "get_today_weather": "weather", "get_weather_forecast": "weather", "arxiv_search": "arxiv-search", "list_emails": "gmail", "send_email": "gmail", # ... 40+ mappings}This mapping is currently manual — each new MCP server tool requires an entry. For a small-to-moderate number of integrations this is manageable, but at scale a convention-based approach (e.g., MCP servers declaring skill membership in their tool metadata) would reduce the maintenance cost.With all tools tagged, the initialization sequence brings everything together:def create_agent(self): # 1. Separate skill tools from always-available tools skill_tools = [t for t in self.tools if getattr(t, '_skill_name', None)] non_skill_tools = [t for t in self.tools if not getattr(t, '_skill_name', None)] # 2. Build the registry registry = SkillRegistry(skills_dir) registry.discover_skills() # scan SKILL.md frontmatter → skill index registry.bind_tools(skill_tools) # match _skill_name → attach tool objects # 3. Inject catalog into system prompt catalog = registry.get_catalog() self.system_prompt = [{"text": f"{base_prompt}\n\n{catalog}"}] # 4. Replace the tool list # Before: [web_search, get_today_weather, create_presentation, ... 40+] # After: [skill_dispatcher, skill_executor] + non_skill_tools self.tools = [skill_dispatcher, skill_executor] + non_skill_tools super().create_agent()After this runs, the agent sees two meta-tools. The forty-plus skill tools still exist — they’re held by the registry, discoverable through the catalog, and executable through the dispatcher and executor. They’re just no longer competing for space in the agent’s context.The flow in actionHere’s what a typical request looks like end to end. The user asks for a presentation. The agent scans the skill catalog in its system prompt (L1), identifies the right skill, and calls the dispatcher. The dispatcher returns the SKILL.md instructions and tool schemas (L2). The instructions reference a design guide, so the agent loads it (L3). With the full context assembled, the agent calls the executor to run the tool, then composes its response.A single request flowing through the three disclosure levels to tool execution. Diagram by author.Not every request touches all three levels. A web search might go straight from L2 to execution. A doc-coauthoring task might never reach the executor at all — the loaded instructions are the entire capability. The flow adapts to the task.ClosingThe practical takeaway: if you already have @tool functions or MCP servers in production, you don’t have to choose between them and Skills. The registry pattern lets you keep existing tool implementations untouched while gaining progressive disclosure on top — the discovery layer changes, the execution layer doesn’t. The full implementation is available on Github.But the claim that this improves on standard tool-calling is still qualitative. How much context does progressive disclosure actually save? Does routing through meta-tools add meaningful latency? Does the agent select the right skill as reliably as it selects the right tool? Part 3 puts both architectures through the same tasks and measures what matters: token usage, latency, task completion rate, and context retention across multi-turn conversations.Agent Skills — Part 2: Bridging Skills with Production Tool Ecosystems was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.