Rust Library API - Direct programmatic access for Rust applications
HTTP REST API - HTTP-based API for web applications and cross-language integration
The Rust library provides the core functionality, while the HTTP API exposes it via REST endpoints. Both APIs provide access to the same core functionality.
The primary interface for Rust applications, providing async/await support with tokio and comprehensive error handling.
Copy
use fastskill::{FastSkillService, ServiceConfig};use std::path::PathBuf;#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { // Create service with configuration let config = ServiceConfig { skill_storage_path: PathBuf::from("./skills"), ..Default::default() }; // Initialize service let mut service = FastSkillService::new(config).await?; service.initialize().await?; // Use the API let skills = service.skill_manager().list_skills(None).await?; println!("Found {} skills", skills.len()); service.shutdown().await?; Ok(())}
# List all skillscurl -X GET http://localhost:8080/api/skills# Get a specific skillcurl -X GET http://localhost:8080/api/skills/:id# Create a skillcurl -X POST http://localhost:8080/api/skills \ -H "Content-Type: application/json" \ -d '{ "id": "my-skill", "name": "My Skill", "description": "Example skill", "version": "1.0.0" }'# Update a skillcurl -X PUT http://localhost:8080/api/skills/:id \ -H "Content-Type: application/json" \ -d '{...}'# Delete a skillcurl -X DELETE http://localhost:8080/api/skills/:id
Registry Endpoints (when —enable-registry is used)
Copy
# List all sourcescurl -X GET http://localhost:8080/api/registry/sources# List all skills from all sourcescurl -X GET http://localhost:8080/api/registry/skills# List skills from a specific sourcecurl -X GET http://localhost:8080/api/registry/sources/:name/skills# Get marketplace.json for a sourcecurl -X GET http://localhost:8080/api/registry/sources/:name/marketplace# Refresh all sourcescurl -X POST http://localhost:8080/api/registry/refresh
# Search for skillscurl -X POST http://localhost:8080/api/search \ -H "Content-Type: application/json" \ -d '{"query": "data visualization", "limit": 5}'# List all skillscurl -X GET http://localhost:8080/api/skills
use fastskill::{FastSkillService, ServiceConfig};use std::path::PathBuf;use tempfile::TempDir;#[tokio::test]async fn test_list_skills() { let temp_dir = TempDir::new().unwrap(); let config = ServiceConfig { skill_storage_path: temp_dir.path().to_path_buf(), ..Default::default() }; let mut service = FastSkillService::new(config).await.unwrap(); service.initialize().await.unwrap(); let skills = service.skill_manager().list_skills(None).await.unwrap(); assert!(skills.is_empty()); // Should be empty in test environment}
The FastSkill API is designed to be intuitive and consistent. Start with the Rust library for the best development experience, then use the HTTP API for production deployments and cross-language integration.