Export Agent Skills as prompts for different platforms
The sklab prompt command exports one or more skills into prompt formats suitable for agent platforms. This enables you to inject skill metadata (name, description, location) into agent system prompts for dynamic skill discovery.
Best for: Claude API, Claude Code, structured system prompts
sklab prompt ./skill-a ./skill-b
<available_skills><skill><name>run-python-tests</name><description>Execute pytest test suite for Python projects. Discovers and runs all tests in tests/ directory, generates coverage reports, and displays results.</description><location>/path/to/.claude/skills/run-python-tests</location></skill><skill><name>analyze-code-quality</name><description>Run static analysis tools (ruff, mypy, pylint) on Python codebases and generate quality reports.</description><location>/path/to/.claude/skills/analyze-code-quality</location></skill></available_skills>
Usage in Claude system prompt:
<system>You are a helpful coding assistant.The following skills are available:<available_skills><skill><name>run-python-tests</name><description>Execute pytest test suite for Python projects.</description><location>file:///path/to/.claude/skills/run-python-tests</location></skill></available_skills>When the user's request matches a skill, invoke it by loading the SKILL.md from the location.</system>
## Available Skills### run-python-tests**Description:** Execute pytest test suite for Python projects. Discovers and runs all tests in tests/ directory, generates coverage reports, and displays results.**Location:** `/path/to/.claude/skills/run-python-tests`### analyze-code-quality**Description:** Run static analysis tools (ruff, mypy, pylint) on Python codebases and generate quality reports.**Location:** `/path/to/.claude/skills/analyze-code-quality`
Skill Lab estimates discovery tokens (name + description) for all exported skills:
sklab prompt ./skill-a ./skill-b
Output (to stderr):
# 2 skill(s), ~87 discovery tokens
This represents the token cost of injecting skill metadata into a system prompt.
Discovery tokens are what agents see when choosing skills.
Activation tokens (full SKILL.md) are only loaded when the skill is invoked.Use sklab info ./my-skill to see both discovery and activation token estimates.
import subprocessimport anthropic# Generate skill promptresult = subprocess.run( ["sklab", "prompt", "./my-skill", "--format", "xml"], capture_output=True, text=True)skills_xml = result.stdout# Inject into system promptsystem_prompt = f"""You are a helpful coding assistant.The following skills are available:{skills_xml}When the user's request matches a skill, invoke the skill by reading SKILL.md from the location."""client = anthropic.Anthropic()message = client.messages.create( model="claude-sonnet-4-5-20250929", max_tokens=1024, system=system_prompt, messages=[{"role": "user", "content": "Run the tests"}])
Exporting too many skills (50+) can bloat the system prompt and degrade agent performance.
Consider skill categorization or lazy loading for large skill libraries.