Skip to content

dongshuyan/compass-skills / skills/assess-interview-candidate

assess-interview-candidate

Verified

根据候选人简历与岗位要求生成可审计的后台评估、简明的候选人介绍、按岗位重要性排列的简历疑点、12–18 道可直接照读的面试题,以及支持重点标记和本机保存的离线 HTML。用于招聘方准备结构化面试、核验岗位能力和记录回答。不要用于求职者模拟面试、私人背景调查、心理或人格诊断、从敏感属性推断表现,或自动录用、淘汰、排序候选人。

FileKindSize
SKILL.mdskill md17.9 KB
agents/openai.yamlconfig329 B
assets/candidate-assessment-template.htmlother35.5 KB
evals/evals.jsonconfig11.1 KB
references/agent-portability.mdmarkdown3.5 KB
references/evidence-and-inference-policy.mdmarkdown7.8 KB
references/job-modeling.mdmarkdown3.8 KB
references/privacy-and-fairness-cn.mdmarkdown7.1 KB
references/research-and-identity-policy.mdmarkdown4.0 KB
references/role-adapter-ai-llm-engineering.mdmarkdown5.7 KB
references/schema-evidence-ledger.jsonconfig6.2 KB
references/schema-interview-blueprint.jsonconfig5.6 KB
references/schema-interviewer-report.jsonconfig13.7 KB
references/schema-job-model.jsonconfig4.5 KB
references/schema-source-record.jsonconfig9.5 KB
references/scoring-and-coverage.mdmarkdown9.5 KB
references/structured-interview-methods.mdmarkdown4.8 KB
references/workflow-contract.mdmarkdown14.7 KB
scripts/calculate_interview_score.pyscript15.5 KB
scripts/create_candidate_case.pyscript3.6 KB
scripts/derive_timeline_age.pyscript9.9 KB
scripts/normalize_inputs.pyscript9.0 KB
scripts/prepare_candidate_photo.pyscript12.4 KB
scripts/render_candidate_report.pyscript5.3 KB
scripts/validate_candidate_report.pyscript10.1 KB
scripts/validate_case_contract.pyscript28.3 KB
scripts/validate_evidence_ledger.pyscript15.2 KB
scripts/validate_interviewer_report_data.pyscript35.4 KB
scripts/validate_source_log.pyscript21.4 KB
tests/test_candidate_profile_enrichment.pyscript40.3 KB
tests/test_interviewer_report.pyscript34.1 KB
tests/test_public_package.pyscript7.0 KB

scripts/render_candidate_report.py

View on GitHub
#!/usr/bin/env python3
"""Render minimal interviewer-report JSON into a self-contained HTML file."""

from __future__ import annotations

import argparse
import html
import json
import os
import re
import sys
from pathlib import Path
from typing import Any

from validate_case_contract import loads_strict
from validate_interviewer_report_data import validate_interviewer_report_data


DATA_PLACEHOLDER = "__INTERVIEWER_REPORT_DATA_JSON__"
TITLE_PLACEHOLDER = "__REPORT_TITLE_HTML__"
DEFAULT_TEMPLATE = Path(__file__).resolve().parent.parent / "assets" / "candidate-assessment-template.html"
WINDOWS_RESERVED_BASENAMES = {
    "CON",
    "PRN",
    "AUX",
    "NUL",
    *(f"COM{number}" for number in range(1, 10)),
    *(f"LPT{number}" for number in range(1, 10)),
}


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="Safely embed interviewer-report JSON into the offline HTML template. Existing output is preserved unless --force is explicit."
    )
    parser.add_argument(
        "--data",
        dest="report_data",
        required=True,
        type=Path,
        help="Simplified interviewer-report-data JSON object",
    )
    parser.add_argument("--output", required=True, type=Path, help="Destination .html file")
    parser.add_argument("--template", type=Path, default=DEFAULT_TEMPLATE, help="Bundled simplified report template")
    parser.add_argument("--force", action="store_true", help="Explicitly replace an existing output file")
    return parser.parse_args()


