Skip to content

Lucasuiii/modeling-workbench / .agents/skills/cumcm-workflow

cumcm-workflow

Verified

Build or resume mathematical-modeling competition work, including CUMCM, MCM/ICM, graduate and regional contests, data challenges, and open-topic statistical modeling. Guide problem framing, modeling, computation, validation, Chinese or English LaTeX writing, and reviewed PDF/source delivery using current official requirements. Not for ordinary paper polishing.

FileKindSize
SKILL.mdskill md9.0 KB
agents/openai.yamlconfig427 B
assets/latex-template/generic-ctex/macros.texother859 B
assets/latex-template/generic-ctex/main.tex.tmplother2.5 KB
assets/latex-template/generic-ctex/metadata.tex.tmplother272 B
assets/latex-template/generic-ctex/planned-section.tex.tmplother1.0 KB
assets/latex-template/generic-ctex/references.bibother155 B
assets/latex-template/generic-ctex/sections/00_abstract.texother935 B
assets/latex-template/generic-ctex/sections/98_references.texother221 B
assets/latex-template/generic-ctex/sections/99_appendix.texother264 B
assets/latex-template/generic-ctex/template.jsonconfig304 B
assets/latex-template/generic-en/macros.texother868 B
assets/latex-template/generic-en/main.tex.tmplother2.2 KB
assets/latex-template/generic-en/metadata.tex.tmplother278 B
assets/latex-template/generic-en/planned-section.tex.tmplother1013 B
assets/latex-template/generic-en/references.bibother155 B
assets/latex-template/generic-en/sections/00_abstract.texother454 B
assets/latex-template/generic-en/sections/98_references.texother201 B
assets/latex-template/generic-en/sections/99_appendix.texother240 B
assets/latex-template/generic-en/template.jsonconfig249 B
assets/latex-template/huawei-ctex/main.tex.tmplother3.3 KB
assets/latex-template/huawei-ctex/template.jsonconfig276 B
assets/plot-style/cumcm.mplstyleother953 B
references/01-intake.mdmarkdown3.9 KB
references/02-problem-analysis.mdmarkdown2.8 KB
references/03-model-design.mdmarkdown7.6 KB
references/04-computation.mdmarkdown13.4 KB
references/05-validation.mdmarkdown5.9 KB
references/06-paper-writing.mdmarkdown14.3 KB
references/07-compile-delivery.mdmarkdown6.1 KB
references/artifact-contracts.mdmarkdown3.1 KB
references/competition-adaptation.mdmarkdown6.8 KB
references/competition-writing.mdmarkdown5.6 KB
references/diagnostics.mdmarkdown4.5 KB
references/evidence-rules.mdmarkdown1.6 KB
references/handoffs.mdmarkdown3.5 KB
references/huawei-delivery.mdmarkdown10.1 KB
references/latex-template.mdmarkdown6.2 KB
references/mechanism-validation.mdmarkdown11.6 KB
references/open-topic-research.mdmarkdown4.9 KB
references/task-driven-modeling.mdmarkdown7.2 KB
schemas/claim-ledger.schema.jsonconfig5.5 KB
schemas/common.schema.jsonconfig2.5 KB
schemas/compile-receipt.schema.jsonconfig3.7 KB
schemas/cross-question-ledger.schema.jsonconfig1.3 KB
schemas/delivery-manifest.schema.jsonconfig7.9 KB
schemas/figure-manifest.schema.jsonconfig1.9 KB
schemas/handoff.schema.jsonconfig2.1 KB
schemas/independent-review-package.schema.jsonconfig3.4 KB
schemas/independent-review-result.schema.jsonconfig4.0 KB
schemas/latex-template-manifest.schema.jsonconfig2.4 KB
schemas/model-contract.schema.jsonconfig5.0 KB
schemas/paper-plan.schema.jsonconfig3.3 KB
schemas/paper-quality-report.schema.jsonconfig5.7 KB
schemas/paper-revision-log.schema.jsonconfig2.2 KB
schemas/paper-visible-text-report.schema.jsonconfig1.6 KB
schemas/problem-facts.schema.jsonconfig1.7 KB
schemas/results-index.schema.jsonconfig1.4 KB
schemas/run-manifest.schema.jsonconfig7.1 KB
schemas/source-manifest.schema.jsonconfig1.9 KB
schemas/task-capabilities.schema.jsonconfig3.9 KB
schemas/workflow-state.schema.jsonconfig2.4 KB
scripts/backend_selection.pyscript6.3 KB
scripts/build_handoff.pyscript20.4 KB
scripts/build_independent_review_package.pyscript14.9 KB
scripts/canonical_evidence.pyscript8.4 KB
scripts/compile_sources.pyscript2.4 KB
scripts/cumcm_check.pyscript2.9 KB
scripts/delivery_archives.pyscript7.0 KB
scripts/doctor.pyscript7.5 KB
scripts/index_result.pyscript10.9 KB
scripts/init_latex_paper.pyscript17.2 KB
scripts/init_project.pyscript11.1 KB
scripts/inventory_artifacts.pyscript4.1 KB
scripts/json_pointer.pyscript1.0 KB
scripts/official_materials.pyscript3.0 KB
scripts/paper_visible_text_check.pyscript5.4 KB
scripts/plan_redo.pyscript18.8 KB
scripts/project_status.pyscript5.8 KB
scripts/provenance.pyscript2.2 KB
scripts/record_compile.pyscript13.2 KB
scripts/record_decision.pyscript12.0 KB
scripts/record_run.pyscript28.1 KB
scripts/refresh_evidence.pyscript4.7 KB
scripts/set_mode.pyscript2.0 KB
scripts/submission_check.pyscript10.6 KB
scripts/workflow_checks.pyscript146.0 KB

scripts/doctor.py

View on GitHub
#!/usr/bin/env python3
"""Read-only environment diagnostics; standard library only, no installation."""
from __future__ import annotations

import argparse
import ast
import json
import math
import os
from pathlib import Path
import re
import shutil
import subprocess
import sys
import tempfile

sys.dont_write_bytecode = True
from backend_selection import detect_matlab_executable

SKILL = Path(__file__).resolve().parents[1]


def probe(command: list[str], timeout: float) -> tuple[str, str]:
    """Run a bounded probe outside the project; never use a shell."""
    try:
        with tempfile.TemporaryDirectory(prefix="modeling-doctor-") as directory:
            env = dict(os.environ, PYTHONDONTWRITEBYTECODE="1")
            result = subprocess.run(command, cwd=directory, env=env, stdin=subprocess.DEVNULL,
                                    capture_output=True, text=True, errors="replace", timeout=timeout)
        detail = (result.stdout + result.stderr).strip()[:1500]
        return ("available" if result.returncode == 0 else "failed", detail or f"exit={result.returncode}")
    except subprocess.TimeoutExpired:
        return "failed", f"probe timed out after {timeout:g}s"
    except OSError as exc:
        return "failed", str(exc)


def python_command(code: str) -> list[str]:
    # Keep site/environment visibility consistent with the interpreter being diagnosed.
    flags = []
    if sys.flags.no_site:
        flags.append("-S")
    if sys.flags.no_user_site:
        flags.append("-s")
    if sys.flags.ignore_environment:
        flags.append("-E")
    return [sys.executable, *flags, "-B", "-c", code]


