Skip to content

Latest commit

 

History

History
161 lines (116 loc) · 4.67 KB

File metadata and controls

161 lines (116 loc) · 4.67 KB

SkillLite Tutorials & Examples

Complete SkillLite usage examples to quickly get started with all core features and framework integrations.

📚 Tutorial Directory

Tutorial Time Difficulty Content
01. Basic Usage 5 min Simplest examples, one-line execution
02. Skill Management 10 min ⭐⭐ Create and manage skills
03. Agentic Loop 15 min ⭐⭐ Multi-turn conversations and tool calls
04. LangChain Integration 15 min ⭐⭐⭐ Integration with LangChain framework
05. LlamaIndex Integration 15 min ⭐⭐⭐ RAG + skill execution
06. MCP Server 10 min ⭐⭐ Claude Desktop integration
07. OpenCode Integration 10 min ⭐⭐ OpenCode AI coding agent integration

🚀 Quick Start

1. Environment Setup

# Install SkillLite
pip install skilllite

# Initialize project (sandbox + .skills/)
skilllite init

# Create .env configuration file
cp .env.example .env
# Edit .env and add your API key

2. Run Your First Example

cd tutorials/01_basic
python hello_world.py

3. Choose Your Learning Path

Beginners

  1. 01. Basic Usage
  2. 02. Skill Management
  3. 03. Agentic Loop

Using LangChain

  1. 01. Basic Usage
  2. 04. LangChain Integration

Using LlamaIndex

  1. 01. Basic Usage
  2. 05. LlamaIndex Integration

Using Claude Desktop

  1. 01. Basic Usage
  2. 06. MCP Server

Using OpenCode

  1. 01. Basic Usage
  2. 07. OpenCode Integration

📖 Code Examples (Quick Reference)

Simplest Usage

from skilllite import chat

result = chat("Help me with this task", skills_dir=".skills")
print(result)

Direct Skill Execution (No LLM)

from skilllite import run_skill

result = run_skill("./.skills/calculator", '{"operation": "add", "a": 15, "b": 27}')
print(result["text"])

LangChain Integration

pip install langchain-skilllite
from langchain_skilllite import SkillLiteToolkit
from langgraph.prebuilt import create_react_agent

tools = SkillLiteToolkit.from_directory("./skills")
agent = create_react_agent(llm, tools)
result = agent.invoke({"messages": [("user", "Your request")]})

LlamaIndex Integration

See 05. LlamaIndex Integration for details.

🔧 All Example Files

01_basic (Basic)

  • hello_world.py - One-line execution
  • direct_execution.py - Direct skill execution
  • tool_definitions.py - View tool formats

02_skill_management (Skill Management)

  • list_skills.py - List all skills
  • execute_skill.py - Execute skills

03_agentic_loop (Agentic Loop)

  • basic_loop.py - Basic agent loop

04_langchain_integration (LangChain)

  • basic_tool_setup.py - Tool setup
  • agent_example.py - Agent examples (2 approaches)

05_llamaindex_integration (LlamaIndex)

  • basic_usage.py - RAG examples (3 approaches)

06_mcp_server (MCP Server)

  • mcp_client_test.py - MCP client test

07_opencode_integration (OpenCode)

  • verify_setup.py - Verify OpenCode + SkillLite setup

⚙️ Environment Configuration

Create a .env file:

# API Configuration
API_KEY=sk-...                                    # Your API key
BASE_URL=https://api.openai.com/v1              # API endpoint
MODEL=gpt-4                                      # Model name

# Or use Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-...

# SkillLite Configuration
SKILLLITE_SKILLS_DIR=./skills                   # Skills directory
SKILLLITE_SANDBOX_LEVEL=3                       # Sandbox level (1/2/3)

❓ FAQ

Q: Do I need to install Rust? A: No, skilllite init will automatically download pre-compiled binaries.

Q: Can I execute skills without an LLM? A: Yes, see 01_basic/direct_execution.py

Q: How do I use it with LangChain? A: See 04_langchain_integration

Q: Which LLMs are supported? A: All OpenAI-compatible APIs + Claude native API

📚 More Resources