def safe_json_for_script(value: dict[str, Any]) -> str:
    serialized = json.dumps(value, ensure_ascii=False, separators=(",", ":"), allow_nan=False)
    return (
        serialized.replace("&", "\\u0026")
        .replace("<", "\\u003c")
        .replace(">", "\\u003e")
        .replace("\u2028", "\\u2028")
        .replace("\u2029", "\\u2029")
    )


def safe_filename_component(value: str) -> str:
    """Return a portable filename fragment while preserving readable names."""
    cleaned = re.sub(r"[\x00-\x1f/\\:*?\"<>|]+", "_", value)
    cleaned = re.sub(r"\s+", " ", cleaned).strip(" .")
    if not cleaned:
        raise ValueError("candidate name cannot be converted to a safe filename component")
    if cleaned.split(".", 1)[0].upper() in WINDOWS_RESERVED_BASENAMES:
        cleaned = "_" + cleaned
    return cleaned


def write_exclusive(path: Path, content: str, force: bool) -> None:
    if not path.parent.is_dir():
        raise ValueError(f"output parent does not exist: {path.parent}")
    if path.is_symlink():
        raise ValueError(f"refusing to write through symbolic link: {path}")
    if path.exists() and not force:
        raise FileExistsError(f"refusing to overwrite existing output: {path}")
    flags = os.O_WRONLY | os.O_CREAT | (os.O_TRUNC if force else os.O_EXCL)
    fd = os.open(path, flags, 0o600)
    with os.fdopen(fd, "w", encoding="utf-8", newline="\n") as handle:
        handle.write(content)
        handle.flush()
        os.fsync(handle.fileno())


def main() -> int:
    args = parse_args()
    try:
        report_data = loads_strict(args.report_data.expanduser().read_text(encoding="utf-8"))
        if not isinstance(report_data, dict):
            raise ValueError("interviewer report JSON must contain an object")
        contract_errors, contract_warnings = validate_interviewer_report_data(report_data)
        if contract_errors:
            raise ValueError("interviewer report contract invalid: " + " | ".join(contract_errors))
        template = args.template.expanduser().read_text(encoding="utf-8")
        data_occurrences = template.count(DATA_PLACEHOLDER)
        title_occurrences = template.count(TITLE_PLACEHOLDER)
        if data_occurrences != 1:
            raise ValueError(f"template must contain exactly one {DATA_PLACEHOLDER}; found {data_occurrences}")
        if title_occurrences != 2:
            raise ValueError(f"template must contain exactly two {TITLE_PLACEHOLDER}; found {title_occurrences}")

        output = args.output.expanduser()
        if output.suffix.lower() != ".html":
            raise ValueError("--output must use the .html extension")
        candidate_name = report_data["case"]["candidate_name"]
        safe_name = safe_filename_component(candidate_name)
        if safe_name not in output.stem:
            raise ValueError(
                f"--output filename must contain candidate name {safe_name!r}; "
                f"recommended: {safe_name}-候选人评估与面试报告.html"
            )
        report_title = f"{candidate_name}|候选人评估与面试报告"
        rendered = template.replace(DATA_PLACEHOLDER, safe_json_for_script(report_data))
        rendered = rendered.replace(TITLE_PLACEHOLDER, html.escape(report_title, quote=True))
        write_exclusive(output, rendered, args.force)
        print(json.dumps({
            "ok": True,
            "output": str(output.resolve()),
            "candidate_name": candidate_name,
            "bytes": output.stat().st_size,
            "warnings": contract_warnings,
        }, ensure_ascii=False, allow_nan=False))
        return 0
    except (OSError, ValueError, json.JSONDecodeError) as exc:
        print(json.dumps({"ok": False, "error": str(exc)}, ensure_ascii=False), file=sys.stderr)
        return 1


if __name__ == "__main__":
    raise SystemExit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall