一键导入
model-code-analyzer
Translate a validated method plan into language-neutral code logic, folder layout, and handoff notes before Python or MATLAB code generation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Translate a validated method plan into language-neutral code logic, folder layout, and handoff notes before Python or MATLAB code generation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
At a judgment point, emit the 2-3 questions only the human modeler can answer — framed as trade-offs, not answers — and refuse to answer them. The inverse of "AI answers, human confirms": here the AI asks, the human answers, then the AI assists with the consequences.
Manage the full mathematical modeling contest workflow and decide which skill should be used next.
Verify every skill that claims "completed" produced a substantive audit/review artifact on disk with ≥ 5 explicit pass items. Runs as part of the independent audit layer that does not trust any single skill's self-declaration of done.
Plan figures and tables that support the modeling logic, results, and paper narrative.
Generate publication-quality mathematical modeling figures with matplotlib, covering evaluation charts, prediction plots, optimization diagrams, mechanism schematics, heatmaps, and multi-panel layouts. Use when creating or revising figures for contest papers.
Extract, organize, and document unified model assumptions from the problem parse and candidate method pools, distinguishing necessary from simplifying assumptions.
| name | model-code-analyzer |
| description | Translate a validated method plan into language-neutral code logic, folder layout, and handoff notes before Python or MATLAB code generation. |
| license | MIT |
Translate validated mathematical modeling plans into executable code thinking.
This skill does not write runnable code itself. It turns the selected modeling route (from the candidate method pool) into a language-neutral coding plan: what each subquestion needs, which data enters each stage, which intermediate artifacts should be saved, how code should be split by subquestion, how the experiments/roundN/ output structure must be organized, and which language-specific generator should implement the plan next.
A critical function of this skill is defining the output structure so that experiment reproducibility, multi-method comparison, and downstream report generation are possible.
Use this skill:
data-auditor-cleaner has confirmed that required data is ready or ready with documented warnings.method-selector has produced the candidate method pool per subquestion.python-model-code-generator or matlab-model-code-generator.code/ before writing executable scripts.The following should already exist or be provided:
methods/Qx/qx_method_candidates.md).implementation.target field with value python or matlab.workspace/data/data_clean/, if data is required.workspace/data/data_report.md, if data is used.Use or request:
methods/Qx/qx_method_candidates.md — candidate method pool.workspace/data/data_report.md, if available.workspace/data/data_clean/.Read the candidate method pool.
Translate the mathematical plan into code logic per subquestion.
results/Qx/experiments/roundN/.Define the experiments/roundN/ output structure.
results/Qx/experiments/roundN/
├── figures/ # All generated figures (.png, .pdf)
│ ├── m1_result.png
│ ├── m2_result.png
│ └── comparison.png
├── tables/ # All result tables (.csv)
│ ├── m1_scores.csv
│ ├── m2_scores.csv
│ └── comparison_table.csv
├── metrics/ # All evaluation metrics (.csv, .json)
│ ├── m1_metrics.json
│ ├── m2_metrics.json
│ └── comparison_metrics.json
├── logs/ # Execution logs (.log, .txt)
│ ├── m1_run.log
│ └── m2_run.log
└── run_summary.json # Execution record (see specification below)
Specify the run_summary.json.
result-report-generator, robustness-checker) rely on it.{
"question": "Q1",
"round": "round1",
"execution_timestamp": "2026-05-14T10:30:00+08:00",
"implementation_target": "python",
"random_seed": 2026,
"methods": [
{
"method_id": "M1",
"method_name": "equal_weight_scoring",
"script": "code/Q1/q1_baseline.py",
"status": "success",
"execution_time_seconds": 12.5,
"input_files": [
"workspace/data/data_clean/indicator_data.csv"
],
"output_files": [
"results/Q1/experiments/round1/tables/m1_scores.csv",
"results/Q1/experiments/round1/metrics/m1_metrics.json"
],
"figure_files": [
"results/Q1/experiments/round1/figures/m1_score_bar.png"
],
"metrics_summary": {
"score_range": [0.45, 0.92],
"ranking_top3": ["City_A", "City_B", "City_C"]
},
"errors": [],
"warnings": []
},
{
"method_id": "M2",
"method_name": "entropy_topsis",
"script": "code/Q1/q1_entropy_topsis.py",
"status": "success",
"execution_time_seconds": 18.3,
"input_files": [
"workspace/data/data_clean/indicator_data.csv"
],
"output_files": [
"results/Q1/experiments/round1/tables/m2_scores.csv",
"results/Q1/experiments/round1/tables/m2_weights.csv",
"results/Q1/experiments/round1/metrics/m2_metrics.json"
],
"figure_files": [
"results/Q1/experiments/round1/figures/m2_weight_bar.png",
"results/Q1/experiments/round1/figures/m2_score_dist.png"
],
"metrics_summary": {
"entropy_weights": {"indicator_1": 0.23, "indicator_2": 0.18, "indicator_3": 0.31, "indicator_4": 0.28},
"closeness_scores_range": [0.12, 0.88],
"ranking_top3": ["City_A", "City_C", "City_B"]
},
"errors": [],
"warnings": ["Indicator_4 has very high variance and dominates entropy weight."]
}
],
"comparison": {
"ranking_correlation": 0.87,
"top3_overlap": "2 out of 3 identical"
},
"data_inputs": [
"workspace/data/data_clean/indicator_data.csv"
],
"environment": {
"python_version": "3.10",
"key_dependencies": ["numpy==1.24", "pandas==1.5", "matplotlib==3.6"]
}
}
Define the code layout per subquestion.
code/Q1/, code/Q2/, etc.code/matlab/Q1/, code/matlab/Q2/, etc.README.md in each code subfolder documenting run order, inputs, outputs, and dependencies.run_all.py or run_all.m script only if batch execution is useful.Write the code-thinking document.
code/model-code-analyzer.md.Hand off to the language-specific generator.
python-model-code-generator when implementation.target = python.matlab-model-code-generator when implementation.target = matlab.Produce one Markdown planning artifact:
code/model-code-analyzer.mdThe document should include:
Write a concise Markdown document under code/model-code-analyzer.md.
The document should explain, for each subquestion:
# Model Code Analysis
## Implementation Target
- **Language**: python / matlab
- **Round**: roundN (purpose: e.g., "first multi-method comparison")
- **Runtime notes**: [constraints like minimal-dependencies, portable-artifacts, etc.]
## Qx: [Subquestion Summary]
### Methods to Implement This Round
- M1: [name] (baseline / main candidate)
- M2: [name] (main candidate / backup)
- M3: [name] (if applicable)
### Per-Method Code Logic
#### M1: [name]
1. **Input**: read `data_clean/[file]`, columns [list]
2. **Processing**: [step-by-step computation logic]
3. **Output**: save results to `results/Qx/experiments/roundN/tables/m1_results.csv`
4. **Figures**: save to `results/Qx/experiments/roundN/figures/m1_*.png`
5. **Metrics**: save to `results/Qx/experiments/roundN/metrics/m1_metrics.json`
6. **Log**: write execution log to `results/Qx/experiments/roundN/logs/m1_run.log`
#### M2: [name]
[same structure]
### Expected Code Files
code/Qx/ ├── README.md # Run instructions ├── qx_baseline.py # M1 implementation ├── qx_main.py # M2 implementation └── qx_improved.py # M3 implementation (if applicable)
### Expected Output Structure
results/Qx/experiments/roundN/ ├── figures/ │ ├── m1_score_bar.png │ ├── m2_weight_bar.png │ ├── m2_score_dist.png │ └── ranking_comparison.png ├── tables/ │ ├── m1_scores.csv │ ├── m2_scores.csv │ ├── m2_weights.csv │ └── comparison_table.csv ├── metrics/ │ ├── m1_metrics.json │ ├── m2_metrics.json │ └── comparison_metrics.json ├── logs/ │ ├── m1_run.log │ └── m2_run.log └── run_summary.json
### run_summary.json Key Fields
[Reference the specification above]
### Reproducibility
- **Random seed**: 2026 (fixed)
- **Environment**: Python 3.10, numpy, pandas, matplotlib, scipy
- **Expected runtime**: ~2 minutes for all methods
Before handing off, verify:
results/Qx/experiments/roundN/ convention.code/Qx/ (Python) or code/matlab/Qx/ (MATLAB) convention.Stop and report a blocker if:
implementation.target is undefined.This skill must stop instead of guessing when:
When stopping, output:
After writing code/model-code-analyzer.md, hand off to:
python-model-code-generator if implementation.target = pythonmatlab-model-code-generator if implementation.target = matlabThe handoff must include:
code/model-code-analyzer.md (the full code thinking document)Input state:
Output (code/model-code-analyzer.md excerpt):
## Q1: City Resilience Evaluation
### Methods to Implement This Round
- M1: equal_weight_scoring (baseline)
- M2: entropy_topsis (main candidate)
### Expected Output Structure
results/Q1/experiments/round1/ ├── figures/ │ ├── m1_score_bar.png │ ├── m2_weight_bar.png │ ├── m2_score_dist.png │ └── ranking_comparison.png ├── tables/ │ ├── m1_scores.csv │ ├── m2_scores.csv │ └── m2_weights.csv ├── metrics/ │ ├── m1_metrics.json │ ├── m2_metrics.json │ └── comparison_metrics.json ├── logs/ │ ├── m1_run.log │ └── m2_run.log └── run_summary.json
### run_summary.json
[Full specification with M1 and M2 method entries, comparison field, environment info]
Input state:
Output: same structure as above, but code under code/matlab/Q3/, and MATLAB-specific output path conventions.