# Python Code Reviewer

Review, run, debug, and verify approved Python modeling code against its code plan...

- Repository: https://github.com/zhnnky329/MathModeling-skills (1073 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-09-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add zhnnky329/MathModeling-skills --skill python-code-reviewer -g -a claude-code -y`
Codex: `npx skills add zhnnky329/MathModeling-skills --skill python-code-reviewer -g -a codex -y`
Cursor: `npx skills add zhnnky329/MathModeling-skills --skill python-code-reviewer -g -a cursor -y`
Gemini CLI: `npx skills add zhnnky329/MathModeling-skills --skill python-code-reviewer -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add zhnnky329/MathModeling-skills`

## Description

Review, run, debug, and verify approved Python modeling code against its code plan, data contract, method decision, risk conditions, and experiment outputs, saving one compact JSON review.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Preconditions

- Python code and `code/Qx/qx_code_plan.md` exist.
- Approved method decision, method card, data profile, and relevant run summary are available.
- Required inputs are accessible.

# Workflow

1. Resolve the approved main and usable baseline. Flag scripts for unapproved candidates unless a fallback activation exists.
2. Inspect and run the code in the intended order.
3. Evaluate required checks:
   - `syntax`: imports, execution, exceptions, and obvious runtime faults.
   - `input_contract`: paths, fields, units, shapes, missing-data handling, and raw-data protection.
   - `method_alignment`: formulas, objectives, constraints, assumptions, main/baseline roles, and fallback scope match the approved plan.
   - `reproducibility`: seed, deterministic setup, dependency/runtime record, and rerun consistency.
   - `output_contract`: saved tables/metrics/figures, valid run summary, comparable main/baseline metrics, degeneracy evidence, and fallback-trigger state.
4. Add risk-specific checks only when relevant, such as leakage, constraint feasibility, numerical stability, or scale.
5. If asked to fix findings, make minimal changes, rerun affected checks, and record the repair. Otherwise report findings without changing code.
6. Save `code/Qx/reviews/qx_python_review.json`.

# Review Schema

```json
{
  "schema_version": 1,
  "question_id": "Q1",
  "language": "python",
  "reviewed_files": [],
  "decision_id": "q1_method_choice",
  "checks": {
    "syntax": {"status": "PASS", "evidence": []},
    "input_contract": {"status": "PASS", "evidence": []},
    "method_alignment": {"status": "PASS", "evidence": []},
    "reproducibility": {"status": "PASS", "evidence": []},
    "output_contract": {"status": "PASS", "evidence": []}
  },
  "findings": [],
  "verdict": "PASSED",
  "reviewed_at": "ISO-8601"
}
```

Statuses are `PASS`, `FAIL`, or `NOT_APPLICABLE` with a reason. Any required `FAIL` blocks G3.

# Rules

The rest: https://github.com/zhnnky329/MathModeling-skills/blob/HEAD/.claude/skills/python-code-reviewer/SKILL.md
