Skip to main content
ClaudeWave
EN, English
Skill1k repo starsupdated 12d ago

code-execution

The code-execution skill runs scientific Python computations using NumPy, SciPy, Pandas, and Matplotlib. Deploy it for statistical analyses like t-tests and effect sizes, numerical integration and optimization, data processing pipelines, Monte Carlo simulations, and verification of published results against raw datasets. Avoid using this skill for literature searches, paper writing, or non-computational tasks.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/beita6969/ScienceClaw /tmp/code-execution && cp -r /tmp/code-execution/skills/code-execution ~/.claude/skills/code-execution
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Code Execution (Meta Skill)

Execute scientific Python code for computation, analysis, simulation, and
verification of results.

## Common Imports

```python
import numpy as np
import pandas as pd
from scipy import stats, optimize, integrate, signal
import matplotlib; matplotlib.use('Agg')
import matplotlib.pyplot as plt
import json, csv, sys
from collections import Counter, defaultdict
```

## Pattern 1: Statistical Analysis

```python
import numpy as np
from scipy import stats

data_a, data_b = np.array([...]), np.array([...])
print(f"Group A: mean={np.mean(data_a):.4f}, std={np.std(data_a, ddof=1):.4f}, n={len(data_a)}")
print(f"Group B: mean={np.mean(data_b):.4f}, std={np.std(data_b, ddof=1):.4f}, n={len(data_b)}")

t_stat, p_value = stats.ttest_ind(data_a, data_b, equal_var=False)
print(f"Welch's t-test: t={t_stat:.4f}, p={p_value:.6f}")

# Effect size (Cohen's d)
pooled_std = np.sqrt((np.std(data_a, ddof=1)**2 + np.std(data_b, ddof=1)**2) / 2)
print(f"Cohen's d: {(np.mean(data_a) - np.mean(data_b)) / pooled_std:.4f}")
```

## Pattern 2: Numerical Computation

```python
from scipy import integrate, optimize

result, error = integrate.quad(lambda x: np.exp(-x**2), -np.inf, np.inf)
print(f"Integral result: {result:.6f} (error: {error:.2e})")

solution = optimize.fsolve(lambda v: [v[0]**2+v[1]**2-4, v[0]-v[1]-1], [1, 0])
print(f"Solution: x={solution[0]:.4f}, y={solution[1]:.4f}")
```

## Pattern 3: Data Processing

```python
import pandas as pd
from io import StringIO

df = pd.read_csv(StringIO("col1,col2\n1,2\n3,4"))
df = df.dropna()
df['computed'] = df['col1'] * df['col2']
print(df.groupby('col1').agg({'col2': ['mean', 'std', 'count']}).round(4).to_string())
```

## Pattern 4: Monte Carlo Simulation

```python
np.random.seed(42)
n = 100000
x, y = np.random.uniform(-1, 1, n), np.random.uniform(-1, 1, n)
pi_est = 4 * np.sum(x**2 + y**2 <= 1) / n
print(f"Pi estimate: {pi_est:.6f} (error: {abs(pi_est - np.pi):.6f})")
```

## Pattern 5: Verification

```python
# Verify claimed results against raw data
actual_mean = np.mean(data)
se = np.std(data, ddof=1) / np.sqrt(len(data))
ci = (actual_mean - 1.96*se, actual_mean + 1.96*se)
print(f"Mean: {actual_mean:.2f}, 95% CI: ({ci[0]:.2f}, {ci[1]:.2f})")
print(f"Verification: {'PASS' if abs(claimed - actual_mean) < 0.5 else 'FAIL'}")
```

## Error Handling

```python
try:
    result = perform_computation(data)
except (ValueError, np.linalg.LinAlgError) as e:
    print(f"Error: {e}")
except MemoryError:
    print("Data too large. Consider chunked processing.")
```

## Output Formatting

```python
print("=" * 50)
print(f"RESULTS | n={n} | mean={mean:.4f} | p={p:.6f}")
print("=" * 50)
```

## Sandbox Constraints

1. No network access -- data must be provided inline or on disk.
2. No persistent state -- each execution is independent.
3. Memory limits -- use chunked processing for large data.
4. Time limits -- reduce iterations for long simulations.

## Best Practices

1. Set random seeds and report library versions for reproducibility.
2. Use `np.float64` and `np.log1p` for numerical stability.
3. Prefer vectorized NumPy over Python loops.
4. Validate input shapes, types, and ranges before computation.
5. Report appropriate significant figures; do not over-report precision.
6. Check statistical test assumptions before applying parametric methods.
7. Apply Bonferroni/FDR correction for multiple comparisons.
1passwordSkill

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.

academic-deep-researchSkill

Transparent, rigorous research with full methodology — not a black-box API wrapper. Conducts exhaustive investigation through mandated 2-cycle research per theme, APA 7th citations, evidence hierarchy, and 3 user checkpoints. Self-contained using native OpenClaw tools (web_search, web_fetch, sessions_spawn). Use for literature reviews, competitive intelligence, or any research requiring academic rigor and reproducibility.

academic-literature-searchSkill

# Academic Literature Search — 学术文献检索与引用管理

acp-routerSkill

Route plain-language requests for Pi, Claude Code, Codex, OpenCode, Gemini CLI, or ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation.

apple-notesSkill

Manage Apple Notes via the `memo` CLI on macOS (create, view, edit, delete, search, move, and export notes). Use when a user asks OpenClaw to add a note, list notes, search notes, or manage note folders.

apple-remindersSkill

Manage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.

article-writingSkill

Write articles, guides, blog posts, tutorials, newsletter issues, and other long-form content in a distinctive voice derived from supplied examples or brand guidance. Use when the user wants polished written content longer than a paragraph, especially when voice consistency, structure, and credibility matter.

arxiv-databaseSkill

Search and retrieve preprints from arXiv via the Atom API. Use this skill when searching for papers in physics, mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering, or economics by keywords, authors, arXiv IDs, date ranges, or categories.