mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-20 12:23:29 +00:00
* docs: rewrite documentation with clean, concise style Rewrote all core docs pages (index, installation, quickstart, rest-api, mcp-server, python-client) with problem/solution framing, progressive code examples, and conversational tone. Updated OpenAPI descriptions and api.html meta tags to match. 366 additions vs 722 deletions. * docs(mcp): remove stale skill count, add list_categories tool name Replace hard-coded "15,000+" with non-specific wording and explicitly name the list_categories tool in the Browse categories section.
106 lines
2.4 KiB
Plaintext
106 lines
2.4 KiB
Plaintext
---
|
|
title: Python Client
|
|
description: Async Python SDK for skill discovery
|
|
---
|
|
|
|
# Python Client
|
|
|
|
Not everything runs on Node. The `skillkit-client` package gives Python apps the same skill discovery capabilities as the REST API — async, typed, and ready to go.
|
|
|
|
## Install
|
|
|
|
```bash
|
|
pip install skillkit-client
|
|
```
|
|
|
|
Requires Python 3.10+.
|
|
|
|
## Quick start
|
|
|
|
```python
|
|
from skillkit import SkillKitClient
|
|
|
|
async with SkillKitClient() as client:
|
|
results = await client.search("react performance", limit=5)
|
|
for skill in results.skills:
|
|
print(f"{skill.name}: {skill.description}")
|
|
```
|
|
|
|
The client connects to `http://localhost:3737` by default. Make sure the API server is running:
|
|
|
|
```bash
|
|
skillkit serve
|
|
```
|
|
|
|
## Search with filters
|
|
|
|
```python
|
|
results = await client.search_with_filters(
|
|
"authentication",
|
|
tags=["security"],
|
|
category="backend",
|
|
limit=10,
|
|
)
|
|
```
|
|
|
|
## Get a specific skill
|
|
|
|
```python
|
|
skill = await client.get_skill("anthropics/skills", "pdf-processing")
|
|
print(skill.name, skill.description, skill.tags)
|
|
```
|
|
|
|
## Trending and categories
|
|
|
|
```python
|
|
trending = await client.trending(limit=10)
|
|
categories = await client.categories()
|
|
|
|
for skill in trending:
|
|
print(f"{skill.name} ({skill.source})")
|
|
|
|
for cat in categories:
|
|
print(f"{cat.name}: {cat.count} skills")
|
|
```
|
|
|
|
## Health and cache
|
|
|
|
```python
|
|
health = await client.health()
|
|
print(f"v{health.version} — {health.skill_count} skills loaded")
|
|
|
|
stats = await client.cache_stats()
|
|
print(f"Cache hit rate: {stats.hit_rate:.0%}")
|
|
```
|
|
|
|
## Connect to a remote server
|
|
|
|
```python
|
|
async with SkillKitClient("https://my-server.example.com:3737") as client:
|
|
results = await client.search("deployment")
|
|
```
|
|
|
|
## Models
|
|
|
|
The client returns typed dataclasses:
|
|
|
|
```python
|
|
Skill(name, source, description, tags, category, content, score)
|
|
SearchResponse(skills, total, query, limit)
|
|
HealthResponse(status, version, skill_count, uptime)
|
|
Category(name, count)
|
|
CacheStats(hits, misses, size, max_size, hit_rate)
|
|
```
|
|
|
|
All fields except `name` and `source` on `Skill` are optional — they depend on what the server returns and whether you requested `include_content`.
|
|
|
|
## Prerequisites
|
|
|
|
The Python client talks to the SkillKit REST API. You need a running server:
|
|
|
|
```bash
|
|
skillkit serve
|
|
```
|
|
|
|
Then run your Python script in another terminal. The client handles connection management, retries, and cleanup automatically when used with `async with`.
|