원클릭으로
python-model-code-generator
Generate executable Python modeling code from a validated method plan and cleaned data.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate executable Python modeling code from a validated method plan and cleaned data.
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 | python-model-code-generator |
| description | Generate executable Python modeling code from a validated method plan and cleaned data. |
| license | MIT |
Generate Python modeling code from a validated candidate method pool and cleaned data.
This skill implements the approved candidate methods (baseline, main candidates, optional improved) as Python scripts. It should produce code that reads cleaned data, runs the planned models, saves results in the experiments/roundN/ output structure, generates a run_summary.json, and produces portable artifacts for downstream experiment reports, robustness checks, and paper writing.
This skill does not choose the model, clean raw data, review code, run final QA, or write paper sections.
Use this skill:
model-code-analyzer hands off to python-model-code-generator.implementation.target = python..py scripts are needed for one or more candidate methods in a specific experiment round.The following should already exist or be provided:
methods/Qx/qx_method_candidates.md.implementation.target = python.workspace/data/data_clean/, unless the model does not need tabular data.code/model-code-analyzer.md — the code thinking document specifying round number, methods to implement, and output structure.If the candidate method pool is missing, hand back to method-selector.
If code/model-code-analyzer.md is missing, hand back to model-code-analyzer.
If cleaned data is required but missing, hand back to data-auditor-cleaner.
If implementation.target is not python, hand back to model-code-analyzer.
Use or request:
methods/Qx/qx_method_candidates.md — candidate method pool for each subquestion.code/model-code-analyzer.md — code thinking document.workspace/data/data_report.md, if available.workspace/data/data_clean/.roundN).minimal-dependenciesportable-artifactsavoid-notebook-only-codesave-csv-json-pngfixed-random-seedRead the code thinking document and candidate method pool.
Confirm Python target.
implementation.target = python.numpy, pandas, scipy, scikit-learn, matplotlib).Check data readiness.
workspace/data/data_clean/.workspace/data/data_raw/ unless only inspecting metadata is explicitly requested.Plan script structure per subquestion.
code/Qx/ (e.g., code/Q1/, code/Q2/).qx_m1_baseline.py, qx_m2_main.py, qx_m3_improved.py.README.md in each code folder: run order, inputs, outputs, dependencies.run_all.py only if batch execution is useful..py scripts over notebook-only workflows.Generate code for each candidate method.
workspace/data/data_clean/.results/Qx/experiments/roundN/tables/.results/Qx/experiments/roundN/figures/.results/Qx/experiments/roundN/metrics/.results/Qx/experiments/roundN/logs/.run_all.py or the last script, generate results/Qx/experiments/roundN/run_summary.json.Implement baseline code first.
m1_scores.csv).Implement main and optional methods.
Implement run_summary.json generation.
run_summary.json with:
import json
from datetime import datetime
run_summary = {
"question": "Q1",
"round": "round1",
"execution_timestamp": datetime.now().isoformat(),
"implementation_target": "python",
"random_seed": SEED,
"methods": [
{
"method_id": "M1",
"method_name": "equal_weight_scoring",
"script": "code/Q1/q1_m1_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"],
"figure_files": ["results/Q1/experiments/round1/figures/m1_score_bar.png"],
"metrics_summary": {"score_range": [0.45, 0.92], "ranking_top3": ["A", "B", "C"]},
"errors": [],
"warnings": []
}
],
"data_inputs": ["workspace/data/data_clean/indicator_data.csv"],
"environment": {
"python_version": "3.10",
"key_dependencies": ["numpy", "pandas", "matplotlib", "scipy"]
}
}
with open('results/Q1/experiments/round1/run_summary.json', 'w') as f:
json.dump(run_summary, f, indent=2, ensure_ascii=False)
Add a README.md per code folder.
Hand off to code-reviewer.
.py scripts to python-code-reviewer.Produce Python implementation artifacts such as:
code/Q1/README.mdcode/Q1/q1_m1_baseline.pycode/Q1/q1_m2_main.pycode/Q1/q1_m3_improved.py (if applicable)code/Q1/run_all.py (if useful)results/Q1/experiments/roundN/ (created by running the scripts):
tables/*.csvfigures/*.pngmetrics/*.jsonlogs/*.logrun_summary.jsonPrefer this JSON-compatible summary:
{
"python_code_generation_summary": {
"implementation_target": "python",
"subquestion": "Q1",
"round": "round1",
"runtime_notes": ["minimal-dependencies", "portable-artifacts"],
"generated_scripts": [
"code/Q1/q1_m1_baseline.py",
"code/Q1/q1_m2_main.py",
"code/Q1/run_all.py"
],
"data_inputs": [
"workspace/data/data_clean/indicator_data.csv"
],
"result_outputs": [
"results/Q1/experiments/round1/tables/m1_scores.csv",
"results/Q1/experiments/round1/tables/m2_scores.csv",
"results/Q1/experiments/round1/metrics/m1_metrics.json",
"results/Q1/experiments/round1/metrics/m2_metrics.json"
],
"figure_outputs": [
"results/Q1/experiments/round1/figures/m1_score_bar.png",
"results/Q1/experiments/round1/figures/m2_weight_bar.png"
],
"run_instructions": [
"cd code/Q1 && python run_all.py"
],
"dependencies": ["numpy", "pandas", "matplotlib", "scipy"],
"known_risks": [
"Column names must match the data audit report before interpretation."
],
"recommended_next_skill": "code-reviewer"
}
}
Use clear, minimal, reviewable Python code.
Prefer:
.py scriptspathlib.Pathnumpy, pandas, scipy, scikit-learn (when justified), matplotlibresults/Qx/experiments/roundN/SEED = 2026).csv, .json, .pngrun_summary.json generationAvoid unless explicitly approved:
torch, tensorflow)Common accepted dependencies:
numpy
pandas
scipy
scikit-learn
matplotlib
Avoid heavy dependencies unless explicitly justified:
torch
tensorflow
xgboost
lightgbm
large geospatial packages
specialized optimization packages
Use relative paths where practical.
Recommended paths:
workspace/data/data_clean/
code/Qx/
results/Qx/experiments/roundN/
├── tables/
├── figures/
├── metrics/
├── logs/
└── run_summary.json
Avoid hard-coded absolute paths.
Example path setup:
from pathlib import Path
ROOT = Path(".")
DATA_DIR = ROOT / "workspace" / "data" / "data_clean"
RESULT_DIR = ROOT / "results" / "Q1" / "experiments" / "round1"
TABLE_DIR = RESULT_DIR / "tables"
FIGURE_DIR = RESULT_DIR / "figures"
METRIC_DIR = RESULT_DIR / "metrics"
LOG_DIR = RESULT_DIR / "logs"
for d in [TABLE_DIR, FIGURE_DIR, METRIC_DIR, LOG_DIR]:
d.mkdir(parents=True, exist_ok=True)
workspace/data/data_clean/.workspace/data/data_raw/.code/Qx/.results/Qx/experiments/roundN/tables/.results/Qx/experiments/roundN/figures/.results/Qx/experiments/roundN/metrics/.results/Qx/experiments/roundN/logs/.run_summary.json under results/Qx/experiments/roundN/.m1_scores.csv, m2_weights.csv, m1_metrics.jsonm1_score_bar.png, m2_weight_distribution.pngIf randomness is used:
random.seed(SEED), np.random.seed(SEED).run_summary.json.random_state=SEED where supported.import random
import numpy as np
SEED = 2026
random.seed(SEED)
np.random.seed(SEED)
pandas for tabular data when practical.matplotlib by default.plt.savefig(FIGURE_DIR / "m1_result.png", dpi=300, bbox_inches='tight').svg.fonttype = 'none' for editable SVG text.plt.close(fig).import matplotlib.pyplot as plt
plt.rcParams['svg.fonttype'] = 'none'
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlabel("x")
ax.set_ylabel("y")
fig.tight_layout()
fig.savefig(FIGURE_DIR / "m1_result.png", dpi=300, bbox_inches='tight')
fig.savefig(FIGURE_DIR / "m1_result.svg", bbox_inches='tight')
plt.close(fig)
Use comments to explain:
Avoid over-commenting trivial syntax.
run_summary.json.experiments/roundN/ directory structure.python-code-reviewer.Before handing off, verify:
implementation.target = python.code/Qx/.results/Qx/experiments/roundN/.run_summary.json generation is implemented.results/Qx/experiments/roundN/figures/.README.md exists in the code folder.code-reviewer.Stop and report a blocker if:
code/model-code-analyzer.md is missing.implementation.target is not python.This skill must stop instead of guessing when:
When stopping, output:
After generating Python scripts, hand off to:
code-reviewer
The handoff should include:
.py script pathsREADME.md pathresults/Qx/experiments/roundN/code-reviewer should route the scripts to python-code-reviewer.
Do not hand off directly to robustness-checker or result-report-generator.
Input state:
implementation.target = python.Output:
{
"python_code_generation_summary": {
"implementation_target": "python",
"subquestion": "Q1",
"round": "round1",
"generated_scripts": [
"code/Q1/q1_m1_baseline.py",
"code/Q1/q1_m2_entropy_topsis.py",
"code/Q1/run_all.py",
"code/Q1/README.md"
],
"data_inputs": [
"workspace/data/data_clean/indicator_data.csv"
],
"result_outputs": [
"results/Q1/experiments/round1/tables/m1_equal_weight_scores.csv",
"results/Q1/experiments/round1/tables/m2_entropy_topsis_scores.csv",
"results/Q1/experiments/round1/tables/m2_weights.csv",
"results/Q1/experiments/round1/metrics/m1_metrics.json",
"results/Q1/experiments/round1/metrics/m2_metrics.json",
"results/Q1/experiments/round1/run_summary.json"
],
"figure_outputs": [
"results/Q1/experiments/round1/figures/m1_score_bar.png",
"results/Q1/experiments/round1/figures/m2_weight_bar.png",
"results/Q1/experiments/round1/figures/m2_score_dist.png"
],
"run_instructions": [
"cd code/Q1 && python run_all.py"
],
"known_risks": [
"Indicator direction must match the method plan before interpretation."
],
"recommended_next_skill": "code-reviewer"
}
}
{
"blocked_items": [
"The candidate method pool is missing at methods/Q1/q1_method_candidates.md. Cannot determine which methods to implement."
],
"recommended_next_skill": "method-selector",
"recommended_next_action": "Generate the candidate method pool for Q1 before code generation."
}