You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everything above assumes a skill already exists on disk under a directory served by `BaseSkillRepository`. **Skill Hub** (`trpc_agent_sdk.skills.hub`) is a separate, standalone layer that answers a different question: *where do skills come from before they're on disk?* It gives you a uniform way to search, inspect, and download skills from public registries, so you (or a harness built on top of the SDK) can install them into a directory that `create_default_skill_repository` then serves as usual.
2149
+
2150
+
### The `SkillSource` contract
2151
+
2152
+
Every adapter implements the same four-method interface:
2153
+
2154
+
```python
2155
+
from trpc_agent_sdk.skills.hub import SkillSource, SkillMeta, SkillBundle
**Important:**`fetch()` only returns a `SkillBundle` in memory. Writing it to disk (including overwrite policy, atomic staging, and concurrency safety) is intentionally left to the caller, since different harnesses need different install semantics. The SDK also exports three path validators for that purpose:
2168
+
2169
+
```python
2170
+
from trpc_agent_sdk.skills.hub import validate_skill_name, validate_category_name, validate_bundle_rel_path
2171
+
```
2172
+
2173
+
Use them to reject unsafe paths (absolute paths, `..` traversal, Windows drive prefixes) before writing any hub-returned file to disk. See [examples/skills_hub/agent/hub.py](../../../examples/skills_hub/agent/hub.py) for a minimal reference implementation.
2174
+
2175
+
### Built-in adapters
2176
+
2177
+
| Adapter | Source | Identifier format |
2178
+
| --- | --- | --- |
2179
+
|`GitHubSource`| GitHub repos, via the Contents / Git Trees API |`"owner/repo/path/to/skill-dir"`|
2180
+
|`WellKnownSkillSource`| Any domain exposing `/.well-known/skills/index.json`|`well-known:{base_url}/{skill_name}` or a raw HTTPS URL |
2181
+
|`HermesIndexSource`| A centralized, pre-crawled skills catalog | Same identifiers as the underlying `GitHubSource` entries |
|`ClawHubSource`|[ClawHub](https://clawhub.ai)| slug, e.g. `"notion"`|
2184
+
|`ClaudeMarketplaceSource`| Claude Code marketplace repos (`.claude-plugin/marketplace.json`) | Resolves to a `GitHubSource` identifier |
2185
+
|`LobeHubSource`| LobeHub agent marketplace (converted to synthetic `SKILL.md`) |`lobehub/{agent_id}`|
2186
+
2187
+
`GitHubAuth` provides GitHub API authentication via an explicitly injected personal access token (60 req/hr unauthenticated, 5,000 req/hr with a token). No token auto-detection from the environment or a local `gh` CLI is performed, since the SDK may run multi-tenant.
2188
+
2189
+
### Minimal usage
2190
+
2191
+
```python
2192
+
from trpc_agent_sdk.skills.hub import GitHubAuth, GitHubSource
2193
+
2194
+
source = GitHubSource(GitHubAuth()) # unauthenticated is fine for public repos
2195
+
meta = source.inspect("anthropics/skills/skills/skill-creator")
Combine `fetch()` with your own install helper and `create_default_skill_repository` to make a hub-fetched skill available to an agent exactly like a bundled one — see [examples/skills_hub](../../../examples/skills_hub/README.md) for the full pipeline (fetch → validate paths → write to disk → `create_default_skill_repository` → `SkillToolSet`).
2201
+
2146
2202
## References and Examples
2147
2203
2148
2204
- Background:
@@ -2152,6 +2208,7 @@ The **Dynamic Tool Selection** mechanism has been fully implemented and verified
0 commit comments