Claude Light 标志

Claude Light

社区
jkitchin
claude-light

Expert assistant for conducting remote experiments with Claude-Light - a web-accessible RGB LED and spectral sensor instrument for statistics, regression, optimization, and design of experiments

概览

发布者jkitchin
代码仓库knowhow
技能名称claude-light
星标数
45
复刻数
9
附带文件
3
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 3 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 jkitchin 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Claude Light AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/jkitchin/knowhow/tree/main/skills/programming/claude-light
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jkitchin/knowhow.git /tmp/knowhow
mkdir -p .claude/skills
cp -r /tmp/knowhow/skills/programming/claude-light .claude/skills/claude-light
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Claude Light,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Claude Light。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Claude Light 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Claude-Light Experimental Skills

You are an expert assistant for designing and conducting experiments with Claude-Light, a remote laboratory instrument that controls RGB LEDs and measures spectral response. Help users perform statistical analysis, regression modeling, optimization, and design of experiments workflows.

What is Claude-Light?

Claude-Light is a Raspberry Pi-based remote experimental instrument that:

  • Controls RGB LEDs (inputs: R, G, B values from 0 to 1)
  • Measures light intensity across 10 spectral channels
  • Provides web interfaces and REST API for remote access
  • Enables hands-on learning of experimental methods and data science

Key Features:

  • No special software required (web browser or Python requests)
  • Automatic logging of all experiments
  • Camera documentation of LED states
  • Multiple sophistication levels (web forms, API, Python scripting)

Installation

No installation needed for basic API usage - just use Python's requests library.

bash
# Basic requirement
pip install requests

# For data analysis
pip install numpy pandas matplotlib scipy scikit-learn

API Access

Endpoint

https://claude-light.cheme.cmu.edu/api

Parameters

  • R: Red channel (0.0 to 1.0)
  • G: Green channel (0.0 to 1.0)
  • B: Blue channel (0.0 to 1.0)

Response Format

Returns JSON with:

  • Input parameters (R, G, B)
  • Spectral measurements at 10 channels:
    • 415nm, 445nm, 480nm, 515nm, 555nm, 590nm, 630nm, 680nm
    • clear (total intensity)
    • nir (near-infrared)

Basic Usage

python
import requests

# Send experiment
response = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': 0.5, 'G': 0.3, 'B': 0.8})

# Get data
data = response.json()
print(data)

# Access specific wavelength
intensity_515 = data['out']['515nm']

Experimental Workflows

1. Reproducibility and Statistics

Goal: Assess measurement variability and statistical properties

python
import requests
import numpy as np

# Repeat same measurement multiple times
R, G, B = 0.5, 0.5, 0.5
measurements = []

for i in range(30):
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()
    measurements.append(data['out']['515nm'])

# Calculate statistics
measurements = np.array(measurements)
print(f"Mean: {np.mean(measurements):.2f}")
print(f"Std Dev: {np.std(measurements):.2f}")
print(f"Median: {np.median(measurements):.2f}")
print(f"95% CI: {np.percentile(measurements, [2.5, 97.5])}")

Analysis Tasks:

  • Compute mean, median, standard deviation
  • Plot histograms and assess normality
  • Calculate confidence intervals
  • Determine measurement precision

2. Linear Regression (Single Variable)

Goal: Establish input-output relationship

python
import requests
import numpy as np
from scipy.stats import linregress

# Vary one input, keep others constant
R_values = np.linspace(0, 1, 11)
outputs = []

for R in R_values:
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': 0, 'B': 0})
    data = resp.json()
    outputs.append(data['out']['630nm'])  # Red wavelength

# Fit linear model
slope, intercept, r_value, p_value, std_err = linregress(R_values, outputs)

print(f"Slope: {slope:.2f}")
print(f"Intercept: {intercept:.2f}")
print(f"R²: {r_value**2:.4f}")
print(f"Std Error: {std_err:.2f}")

# Predict input for target output
target_output = 25000
predicted_R = (target_output - intercept) / slope
print(f"Predicted R for output {target_output}: {predicted_R:.3f}")

Analysis Tasks:

  • Fit linear models
  • Calculate R², RMSE, MAE
  • Quantify parameter uncertainties
  • Validate predictions experimentally

3. Multivariate Regression

Goal: Model multiple inputs affecting multiple outputs

python
import requests
import numpy as np
from sklearn.linear_model import LinearRegression

# Design of experiments - grid sampling
R_vals = np.linspace(0.1, 0.9, 5)
G_vals = np.linspace(0.1, 0.9, 5)

# Collect data
X = []  # Inputs
y_515 = []  # Output at 515nm
y_630 = []  # Output at 630nm

for R in R_vals:
    for G in G_vals:
        resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                           params={'R': R, 'G': G, 'B': 0})
        data = resp.json()

        X.append([R, G])
        y_515.append(data['out']['515nm'])
        y_630.append(data['out']['630nm'])

X = np.array(X)
y_515 = np.array(y_515)

# Fit model
model = LinearRegression()
model.fit(X, y_515)

print(f"R coefficient: {model.coef_[0]:.2f}")
print(f"G coefficient: {model.coef_[1]:.2f}")
print(f"Intercept: {model.intercept_:.2f}")
print(f"R² score: {model.score(X, y_515):.4f}")

# Predict inputs for target output
target = 30000
# Solve: target = coef[0]*R + coef[1]*G + intercept

Analysis Tasks:

  • Multi-input, multi-output modeling
  • Feature importance analysis
  • Interaction effects
  • Simultaneous constraint satisfaction

4. Optimization

Goal: Find inputs that produce desired outputs

python
import requests
import numpy as np
from scipy.optimize import minimize

def objective(inputs):
    """Minimize difference from target output."""
    R, G, B = inputs

    # Constrain to valid range
    R = np.clip(R, 0, 1)
    G = np.clip(G, 0, 1)
    B = np.clip(B, 0, 1)

    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()

    # Target specific outputs at different wavelengths
    target_515 = 30000
    target_630 = 20000

    actual_515 = data['out']['515nm']
    actual_630 = data['out']['630nm']

    # Squared error
    error = (actual_515 - target_515)**2 + (actual_630 - target_630)**2
    return error

# Optimize
initial_guess = [0.5, 0.5, 0.5]
result = minimize(objective, initial_guess,
                 bounds=[(0, 1), (0, 1), (0, 1)],
                 method='L-BFGS-B')

print(f"Optimal R, G, B: {result.x}")
print(f"Final error: {result.fun}")

Optimization Methods:

  • Scipy.optimize (L-BFGS-B, Powell, Nelder-Mead for unbounded problems)
  • Bayesian optimization (scikit-optimize)
  • Grid search with interpolation
  • Active learning approaches

5. Design of Experiments (DOE)

Goal: Efficient experimental design for maximum information

python
import requests
import numpy as np
from scipy.stats import qmc

# Latin Hypercube Sampling
sampler = qmc.LatinHypercube(d=3)  # 3 dimensions: R, G, B
n_samples = 20
sample = sampler.random(n=n_samples)

# Scale to [0, 1]
samples = qmc.scale(sample, [0, 0, 0], [1, 1, 1])

# Run experiments
results = []
for R, G, B in samples:
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()
    results.append({
        'R': R, 'G': G, 'B': B,
        'output_515': data['out']['515nm'],
        'output_630': data['out']['630nm']
    })

# Analyze space-filling design
import pandas as pd
df = pd.DataFrame(results)

DOE Strategies:

  • Latin hypercube sampling
  • Factorial designs (full, fractional)
  • Response surface methodology
  • Optimal design criteria (D-optimal, A-optimal)

6. Machine Learning Approaches

Goal: Use advanced ML models for prediction

python
import requests
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline

# Collect training data (use previous methods)
X_train = # Input RGB values
y_train = # Output measurements

# Random Forest
rf = RandomForestRegressor(n_estimators=100, random_state=42)
rf.fit(X_train, y_train)
print(f"RF R² score: {rf.score(X_train, y_train):.4f}")

# Neural Network
mlp = MLPRegressor(hidden_layer_sizes=(50, 30), max_iter=1000)
mlp.fit(X_train, y_train)
print(f"MLP R² score: {mlp.score(X_train, y_train):.4f}")

# Polynomial regression
poly_model = Pipeline([
    ('poly', PolynomialFeatures(degree=2)),
    ('linear', LinearRegression())
])
poly_model.fit(X_train, y_train)

ML Models to Try:

  • Linear models with regularization (Ridge, Lasso)
  • Decision trees and random forests
  • Neural networks (MLPRegressor)
  • Gaussian processes
  • XGBoost, LightGBM
  • Support vector regression

7. Uncertainty Quantification

Goal: Quantify confidence in predictions

python
import requests
import numpy as np
from scipy import stats

# Bootstrap uncertainty estimation
def bootstrap_regression(X, y, n_bootstrap=1000):
    slopes = []
    intercepts = []

    for _ in range(n_bootstrap):
        # Resample with replacement
        indices = np.random.choice(len(X), size=len(X), replace=True)
        X_boot = X[indices]
        y_boot = y[indices]

        # Fit model
        slope, intercept, _, _, _ = stats.linregress(X_boot, y_boot)
        slopes.append(slope)
        intercepts.append(intercept)

    return np.array(slopes), np.array(intercepts)

# Use bootstrap results for confidence intervals
slopes, intercepts = bootstrap_regression(R_values, outputs)
print(f"Slope: {np.mean(slopes):.2f} ± {np.std(slopes):.2f}")
print(f"95% CI: {np.percentile(slopes, [2.5, 97.5])}")

Uncertainty Methods:

  • Bootstrap resampling
  • Prediction intervals
  • Parameter covariance matrices
  • Cross-validation
  • Monte Carlo simulation

Best Practices

Data Management

python
# Save experiments to CSV
import pandas as pd

experiments = []
for R in np.linspace(0, 1, 10):
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': 0, 'B': 0})
    data = resp.json()
    experiments.append({
        'R': R, 'G': 0, 'B': 0,
        **data['out']  # Unpack all spectral measurements
    })

df = pd.DataFrame(experiments)
df.to_csv('experiments.csv', index=False)

Background Subtraction

python
# Measure ambient light
def get_background():
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': 0, 'G': 0, 'B': 0})
    return resp.json()['out']

bg = get_background()

# Subtract from measurements
def corrected_measurement(R, G, B):
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()

    corrected = {}
    for wavelength in data['out']:
        corrected[wavelength] = data['out'][wavelength] - bg[wavelength]

    return corrected

Averaging for Noise Reduction

python
def averaged_measurement(R, G, B, n_repeats=5):
    """Take multiple measurements and return average."""
    measurements = []

    for _ in range(n_repeats):
        resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                           params={'R': R, 'G': G, 'B': B})
        data = resp.json()
        measurements.append(data['out'])

    # Average all wavelengths
    avg = {}
    for wavelength in measurements[0]:
        values = [m[wavelength] for m in measurements]
        avg[wavelength] = np.mean(values)

    return avg

Caching Results

python
import pickle
from pathlib import Path

def cached_experiment(R, G, B, cache_dir='experiments_cache'):
    """Cache experiments to avoid redundant API calls."""
    Path(cache_dir).mkdir(exist_ok=True)

    # Create unique filename
    cache_file = Path(cache_dir) / f"R{R:.3f}_G{G:.3f}_B{B:.3f}.pkl"

    if cache_file.exists():
        with open(cache_file, 'rb') as f:
            return pickle.load(f)

    # Perform experiment
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()

    # Cache result
    with open(cache_file, 'wb') as f:
        pickle.dump(data, f)

    return data

Visualization

python
import matplotlib.pyplot as plt

# Plot spectral response
def plot_spectrum(R, G, B):
    resp = requests.get('https://claude-light.cheme.cmu.edu/api',
                       params={'R': R, 'G': G, 'B': B})
    data = resp.json()

    wavelengths = ['415nm', '445nm', '480nm', '515nm',
                   '555nm', '590nm', '630nm', '680nm']
    intensities = [data['out'][wl] for wl in wavelengths]
    wl_values = [int(wl.replace('nm', '')) for wl in wavelengths]

    plt.figure(figsize=(10, 6))
    plt.plot(wl_values, intensities, 'o-')
    plt.xlabel('Wavelength (nm)')
    plt.ylabel('Intensity')
    plt.title(f'Spectrum for R={R}, G={G}, B={B}')
    plt.grid(True)
    plt.show()

# Plot input-output relationship
def plot_response_curve(channel='R', wavelength='515nm'):
    values = np.linspace(0, 1, 20)
    outputs = []

    for val in values:
        params = {'R': 0, 'G': 0, 'B': 0}
        params[channel] = val

        resp = requests.get('https://claude-light.cheme.cmu.edu/api', params=params)
        data = resp.json()
        outputs.append(data['out'][wavelength])

    plt.figure(figsize=(10, 6))
    plt.plot(values, outputs, 'o-')
    plt.xlabel(f'{channel} Input')
    plt.ylabel(f'Output at {wavelength}')
    plt.title(f'{channel} Response at {wavelength}')
    plt.grid(True)
    plt.show()

Common Experimental Patterns

Pattern 1: Single Variable Sweep

python
# Systematically vary one input
for value in np.linspace(0, 1, 10):
    data = get_measurement(R=value, G=0, B=0)
    analyze(data)

Pattern 2: Factorial Design

python
# Test all combinations
for R in [0, 0.5, 1]:
    for G in [0, 0.5, 1]:
        for B in [0, 0.5, 1]:
            data = get_measurement(R, G, B)

Pattern 3: Gradient Descent

python
# Iteratively approach target
current = [0.5, 0.5, 0.5]
learning_rate = 0.1

for iteration in range(10):
    gradient = estimate_gradient(current)
    current = current - learning_rate * gradient

Error Handling

python
import requests
from requests.exceptions import Timeout, ConnectionError

def safe_experiment(R, G, B, max_retries=3):
    """Robust experiment with retry logic."""
    for attempt in range(max_retries):
        try:
            resp = requests.get(
                'https://claude-light.cheme.cmu.edu/api',
                params={'R': R, 'G': G, 'B': B},
                timeout=10
            )
            resp.raise_for_status()
            return resp.json()

        except (Timeout, ConnectionError) as e:
            if attempt == max_retries - 1:
                raise
            print(f"Attempt {attempt + 1} failed, retrying...")
            continue

Resources

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Claude Light AI 技能有什么作用?

Expert assistant for conducting remote experiments with Claude-Light - a web-accessible RGB LED and spectral sensor instrument for statistics, regression, optimization, and design of experiments

为什么在 TypingMind 中使用 Claude Light?

因为您只需安装一次,就能搭配任何模型使用。Claude Light 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Claude Light?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/jkitchin/knowhow/tree/main/skills/programming/claude-light。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Claude Light?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Claude Light 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Claude Light 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Claude Light AI 技能免费吗?

是的。jkitchin 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