Skip to main content

LLM Skills

Skill SDK Logo

A Python SDK for building AI Agent Skills that strictly follow the official Anthropic SKILL.md standard.

Designed to be the standard implementation for modular AI tooling, this SDK enables developers to build portable, secure, and highly capable skills for Claude, OpenAI, and other LLMs with function calling support. It handles validation, discovery, and progressive loading, so you can focus on building intelligent capabilities.

Why LLM Skills?

Building agentic tools today is often messy and inefficient. Developers face three core problems:

  1. Token Bloat: Injecting every possible tool definition into the system prompt exhausts context windows and increases cost.
  2. Vendor Lock-in: Tools written for OpenAI function calling often don't work with Claude or other models without significant rewriting.
  3. Spaghetti Code: Hard-coding tool logic directly into your agent making it impossible to share or reuse capabilities across projects.

LLM Skills solves this by treating skills as portable data packages.

  • Standardized: Write once using SKILL.md and run anywhere (OpenAI, Claude, Custom Agents).
  • Efficient: Uses Progressive Disclosure to load heavy instructions and scripts only when the model actually decides to use the skill.
  • Discoverable: The built-in Router allows your agent to choose from hundreds of skills dynamically, rather than being limited to a static set of tools.

How It Works

The SDK implements the Anthropic 4-Phase Loading architecture to optimize token usage and context management:

flowchart TD
    subgraph Discovery ["Phase 1: Discovery"]
        direction TB
        A[User Query] -->|Router| B{Select Skill}
        B -->|Match| C[Load Metadata]
        C -->|Description| D[System Prompt]
    end

    subgraph Loading ["Phase 2: Loading"]
        direction TB
        D -->|Tool Use| E[Load Content]
        E -->|Read| F[SKILL.md]
        E -->|Discover| G[Resources]
        G --> H["/scripts/"]
        G --> I["/examples/"]
        G --> J["/references/"]
    end

    subgraph Execution ["Phase 3: Execution"]
        direction TB
        F -->|Instructions| K[LLM Context]
        K -->|Code| L[Execute Script]
        L -->|Result| M[Final Response]
    end

    style Discovery fill:#e1f5fe,stroke:#01579b
    style Loading fill:#f3e5f5,stroke:#4a148c
    style Execution fill:#e8f5e9,stroke:#1b5e20

    linkStyle default stroke-width:2px,fill:none,stroke:black;

Features

  • Standard Compliance: Validates SKILL.md against official Anthropic rules (name format, length limits) to ensure compatibility with the Claude API.
  • Progressive Disclosure: Efficiently manages token context by loading only essential metadata initially, then pulling in full instructions and companion resources (like scripts or reference docs) only when the skill is actually used.
  • Auto-Discovery: Automatically finds and categorizes companion files (scripts/, examples/, references/) within skill directories, making them available to your agent.
  • Secure by Default: Built-in path traversal protection ensures skills cannot access files outside their directory.
  • Universal Patterns:
    • Prompt Injection: Use Patterns.file_based_prompt to inject skill instructions directly into your system prompt.
    • Function Calling: Use to_tool_definition() to generate JSON schemas for OpenAI or Claude tool use.
    • Native Anthropic: Use to_anthropic_files() to bundle and upload skills directly to the Anthropic API for containerized execution.

Installation

We recommend using uv for modern Python project management.

Quick Install (Recommended)

Installs the core library plus OpenAI and Anthropic support.

uv add "py-llm-skills[full]"

Lite Install (Core Only)

Installs only the lightweight core. Useful if you want to bring your own LLM client.

uv add py-llm-skills

Specific Features

You can also mix and match optional dependencies:

uv add "py-llm-skills[openai]"    # Adds OpenAI SDK
uv add "py-llm-skills[anthropic]" # Adds Anthropic SDK

Pip Users

If you are using standard pip:

pip install "py-llm-skills[full]"

Quick Start

1. Define a Skill

Create a directory skills/weather/ and add a SKILL.md. Notice how we key-value pair metadata for the router and keep instructions clear.

---
name: weather
description: Get current weather information for a given location.
version: 1.0.0
input_schema:
  type: object
  properties:
    location: {type: string, description: "City and state, e.g. San Francisco, CA"}
  required: [location]
---
You are a weather assistant. Fetch real-time data for the user's location.

2. Use in Python

from py_llm_skills import SkillRegistry, Skill, Patterns

# Load all skills from a directory
registry = SkillRegistry()
registry.register_directory("./skills")

# Get a specific skill by name
weather = registry.get_skill("weather")

# Pattern 1: Inject into system prompt
prompt = Patterns.file_based_prompt([weather])

# Pattern 2: Use as OpenAI / Claude tool
tool_def = weather.to_tool_definition()

# Pattern 3: Upload to Anthropic Skills API
# This bundles the SKILL.md and all discovered scripts/resources
files = weather.to_anthropic_files()

4. Structured Output

Use Pydantic models to get type-safe, structured responses from your LLM (OpenAI/Anthropic).

from pydantic import BaseModel
from py_llm_skills.llm.openai import OpenAISDKAdapter

class AnalysisResult(BaseModel):
    summary: str
    sentiment: float
    tags: list[str]

# ... initialize client ...
result = client.chat_completion_with_structure(
    messages=[{"role": "user", "content": "Analyze this..."}], 
    response_model=AnalysisResult
)
print(result.summary)

5. Upload to Claude (Anthropic Skills API)

Directly upload your local skills to the Anthropic beta API for server-side execution:

import anthropic
from py_llm_skills.llm.claude import AnthropicSkillManager

client = anthropic.Anthropic()
manager = AnthropicSkillManager(client)

# Upload a skill and get a skill_id
skill_id = manager.upload_skill(weather)

# Use in messages via the container parameter
container = manager.format_container_param([skill_id])

Skill Collections

Looking for pre-built skills? Check out these awesome community repositories:

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details on how to set up your development environment and submit pull requests.

License

MIT

Release files for py-llm-skills 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-llm-skills 0.1.2
File Size Uploaded
py_llm_skills-0.1.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-llm-skills 0.1.2
File Interpreter ABI Platform
py_llm_skills-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / py_llm_skills-0.1.2.tar.gz

Download URL py_llm_skills-0.1.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1f2c8404b40a54acc1d40165ae7335804c62c6b4d8a78a6cdc62dae01d010a9d
BLAKE2b-256 checksum
How to use checksums
e966b25735666457b3f0ce1289ed12f1bd9eabc9dccc0149f4ee508f4215a1a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 18, 2026.

Transparency log

Release files / py_llm_skills-0.1.2-py3-none-any.whl

Download URL py_llm_skills-0.1.2-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b193e69c421befca3e649d9a0e419ab69b0565f7d89ed915177d581c468a5249
BLAKE2b-256 checksum
How to use checksums
16b4b631b83e0380f834bfde48327f47687304ebd8b12b33786fcf3c5bd03744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page