Skip to content

hashgraph-online/awesome-codex-plugins / plugins/aklofas/kicad-happy/skills/datasheets

datasheets

Verified

Extract structured specifications from electronic component datasheet PDFs — pinouts, electrical characteristics, peripherals, topology, and features. Cache extractions per project for consumption by schematic and PCB analyzers. Primary consumer infrastructure for `kicad`, `emc`, `spice`, and `thermal` analyzers. Use this skill whenever the user asks to extract, verify, or read specs from a component datasheet; when analyzers need verified IC knowledge (EN pin thresholds, PG presence, USB peripheral speed); or when a review mentions datasheet coverage, extraction quality, or per-MPN specifications. Also triggers on "extract this datasheet", "what are the specs for MPN X", "verify datasheet extraction", or "check pin functions for part Y".

FileKindSize
SKILL.mdskill md11.2 KB
datasheet_types/__init__.pyscript1.9 KB
datasheet_types/base_block.pyscript6.5 KB
datasheet_types/cache_reader.pyscript12.3 KB
datasheet_types/codec.pyscript6.3 KB
datasheet_types/extraction.pyscript8.0 KB
datasheet_types/pinout.pyscript5.2 KB
datasheet_types/regulator.pyscript5.3 KB
datasheet_types/spec_value.pyscript2.4 KB
datasheet_types/trust_gating.pyscript5.0 KB
distributor_core/__init__.pyscript0 B
distributor_core/cli.pyscript2.9 KB
distributor_core/download.pyscript36.7 KB
distributor_core/inputs.pyscript9.0 KB
distributor_core/manifest.pyscript5.7 KB
distributor_core/sync.pyscript21.0 KB
distributor_core/verify.pyscript12.1 KB
examples/abm8g-106-12.000mhz-t.jsonconfig9.4 KB
examples/irlml6344.jsonconfig16.0 KB
examples/lm2596-adj.jsonconfig14.3 KB
examples/lm358.jsonconfig15.6 KB
examples/mbrs540t3g.jsonconfig12.3 KB
examples/stm32f103c8t6.jsonconfig51.1 KB
prompts/base.mdmarkdown4.5 KB
prompts/crystal.mdmarkdown8.8 KB
prompts/diode.mdmarkdown8.3 KB
prompts/mcu.mdmarkdown9.6 KB
prompts/opamp.mdmarkdown10.7 KB
prompts/pinout.mdmarkdown4.7 KB
prompts/regulator.mdmarkdown4.4 KB
prompts/scout.mdmarkdown3.5 KB
prompts/transistor.mdmarkdown12.5 KB
references/cache-layout.mdmarkdown8.4 KB
references/consumer-api.mdmarkdown10.8 KB
references/dispatch-claude-code.mdmarkdown9.4 KB
references/dispatcher-contract.mdmarkdown8.2 KB
references/extraction-pipeline.mdmarkdown1.7 KB
references/extraction-schema.mdmarkdown18.0 KB
references/field-extraction-guide.mdmarkdown14.9 KB
references/quality-scoring.mdmarkdown8.4 KB
schemas/CHANGELOG.mdmarkdown16.0 KB
schemas/base.schema.jsonconfig9.3 KB
schemas/crystal.schema.jsonconfig7.2 KB
schemas/diode.schema.jsonconfig7.9 KB
schemas/extraction.schema.jsonconfig3.7 KB
schemas/fixtures/lm2596-adj.example.jsonconfig14.3 KB
schemas/fixtures/manifest.example.jsonconfig1000 B
schemas/fixtures/minimal.example.jsonconfig2.1 KB
schemas/manifest.schema.jsonconfig3.0 KB
schemas/mcu.schema.jsonconfig12.4 KB
schemas/opamp.schema.jsonconfig9.2 KB
schemas/pinout.schema.jsonconfig5.9 KB
schemas/plan.schema.jsonconfig4.6 KB
schemas/regulator.schema.jsonconfig8.4 KB
schemas/scout.schema.jsonconfig2.9 KB
schemas/spec_value.schema.jsonconfig3.0 KB
schemas/transistor.schema.jsonconfig12.0 KB
scripts/_smoke_v14_roundtrip.pyscript8.9 KB
scripts/datasheet_extract_cache.pyscript21.2 KB
scripts/datasheet_features.pyscript17.1 KB
scripts/datasheet_page_selector.pyscript16.7 KB
scripts/datasheet_score.pyscript15.5 KB
scripts/datasheet_verify.pyscript45.6 KB
scripts/extraction_schema.pyscript1.8 KB
scripts/merge_results.pyscript13.0 KB
scripts/plan_extraction.pyscript9.5 KB
scripts/validate_extraction_result.pyscript4.0 KB
scripts/validate_sanity_vector.pyscript6.4 KB

scripts/validate_extraction_result.py

View on GitHub
#!/usr/bin/env python3
"""Validate a single per-task extraction result against its schema.

Wraps the inline per-task validator that `merge_results.py` runs at extract
time, exposed as a standalone CLI for the harness 4-check acceptance gate
(Check 1).

Input: a wrapped result file
    {task_id, schema_version, status, extracted_at, model_tier, model_id, data}

The `data` field is validated against `skills/datasheets/schemas/<task-type>.schema.json`.

Exit codes:
    0  data validates and status == "complete"
    1  schema validation failed, status != "complete", or unreadable result
    2  CLI / I/O error (missing schema, missing file, bad JSON in result wrapper)

Designed for `--task-type` to be any task name backed by a sibling
`<name>.schema.json` — the mcu/opamp/transistor/diode/crystal tasks work
without code changes.
"""

from __future__ import annotations

import argparse
import json
import sys
from pathlib import Path

from extraction_schema import validate_against_schema


SCHEMA_DIR = Path(__file__).resolve().parents[1] / "schemas"


def _resolve_schema(task_type: str) -> Path:
    return SCHEMA_DIR / f"{task_type}.schema.json"


def validate_result(result_file: Path, task_type: str) -> "tuple[int, str]":
    """Return (exit_code, message). exit_code semantics match module docstring."""
    schema_path = _resolve_schema(task_type)
    if not schema_path.exists():
        return 2, f"schema not found for task-type {task_type!r}: {schema_path}"

    if not result_file.exists():
        return 2, f"result file not found: {result_file}"

    try:
        wrapper = json.loads(result_file.read_text(encoding="utf-8"))
    except (json.JSONDecodeError, RecursionError) as exc:
        return 2, f"result file is not valid JSON: {exc}"

    status = wrapper.get("status")
    if status != "complete":
        err = wrapper.get("error") or "no error message provided"
        return 1, f"result status is {status!r} (expected 'complete'): {err}"

    if "data" not in wrapper:
        return 1, "result wrapper has no 'data' field"

    schema = json.loads(schema_path.read_text(encoding="utf-8"))
    err = validate_against_schema(wrapper["data"], schema)
    if err:
        return 1, f"schema validation: {err}"

    return 0, f"valid: {result_file.name} matches {schema_path.name}"


def main(argv: "list[str] | None" = None) -> int:
    ap = argparse.ArgumentParser(
        description=(
            "Validate a single per-task extraction result against its declared schema. "
            "Used by the harness 4-check gate (Check 1)."
        ),
    )
    ap.add_argument(
        "--result-file",
        type=Path,
        required=True,
        help="path to <mpn>.<task_id>.result.json",
    )
    ap.add_argument(
        "--task-type",
        required=True,
        help="task name; resolves to skills/datasheets/schemas/<task-type>.schema.json",
    )
    ap.add_argument(
        "--json",
        dest="emit_json",
        action="store_true",
        help="emit a JSON summary to stdout instead of human text",
    )
    args = ap.parse_args(argv)

    code, message = validate_result(args.result_file, args.task_type)

    if args.emit_json:
        json.dump(
            {
                "valid": code == 0,
                "exit_code": code,
                "message": message,
                "result_file": str(args.result_file),
                "task_type": args.task_type,
            },
            sys.stdout,
            indent=2,
        )
        sys.stdout.write("\n")
    else:
        stream = sys.stdout if code == 0 else sys.stderr
        print(message, file=stream)

    return code


if __name__ == "__main__":
    for _stream in (sys.stdout, sys.stderr):  # UTF-8 on a cp1252 pipe (Windows)
        if hasattr(_stream, "reconfigure"):
            _kw = {"newline": "\n"}
            if (getattr(_stream, "encoding", "") or "").lower().replace("-", "") != "utf8":
                _kw.update(encoding="utf-8", errors="backslashreplace")
            _stream.reconfigure(**_kw)
    sys.exit(main())
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall