From math-modeling
Stage 1 of the mathematical modeling pipeline. Performs deep problem analysis using Actor-Critic self-improvement. Invoked by the math-modeling skill during Stage 1. Do not invoke directly — use /math-model instead.
How this skill is triggered — by the user, by Claude, or both
Slash command
/math-modeling:mm-analysisThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Deeply analyze the mathematical modeling problem, understanding its background, objectives, assumptions, constraints, and potential challenges. Use Actor-Critic mechanism to iteratively improve the analysis quality.
Deeply analyze the mathematical modeling problem, understanding its background, objectives, assumptions, constraints, and potential challenges. Use Actor-Critic mechanism to iteratively improve the analysis quality.
mm-workspace/raw_problem.txt or user-provided paths)Read the problem and extract structured information:
If the problem is in a PDF or image, use the Read tool to extract the content.
If the problem includes data files:
Determine data format and load appropriately:
pd.read_csv('path/to/data.csv')pd.read_excel('path/to/data.xlsx', sheet_name=None)pd.read_json('path/to/data.json')Run a Python script to examine the data:
import pandas as pd
import numpy as np
import json
# Adjust loading method based on file type
data = pd.read_csv('path/to/data.csv') # or read_excel, read_json
# Basic summary
summary = {
'shape': list(data.shape),
'columns': list(data.columns),
'dtypes': {col: str(dt) for col, dt in data.dtypes.items()},
'head': data.head(3).to_dict(),
'describe': data.describe().to_dict(),
'null_counts': data.isnull().sum().to_dict(),
'null_pct': (data.isnull().sum() / len(data) * 100).to_dict()
}
print(json.dumps(summary, indent=2, default=str))
# Outlier detection (IQR method)
for col in data.select_dtypes(include=[np.number]).columns:
Q1, Q3 = data[col].quantile(0.25), data[col].quantile(0.75)
IQR = Q3 - Q1
outliers = ((data[col] < Q1 - 1.5*IQR) | (data[col] > Q3 + 1.5*IQR)).sum()
if outliers > 0:
print(f"WARNING: {col} has {outliers} potential outliers ({outliers/len(data)*100:.1f}%)")
# Data quality issues
for col in data.columns:
if data[col].isnull().sum() > 0:
pct = data[col].isnull().sum() / len(data) * 100
print(f"WARNING: {col} has {pct:.1f}% missing values")
Generate a concise text summary of the data covering:
Load references/actor_critic.md for the Actor-Critic mechanism guide.
Round 1:
Produce a deep analysis covering:
Write as structured analysis: use numbered lists for assumptions, tables for variable definitions, and numbered LaTeX for key equations. Use coherent paragraphs for reasoning and discussion.
Use the Agent tool to dispatch an independent subagent for the Critic role. The subagent must NOT inherit the Actor's reasoning context — it only receives the Actor's final output.
Dispatch an Agent with the following prompt structure:
你是一名严格的数学建模评审专家(Critic 角色)。请对以下问题分析进行批评。
## 审查标准
- 深度:是否超越表面观察?假设和隐含约束是否充分考虑?
- 新颖性:是否提供了新见解,还是复述已知方法?
- 严谨性:逻辑是否一致?数学表述是否精确?
- 上下文意识:是否考虑了实际约束和现实世界的影响?
- 数据意识:是否充分利用了可用数据?数据处理是否合理?
## 问题背景
{Insert problem text summary, 1-2 paragraphs}
## 被审查的分析内容
{Insert Actor's complete analysis output}
## 输出要求
1. 逐一指出具体问题(附位置引用)
2. 每个问题给出改进方向(指出方向,不提供完整方案)
3. 最后给出总体评价:是否存在重大问题需要追加一轮
4. 直接输出批评内容,不要有多余的寒暄
Receive the Critic feedback and proceed to Improvement.
Based on the critique, produce an improved version:
Round 2:
Repeat the Critic → Improvement cycle once more.
Write the final output to mm-workspace/01_analysis.json:
{
"problem_text": "complete problem text",
"data_summary": "data summary text or empty string",
"analysis": "final improved analysis text",
"has_dataset": true,
"dataset_files": ["file1.csv"],
"stage": "analysis_complete"
}
Use the Write tool to save this file.
Then commit: cd mm-workspace && git add -A && git commit -m "feat(s1): problem analysis complete"
Display a concise summary:
Then ask: "问题分析完成。是否需要修改或补充?确认后进入建模阶段。"
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub 911439925/math-modeling-skill --plugin math-modeling