parameterization
БесплатноБез исполняемых скриптовНе проверенMaster declarative parameter systems with Param for type-safe configuration. Use this skill when building parameterized classes with automatic validation…
от uw-ssec★ 33 звезды на GitHubОб этом скилле
Parameterization Skill
Overview
Master declarative parameter systems with Param and dynamic UI generation. This skill covers building flexible, type-safe, and auto-validated application logic.
Dependencies
- param >= 2.0.0
- panel >= 1.3.0 (for UI generation)
- numpy >= 1.15.0
- pandas >= 1.0.0
Core Capabilities
1. Parameter Basics
Param provides a framework for parameterized objects with automatic validation:
import param
import numpy as np
class DataProcessor(param.Parameterized):
# Basic parameters
name = param.String(default='Processor', doc='Name of processor')
count = param.Integer(default=10, bounds=(1, 1000), doc='Number of items')
scale = param.Number(default=1.0, bounds=(0.1, 10.0), doc='Scale factor')
# String choices
method = param.Selector(default='mean', objects=['mean', 'median', 'sum'])
# Boolean flag
normalize = param.Boolean(default=False)
# List or array
tags = param.List(default=[], item_type=str)
data_array = param.Array(default=np.array([]))
# Instantiate and use
processor = DataProcessor()
print(f"Name: {processor.name}, Count: {processor.count}")
# Validate parameters automatically
processor.count = 500 # OK
processor.count = 2000 # Raises error: out of bounds
2. Advanced Parameter Types
class AdvancedConfig(param.Parameterized):
# Date/time parameters
date = param.Date(default='2024-01-01', doc='Start date')
time = param.Time(default='12:00', doc='Start time')
datetime = param.DateTime(default='2024-01-01 12:00:00')
# File/path parameters
input_file = param.Path(default=None, doc='Input file path')
output_dir = param.Fspath(default='.', doc='Output directory')
# Range parameter
value_range = param.Range(default=(0, 10), bounds=(0, 100))
# Color parameter
color = param.Color(default='#FF0000')
# JSON/Dict parameter
config = param.Dict(default={}, per_instance=True)
# DataFrame parameter
dataframe = param.Parameter(default=None)
3. Dynamic Dependencies with @param.depends
class DataAnalyzer(param.Parameterized):
data_source = param.Selector(
default='random',
objects=['random', 'sine', 'exponential']
)
amplitude = param.Number(default=1.0, bounds=(0.1, 10.0))
frequency = param.Number(default=1.0, bounds=(0.1, 10.0))
size = param.Integer(default=100, bounds=(10, 10000))
@param.depends('data_source', 'amplitude', 'frequency', 'size')
def get_data(self):
"""Automatically called when any dependency changes"""
np.random.seed(42)
x = np.linspace(0, 2*np.pi, self.size)
if self.data_source == 'random':
return x, np.random.randn(self.size) * self.amplitude
elif self.data_source == 'sine':
return x, self.amplitude * np.sin(self.frequency * x)
else: # exponential
return x, self.amplitude * np.exp(self.frequency * x / 10)
@param.depends('data_source', 'amplitude', 'frequency', 'size')
def summary(self):
"""Display summary that updates automatically"""
x, y = self.get_data()
return f"Mean: {y.mean():.2f}, Std: {y.std():.2f}"
# Use in application
analyzer = DataAnalyzer()
print(analyzer.summary)
# Change parameters
analyzer.amplitude = 2.0
analyzer.frequency = 2.0
print(analyzer.summary) # Updated automatically
4. Watchers for Side Effects
Watchers allow you to trigger code when parameters change:
class DataModel(param.Parameterized):
filename = param.String(default='data.csv')
data = param.Parameter(default=None, precedence=-1)
@param.depends('filename', watch=True)
def _load_data(self):
"""Automatically load data when filename changes"""
print(f"Loading {self.filename}...")
# Load file here
self.data = pd.read_csv(self.filename)
# Alternative: explicit watch
def __init__(self, **params):
super().__init__(**params)
self.param.watch(self._on_count_change, 'count')
def _on_count_change(self, event):
print(f"Count changed from {event.old} to {event.new}")
model = DataModel()
model.filename = 'new_file.csv' # Triggers _load_data automatically
5. Custom Validation
class ValidatedModel(param.Parameterized):
email = param.String(default='', doc='Email address')
age = param.Integer(default=0, bounds=(0, 150))
password = param.String(default='')
@param.validators('email')
def validate_email(self, value):
if '@' not in value:
raise ValueError('Invalid email address')
return value
@param.validators('password')
def validate_password(self, value):
if len(value) < 8:
raise ValueError('Password must be at least 8 characters')
return value
def validate_constraint(self):
"""Cross-parameter validation"""
if self.age < 18 and self.em
Установить parameterization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл parameterization?
Master declarative parameter systems with Param for type-safe configuration. Use this skill when building parameterized classes with automatic validation, creating reactive dependencies with @param.depends, implementing watchers for side effects, auto-generating UIs from parameters, or organizing application configuration with hierarchical parameter structures.
Как установить скилл parameterization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл parameterization запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic