Overview
FastSkill’s behavior is controlled through configuration objects that define how the service operates. This guide covers all available configuration options and their impact on performance and functionality.
Configuration can be set programmatically, through environment variables, or via configuration files. Programmatic configuration takes precedence over environment variables, which take precedence over defaults.
Basic Configuration
use fastskill::{ServiceConfig, ExecutionConfig, CacheConfig, EmbeddingConfig};
use std::path::PathBuf;
// Complete configuration example
let config = ServiceConfig {
// Storage Configuration
skill_storage_path: PathBuf::from("./skills"),
// Execution Configuration
execution: ExecutionConfig {
timeout: 30,
max_memory_mb: 512,
..Default::default()
},
// Hot Reload Configuration
hot_reload: HotReloadConfig {
enabled: true,
watch_paths: vec![
PathBuf::from("./skills"),
PathBuf::from("./custom-skills")
],
debounce_ms: 1000,
auto_reload: true,
},
// Cache Configuration
cache: CacheConfig {
max_size: 1000,
metadata_ttl: 300, // 5 minutes
content_ttl: 60, // 1 minute
},
// Embedding Configuration (optional, required for semantic search)
embedding: Some(EmbeddingConfig {
openai_base_url: "https://api.openai.com/v1".to_string(),
embedding_model: "text-embedding-3-small".to_string(),
api_key: std::env::var("OPENAI_API_KEY").ok(),
}),
// Security Configuration
security: SecurityConfig::default(),
..Default::default()
};
Configuration Options
Storage Configuration
The directory where FastSkill looks for skill files and stores skill data. This is the primary location for skill discovery and management.
Optional secondary storage location for backups and redundancy. If not specified, no backups are created.
Execution Configuration
execution.default_timeout
Default timeout in seconds for skill execution. Individual skills can override this value.
Maximum memory (in MB) that a single skill execution can use. Helps prevent memory exhaustion attacks.
execution.max_cpu_percent
Maximum CPU usage percentage allowed for skill execution. Useful for preventing resource starvation.
execution.enable_networking
Whether skills are allowed to make network requests. Set to false for enhanced security.
List of additional filesystem paths that skills are allowed to access beyond their own directories.
Level of sandboxing for skill execution. Options: none (no sandboxing), basic (resource limits only), strict (full isolation).
Cache Configuration
cache.metadata_cache_size
Maximum number of skill metadata entries to keep in memory cache. Higher values improve performance but use more memory.
Maximum number of full skill content entries to cache. Content is larger than metadata, so use smaller values here.
Time-to-live for cache entries in seconds. Set to 0 to disable expiration.
Whether to persist cache to disk for faster startup times. Useful for production deployments.
Directory for persistent cache storage. If not specified, uses system temp directory.
Service Configuration
Whether to watch for changes in skill files and automatically reload them. Useful during development.
List of directories to watch for skill changes. Only used when hot reload is enabled.
Whether to log all skill operations for security and debugging purposes.
Minimum log level to output. DEBUG and TRACE are useful for troubleshooting but impact performance.
max_concurrent_executions
Maximum number of skill executions that can run simultaneously. Helps prevent resource exhaustion.
Whether to collect performance metrics for monitoring and optimization.
How long to retain performance metrics in hours. Older metrics are automatically cleaned up.
Whether to enable health check endpoints for monitoring systems.
health_check_interval_seconds
Interval between health checks in seconds. Only used when health checks are enabled.
Environment Variables
You can also configure FastSkill using environment variables:
| Variable | Description | Default |
|---|
FASTSKILL_LOG_LEVEL | Set logging level | INFO |
FASTSKILL_STORAGE_PATH | Override skill storage path | ./skills |
FASTSKILL_CONFIG_FILE | Path to JSON configuration file | None |
FASTSKILL_EXECUTION_TIMEOUT | Default execution timeout (seconds) | 30 |
FASTSKILL_MAX_MEMORY_MB | Maximum memory per execution (MB) | 512 |
FASTSKILL_ENABLE_HOT_RELOAD | Enable hot reloading | false |
FASTSKILL_CACHE_SIZE | Metadata cache size | 1000 |
FASTSKILL_ENABLE_METRICS | Enable performance metrics | true |
Configuration Files
.fastskill/config.yaml Configuration
FastSkill uses .fastskill/config.yaml for service-level configuration. This file supports embedding settings and skills storage directory configuration:
embedding:
openai_base_url: "https://api.openai.com/v1"
embedding_model: "text-embedding-3-small"
index_path: ".fastskill/index.db" # Optional
# Skills storage directory (where installed skills are stored)
# Default: ".claude/skills"
skills_directory: ".claude/skills"
Key Points:
skills_directory configures where fastskill add installs skills
- This is separate from repositories in
[tool.fastskill.repositories] section of skill-project.toml (which are for discovery only)
- Allows separation of development skills from runtime registry
- Can be absolute or relative path (relative paths resolve from current directory)
- Project-level configuration (dependencies and repositories) is stored in
skill-project.toml at project root
JSON Configuration Files
For complex deployments, use JSON configuration files:
{
"skill_storage_path": "./skills",
"execution": {
"default_timeout": 30,
"max_memory_mb": 512,
"max_cpu_percent": 50,
"enable_networking": false,
"allowed_paths": ["./data"],
"sandbox_level": "basic"
},
"cache": {
"metadata_cache_size": 1000,
"content_cache_size": 100,
"cache_ttl_seconds": 3600,
"enable_persistence": true,
"cache_directory": "./cache"
},
"enable_hot_reload": true,
"watch_paths": ["./skills", "./custom-skills"],
"enable_audit_logging": true,
"log_level": "INFO",
"max_concurrent_executions": 10,
"enable_metrics": true,
"metrics_retention_hours": 24,
"enable_health_checks": true,
"health_check_interval_seconds": 30
}
Load configuration in Rust:
use fastskill::ServiceConfig;
use std::fs;
let config_content = fs::read_to_string("config.json")?;
let config: ServiceConfig = serde_json::from_str(&config_content)?;
For High Throughput
use fastskill::{ServiceConfig, CacheConfig, ExecutionConfig};
use std::time::Duration;
// Optimize for many concurrent requests
let config = ServiceConfig {
max_concurrent_executions: 50,
cache: CacheConfig {
metadata_cache_size: 5000,
content_cache_size: 500,
cache_ttl_seconds: 7200, // 2 hours
..Default::default()
},
execution: ExecutionConfig {
default_timeout: Duration::from_secs(10), // Faster timeout
max_memory_mb: 256, // Lower memory per execution
..Default::default()
},
..Default::default()
};
For Memory Constrained Environments
use fastskill::{ServiceConfig, CacheConfig, ExecutionConfig};
use std::path::PathBuf;
// Minimize memory usage
let config = ServiceConfig {
cache: CacheConfig {
metadata_cache_size: 100,
content_cache_size: 10,
enable_persistence: false,
..Default::default()
},
execution: ExecutionConfig {
max_memory_mb: 128,
max_cpu_percent: 25,
..Default::default()
},
enable_metrics: false, // Disable metrics collection
..Default::default()
};
For Development
use fastskill::{ServiceConfig, CacheConfig};
use std::path::PathBuf;
// Optimize for development workflow
let config = ServiceConfig {
enable_hot_reload: true,
watch_paths: vec![PathBuf::from("./skills"), PathBuf::from("./custom-skills")],
log_level: "DEBUG".to_string(),
enable_audit_logging: true,
cache: CacheConfig {
cache_ttl_seconds: 60, // Short cache for fresh data
..Default::default()
},
..Default::default()
};
Security Configuration
High Security Mode
use fastskill::{ServiceConfig, ExecutionConfig};
// Maximum security configuration
let config = ServiceConfig {
execution: ExecutionConfig {
enable_networking: false,
sandbox_level: "strict".to_string(),
allowed_paths: vec![], // No extra paths
max_memory_mb: 256,
max_cpu_percent: 25,
..Default::default()
},
enable_audit_logging: true,
log_level: "INFO".to_string(),
..Default::default()
};
Development Security
use fastskill::{ServiceConfig, ExecutionConfig};
use std::path::PathBuf;
// Balanced security for development
let config = ServiceConfig {
execution: ExecutionConfig {
enable_networking: true, // Allow network for testing
sandbox_level: "basic".to_string(),
allowed_paths: vec![PathBuf::from("./test-data")],
max_memory_mb: 1024, // Higher limits for testing
max_cpu_percent: 75,
..Default::default()
},
enable_audit_logging: true,
log_level: "DEBUG".to_string(),
..Default::default()
};
Validation and Testing
Always validate your configuration before deploying:
Validate configuration
use fastskill::ServiceConfig;
let config = ServiceConfig { /* Your configuration */ };
// Validate the configuration
match config.validate() {
Ok(_) => println!("✅ Configuration is valid"),
Err(e) => println!("❌ Configuration error: {}", e),
}
Test with minimal setup
use fastskill::{FastSkillService, ServiceConfig};
// Test configuration with a minimal service
let mut config = ServiceConfig::default();
config.enable_hot_reload = false; // Disable for testing
config.log_level = "ERROR".to_string(); // Reduce noise
let service = FastSkillService::new(config).await?;
service.initialize().await?;
// Quick functionality test
let skills = service.skill_manager().list_skills(None).await?;
println!("Service running with {} skills", skills.len());
await service.shutdown()
Best Practices
Start with defaults
Begin with default configuration and adjust based on your specific needs and performance observations.
Monitor and adjust
Use the metrics system to monitor performance and adjust configuration based on real usage patterns.
Test configuration changes
Always test configuration changes in a staging environment before deploying to production.
Document your configuration
Keep documentation of your configuration choices and the reasons behind them for future reference.
Use configuration files
For production deployments, prefer configuration files over environment variables for better visibility and version control.
Invalid configuration can cause service startup failures or unexpected behavior. Always validate your configuration and test thoroughly before deployment.