code-execution

A skill for running Python code to calculate results, inspect data, simulate systems, and check numerical answers. Python is a programming language commonly used for scientific and data work.

In plain words
What is it for?
Use it for statistical tests, numerical calculations, data-processing pipelines, simulations, optimization, integration, signal analysis, and verification.
Why use it?
It removes the need to estimate results by hand or trust unverified calculations. Code can repeat the same analysis and show how the result was obtained.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/beita6969/scienceclaw/code-execution
Any agent
npx skills add beita6969/ScienceClaw --skill code-execution
Clone the repo
git clone --depth 1 https://github.com/beita6969/ScienceClaw

Made for: Claude Code, Codex.

Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,150 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00078 $0.01150
Opus 5 $0.00039 $0.00575
Sonnet 5 $0.00016 $0.00230
Haiku 4.5 $0.00008 $0.00115

Measured 2d ago against content hash 2ed95e39a494, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-execution scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-execution/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Execution (Meta Skill)

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

Common Imports

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

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

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

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

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

# 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'}")

Read the full file on GitHub · 122 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 122 lines · 78 tokens per session scan A 2ed95e39a494

Subscribe to this mod's changes

code-execution is a skill published in the GitHub repository beita6969/ScienceClaw (888 stars, last pushed 2mo ago), licensed MIT. It adds 78 tokens to every session and 1,150 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

bids

Use this skill when working with Brain Imaging Data Structure (BIDS) datasets: organizing neuroscience and biomedical data (MRI, EEG, MEG, iEEG, PET, microscopy, NIRS, motion capture, EMG, MR spectroscopy, behavioral), querying BIDS layouts, validating compliance, converting DICOM to BIDS, writing metadata sidecars…

K-Dense-AI/scientific-agent-skills · 80 tokens

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use…

K-Dense-AI/scientific-agent-skills · 76 tokens

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

K-Dense-AI/scientific-agent-skills · 56 tokens

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use…

K-Dense-AI/scientific-agent-skills · 73 tokens

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

K-Dense-AI/scientific-agent-skills · 50 tokens

experimental-design

Design experiments and studies BEFORE data is collected — choosing a design, randomizing, blocking, and laying out treatment combinations so results are interpretable. Use whenever someone is planning a study, asks how to assign subjects/samples to groups, mentions randomization, blocking, stratification, controls…

K-Dense-AI/scientific-agent-skills · 200 tokens