Scientific

From docxology/template · View interactive version

Scientific is an AI agent skill from the GitHub repository docxology/template. Skill for the scientific infrastructure module providing numerical stability checks, performance benchmarking, and independent improvement confirmation. Use when benchmarking functions, checking numerical stability, or confirming a candidate beats a baseline beyond the noise band.

How to use this skill

Skill file

Scientific Module

Scientific computing utilities for research software development.

Tier: exemplar-support. Layer-1 by location, imported only by its

scientific exemplar(s) — not generic-reach across infrastructure/.

Numerical Stability (`stability.py`)

from infrastructure.scientific import check_numerical_stability, StabilityTest

# Check numerical stability of a function over a range of inputs
test = check_numerical_stability(
    func=my_computation,
    test_inputs=[0.0, 1e-6, 1.0, 1e10, float("nan"), float("inf")],
    tolerance=1e-12,
)

# Inspect results
print(test.function_name, test.stability_score, test.actual_behavior)
print(test.recommendations)

Benchmarking (`benchmarking.py`)

from infrastructure.scientific import (
    benchmark_function,
    BenchmarkResult,
    format_benchmark_report,
    format_benchmark_report,
)

# Benchmark a function across multiple inputs
result = benchmark_function(
    func=my_algorithm,
    test_inputs=[10, 100, 1000],
    iterations=100,
)

# Inspect results
print(result.function_name, result.execution_time, result.memory_usage)
print(result.iterations, result.result_summary, result.timestamp)

# Generate Markdown reports
md_report = format_benchmark_report([result])
perf_report = format_benchmark_report([result])

Improvement Confirmation (`confirmation.py`)

from infrastructure.scientific import confirm_improvement, Confirmation

# Confirm a candidate beats a baseline metric beyond the noise band
result = confirm_improvement(
    evaluate=my_evaluator,  # (params, seed) -> metric
    candidate=(0.1, 0.2),
    baseline_metric=1.0,
    seeds=[0, 1, 2, 3],
    noise_scale=0.05,
    sigma=2.0,  # noise band width in standard errors of the mean
)

# Inspect the Confirmation dataclass
print(result.candidate_mean, result.baseline_metric, result.delta)
print(result.noise_band, result.confirmed)
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.