def diagnose(timeout: float = 10, modules: tuple[str, ...] = (), probe_matlab: bool = False) -> dict:
    checks = []

    def add(name, status, detail, stage):
        checks.append(dict(name=name, status=status, detail=detail, needed_for=stage))

    required = ["SKILL.md", "scripts/init_project.py", "scripts/workflow_checks.py",
                "scripts/record_run.py", "scripts/project_status.py", "schemas/workflow-state.schema.json"]
    missing = [p for p in required if not (SKILL / p).is_file()]
    version = None
    try:
        tree = ast.parse((SKILL / "scripts/workflow_checks.py").read_text(encoding="utf-8"))
        version = next(ast.literal_eval(node.value) for node in tree.body
                       if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == "WORKFLOW_VERSION" for t in node.targets))
    except (OSError, SyntaxError, ValueError, StopIteration):
        missing.append("readable WORKFLOW_VERSION")
    add("workflow", "missing" if missing else "available", ", ".join(missing) if missing else f"{SKILL} (v{version}; core files only)", "all")
    add("python", "available" if sys.version_info >= (3, 10) else "failed", f"{sys.version.split()[0]} ({sys.executable})", "all")
    # Import AND check supported distribution versions, without importing workflow code.
    for module, lower, upper in (("jsonschema", (4, 18), (5,)), ("referencing", (0, 35), (1,))):
        code = ("import importlib, importlib.metadata, re; "
                f"importlib.import_module({module!r}); v=importlib.metadata.version({module!r}); "
                "n=tuple(int(x) for x in re.match(r'(\\d+(?:\\.\\d+)*)', v).group().split('.')); "
                f"print(v); raise SystemExit(0 if {lower!r} <= n < {upper!r} else 'unsupported version')")
        status, detail = probe(python_command(code), timeout)
        add(module, status, detail, "all")
    for module in modules:
        if not re.fullmatch(r"[A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*", module):
            raise ValueError(f"invalid import module name: {module}")
        status, detail = probe(python_command(f"import importlib; importlib.import_module({module!r}); print('import succeeded')"), timeout)
        add(f"module:{module}", status, detail, "computation")
    detected = detect_matlab_executable()
    matlab = detected["path"] if detected else None
    if not matlab:
        add("matlab", "missing", "MATLAB not found by the existing backend detector; Python remains an option", "optional MATLAB backend")
    elif probe_matlab:
        status, detail = probe([matlab, "-batch", "disp(version); assert(license('test','MATLAB'));"], timeout)
        add("matlab", status, detail, "optional MATLAB backend")
    else:
        add("matlab", "unverified", f"{matlab}; not launched; license/toolboxes untested", "optional MATLAB backend")
    for name, args in (("xelatex", ["--version"]), ("pdftoppm", ["-v"]), ("pdfinfo", ["-v"])):
        executable = shutil.which(name)
        status, detail = probe([executable, *args], timeout) if executable else ("missing", f"{name} not found on PATH")
        add(name, status, detail.splitlines()[0] if detail else detail, "paper/delivery")
    kpsewhich = shutil.which("kpsewhich")
    status, detail = probe([kpsewhich, "ctexart.cls"], timeout) if kpsewhich else ("missing", "kpsewhich not found on PATH")
    if status == "available" and not Path(detail).is_file():
        status, detail = "unverified", "no existing class file returned"
    add("ctex", status, detail, "Chinese paper")
    base = all(c["status"] == "available" for c in checks if c["needed_for"] == "all")
    return {
        "workflow_version": version, "checks": checks,
        "base_ready": base,
        "python_imports_ready": base and all(c["status"] == "available" for c in checks if c["needed_for"] == "computation"),
        "paper_tools_detected": all(c["status"] == "available" for c in checks if c["needed_for"] == "paper/delivery"),
        "notes": ["Only explicitly requested model modules are checked; solver execution and task suitability are not established.",
                  "Paper probes check tools/class discovery, not actual compilation, fonts or PDF quality.",
                  "Missing paper tools do not block intake/modeling. No installation or project writes performed."],
    }


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--json", action="store_true", help="emit structured report to stdout")
    parser.add_argument("--timeout", type=float, default=10, help="seconds per probe")
    parser.add_argument("--module", action="append", default=[], help="trusted installed Python module to import; repeat for model dependencies")
    parser.add_argument("--probe-matlab", action="store_true", help="launch MATLAB in a temporary directory; may use a license")
    args = parser.parse_args()
    if not math.isfinite(args.timeout) or args.timeout <= 0:
        parser.error("timeout must be finite and positive")
    try:
        report = diagnose(args.timeout, tuple(args.module), args.probe_matlab)
    except ValueError as exc:
        parser.error(str(exc))
    if args.json:
        print(json.dumps(report, ensure_ascii=False, indent=2))
    else:
        print("基础工作流环境:" + ("可用" if report["base_ready"] else "存在缺失或失败"))
        for c in report["checks"]:
            print(f"[{c['status']}] {c['name']} ({c['needed_for']}): {c['detail']}")
        print("下一步:" + ("可以开始读题与建模;按当前任务补齐计算依赖。" if report["base_ready"] else "先修复基础环境检查中的缺失或失败项,再重新诊断。"))
        print("论文工具缺失可稍后补齐;安装或系统配置变更前先取得用户同意。")
        for note in report["notes"]:
            print(note)
    return 0 if report["base_ready"] and report["python_imports_ready"] else 1


if __name__ == "__main__":
    raise SystemExit(main())
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall