Skip to content

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

Analyze KiCad projects and PDF schematics: schematics, PCB layouts, Gerbers, footprints, symbols, netlists, and design rules. Reviews designs for bugs, traces nets, cross-references schematic to PCB, extracts BOM data, checks DRC/ERC, DFM, power trees, and regulator circuits. Every finding carries a confidence label and evidence source with trust_summary rollup. Analyzes PDF schematics from dev boards, reference designs, eval kits, and datasheets. Supports KiCad 5–10. Use whenever the user mentions .kicad_sch, .kicad_pcb, .kicad_pro, PCB design review, schematic analysis, PDF schematics, reference designs, Gerber files, DRC/ERC, netlist issues, BOM extraction, signal tracing, power budget, DFM, or wants to understand, debug, compare, or review any hardware design. Also for "check my board", "review before fab", "what's wrong with my schematic", "is this ready to order", "check my power supply", "verify this circuit", OSHWA certification readiness, or any electronics/PCB design question.

FileKindSize
SKILL.mdskill md79.1 KB
references/config-reference.mdmarkdown19.1 KB
references/datasheet-verification.mdmarkdown16.5 KB
references/deep-review.mdmarkdown9.7 KB
references/design-intent.mdmarkdown5.6 KB
references/diff-analysis.mdmarkdown17.6 KB
references/file-formats.mdmarkdown15.1 KB
references/gerber-parsing.mdmarkdown33.5 KB
references/manual-gerber-parsing.mdmarkdown24.5 KB
references/manual-pcb-parsing.mdmarkdown17.2 KB
references/manual-schematic-parsing.mdmarkdown12.8 KB
references/net-tracing.mdmarkdown12.0 KB
references/oshwa-certification.mdmarkdown4.5 KB
references/output-schema.mdmarkdown33.4 KB
references/pcb-layout-analysis.mdmarkdown27.3 KB
references/pdf-schematic-extraction.mdmarkdown15.2 KB
references/report-generation.mdmarkdown56.3 KB
references/schematic-analysis.mdmarkdown63.9 KB
references/standards-compliance.mdmarkdown33.5 KB
references/supplementary-data-sources.mdmarkdown12.5 KB
references/what-if.mdmarkdown19.5 KB
review/README.mdmarkdown4.1 KB
review/fixtures/deep_review.example.jsonconfig1.2 KB
review/fixtures/design_context.example.jsonconfig388 B
review/fixtures/review_annotations.example.jsonconfig707 B
review/prompts/design_context.mdmarkdown4.9 KB
review/schemas/deep_review.schema.jsonconfig3.3 KB
review/schemas/design_context.schema.jsonconfig2.2 KB
review/schemas/review_annotations.schema.jsonconfig1.9 KB
review/scripts/_mini_jsonschema.pyscript6.6 KB
review/scripts/build_review_plan.pyscript2.3 KB
review/scripts/deep_review_gate.pyscript27.3 KB
review/scripts/merge_annotations.pyscript7.0 KB
review/scripts/validate_review.pyscript2.6 KB
scripts/.gitignoreother13 B
scripts/README.mdmarkdown23.4 KB
scripts/analysis_cache.pyscript42.1 KB
scripts/analyze_gerbers.pyscript90.9 KB
scripts/analyze_pcb.pyscript7.4 KB
scripts/analyze_schematic.pyscript6.7 KB
scripts/analyze_thermal.pyscript48.5 KB
scripts/analyzer_envelope.pyscript15.5 KB
scripts/capability_mode.pyscript10.2 KB
scripts/check_report_sections.pyscript10.6 KB
scripts/cross_analysis.pyscript69.4 KB
scripts/cross_verify.pyscript23.1 KB
scripts/design_intent.pyscript13.5 KB
scripts/detection_schema.pyscript26.0 KB
scripts/detector_helpers.pyscript15.2 KB
scripts/diff_analysis.pyscript23.5 KB
scripts/diff_engine.pyscript47.2 KB
scripts/domain_detectors.pyscript260.5 KB
scripts/envelopes/__init__.pyscript0 B
scripts/envelopes/cross_analysis.pyscript5.9 KB
scripts/envelopes/gerber.pyscript16.1 KB
scripts/envelopes/pcb.pyscript25.9 KB
scripts/envelopes/schematic.pyscript23.1 KB
scripts/envelopes/thermal.pyscript7.4 KB
scripts/export_issues.pyscript27.6 KB
scripts/fab_release_gate.pyscript29.8 KB
scripts/finding_schema.pyscript25.7 KB
scripts/gen_output_schema_md.pyscript9.2 KB
scripts/inputs_builder.pyscript4.0 KB
scripts/kicad_core/__init__.pyscript0 B
scripts/kicad_core/classify.pyscript32.5 KB
scripts/kicad_core/cli.pyscript4.2 KB
scripts/kicad_core/coords.pyscript2.0 KB
scripts/kicad_core/diagnostics.pyscript1.9 KB
scripts/kicad_core/executables.pyscript1.0 KB
scripts/kicad_core/fields.pyscript5.9 KB
scripts/kicad_core/fileio.pyscript5.4 KB
scripts/kicad_core/hotloop.pyscript3.1 KB
scripts/kicad_core/instances.pyscript5.7 KB
scripts/kicad_core/model.pyscript4.8 KB
scripts/kicad_core/netnames.pyscript19.1 KB
scripts/kicad_core/netquery.pyscript6.7 KB
scripts/kicad_core/pairing.pyscript1.9 KB
scripts/kicad_core/parts.pyscript28.9 KB
scripts/kicad_core/passives.pyscript10.0 KB
scripts/kicad_core/pdn.pyscript1011 B
scripts/kicad_core/project.pyscript43.2 KB
scripts/kicad_core/render.pyscript2.7 KB
scripts/kicad_core/sexp.pyscript12.6 KB
scripts/kicad_core/textvars.pyscript5.4 KB
scripts/kicad_core/token_cache.pyscript2.2 KB
scripts/kicad_core/values.pyscript14.1 KB
scripts/kicad_types.pyscript15.1 KB
scripts/lifecycle_audit.pyscript6.7 KB
scripts/lifecycle_engine.pyscript52.8 KB
scripts/lookup_detectors.pyscript29.9 KB
scripts/lookup_helpers.pyscript3.0 KB
scripts/methodology_gerbers.mdmarkdown23.1 KB
scripts/methodology_pcb.mdmarkdown22.2 KB
scripts/methodology_schematic.mdmarkdown43.1 KB
scripts/netlist_queries.pyscript4.2 KB
scripts/output_filters.pyscript16.8 KB
scripts/output_io.pyscript5.3 KB
scripts/pcb/__init__.pyscript0 B
scripts/pcb/assembly.pyscript58.3 KB
scripts/pcb/connectivity.pyscript27.7 KB
scripts/pcb/copper.pyscript61.0 KB
scripts/pcb/dfm.pyscript56.9 KB
scripts/pcb/geometry.pyscript59.5 KB
scripts/pcb/pipeline.pyscript30.3 KB
scripts/pcb/presentation.pyscript24.3 KB
scripts/pcb/reader.pyscript87.1 KB
scripts/pcb/routing.pyscript53.5 KB
scripts/project_config.pyscript23.1 KB
scripts/risk_summary.pyscript3.1 KB
scripts/run_id.pyscript1.7 KB
scripts/schema_codec.pyscript5.0 KB
scripts/schematic/__init__.pyscript0 B
scripts/schematic/audits.pyscript56.0 KB
scripts/schematic/bom_stats.pyscript6.1 KB
scripts/schematic/connectivity.pyscript62.9 KB
scripts/schematic/erc_pins.pyscript8.4 KB
scripts/schematic/hierarchy.pyscript21.5 KB
scripts/schematic/ic_analysis.pyscript21.4 KB
scripts/schematic/legacy_reader.pyscript49.4 KB
scripts/schematic/net_analysis.pyscript75.5 KB
scripts/schematic/pipeline.pyscript72.2 KB
scripts/schematic/presentation.pyscript20.9 KB
scripts/schematic/reader.pyscript64.7 KB
scripts/schematic/system_analyses.pyscript126.9 KB
scripts/signal_detectors.pyscript248.0 KB
scripts/summarize_findings.pyexecutablescript17.4 KB
scripts/validation_detectors.pyscript75.3 KB
scripts/what_if.pyscript68.4 KB

scripts/check_report_sections.py

View on GitHub
#!/usr/bin/env python3
"""Report completeness gate.

Reads a design-review run's analyzer JSON and derives the set of report
sections that a *full* review must contain — both the always-required base
sections and the conditional sections implied by present, non-empty analyzer
data (e.g. a populated `pdn_impedance` block means the report must carry a
"PDN Impedance" section).

Two modes:
  * default: print the required section list (grouped, with the trigger).
  * --report <file.md>: check that the finished report contains a header for
    each required section. Prints any that are missing and exits non-zero.

This converts the soft "read references/report-generation.md and write it all"
instruction into a checkable list — for the agent before it claims a review is
complete, or for CI. Stdlib-only, cross-platform.

Usage:
    python3 check_report_sections.py --analysis-dir analysis/
    python3 check_report_sections.py --analysis-dir analysis/ --report design-review.md
    python3 check_report_sections.py --run-dir analysis/2026-05-28_0058/
"""
from __future__ import annotations

import argparse
import os
import re
import sys

from kicad_core.fileio import json_load
from kicad_core.diagnostics import record

# Optional schematic keys -> required report section. Section is required only
# when the key is present AND non-empty in schematic.json. Aliases are the
# header substrings (normalized) accepted as satisfying the section.
SCHEMATIC_KEY_SECTIONS = [
    ("pdn_impedance",       "PDN Impedance",        ["pdn impedance", "pdn"]),
    ("power_budget",        "Power Budget",         ["power budget"]),
    ("power_sequencing",    "Power Sequencing",     ["power sequencing", "sequencing"]),
    ("sleep_current_audit", "Sleep Current Audit",  ["sleep current", "quiescent"]),
    ("inrush_analysis",     "Inrush Analysis",      ["inrush"]),
    ("voltage_derating",    "Voltage Derating",     ["voltage derating", "derating"]),
    ("usb_compliance",      "USB Compliance",       ["usb compliance", "usb"]),
    ("bus_topology",        "Bus Topology",         ["bus topology"]),
    ("test_coverage",       "Test Coverage",        ["test coverage", "testability", "test point"]),
    ("assembly_complexity", "Assembly Complexity",  ["assembly complexity", "assembly", "dfm"]),
    ("bom_optimization",    "BOM Optimization",     ["bom optimization", "bom optimisation"]),
]

# Always-required base sections for a full review (see references/
# report-generation.md "Required Sections for Full Reviews"). Independent of
# optional keys, but some are gated on the corresponding analyzer running.
BASE_SECTIONS = [
    ("Overview",                  ["overview"]),
    ("Critical Findings",         ["critical finding", "blockers", "critical issue"]),
    ("Component Summary",         ["component summary", "components"]),
    ("Power Tree",                ["power tree", "power architecture"]),
    ("Analyzer Verification",     ["analyzer verification", "verification"]),
    ("Signal Analysis Review",    ["signal analysis", "signal path"]),
    ("Not Performed / Review Limits", ["not performed", "review limits", "limitations"]),
    ("Final verdict / readiness", ["verdict", "readiness", "ready to fab", "ready for fab", "conclusion"]),
]

# Per-analyzer-envelope conditional sections (required when that analyzer ran).
ANALYZER_SECTIONS = {
    "pcb":            ("PCB Layout Analysis",        ["pcb layout", "layout analysis", "pcb analysis"]),
    "emc":            ("EMC / Cross-Domain Analysis", ["emc", "cross-domain", "cross domain", "emi"]),
    "thermal":        ("Thermal Analysis",            ["thermal"]),
    "gerber":         ("Gerber Verification",         ["gerber"]),
    "cross_analysis": ("EMC / Cross-Domain Analysis", ["cross-domain", "cross domain", "cross-reference", "cross reference"]),
}

ANALYZER_FILES = ["schematic", "pcb", "emc", "thermal", "gerber", "cross_analysis"]


def _normalize(s: str) -> str:
    """Lowercase, replace non-alphanumerics with spaces, collapse whitespace."""
    return " ".join(re.sub(r"[^a-z0-9]+", " ", s.lower()).split())


def _resolve_run_dir(analysis_dir: str | None, run_dir: str | None) -> str:
    """Return a directory that directly contains the analyzer JSON files."""
    if run_dir:
        return run_dir
    if analysis_dir:
        # If the analyzer JSONs sit directly in analysis_dir, use it as-is.
        if os.path.isfile(os.path.join(analysis_dir, "schematic.json")):
            return analysis_dir
        try:
            sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
            from analysis_cache import get_current_run
            current = get_current_run(analysis_dir)
            if current is not None:
                return current[0]
        except Exception as exc:
            record(None, "check_report_sections._resolve_run_dir", exc,
                   "current run not resolved; analysis_dir used as given")
        return analysis_dir
    return "analysis"


def _load_envelopes(run_dir: str) -> dict:
    envs = {}
    for stem in ANALYZER_FILES:
        path = os.path.join(run_dir, f"{stem}.json")
        if os.path.isfile(path):
            try:
                with open(path, encoding="utf-8") as f:
                    env = json_load(f)
                if not isinstance(env, dict):
                    raise ValueError(f"top level is {type(env).__name__}, not an object")
            except (ValueError, OSError) as exc:
                # The analyzer ran, so its sections stay required.
                record(None, f"check_report_sections: {path}", exc,
                       f"{stem} sections still required; its data was not read")
                env = {}
            envs[stem] = env
    return envs


def required_sections(envs: dict, analysis_dir: str | None = None) -> list[tuple[str, list[str], str]]:
    """Return [(section_label, header_aliases, trigger_reason)]."""
    out = []
    for label, aliases in BASE_SECTIONS:
        # Signal Analysis only required when a schematic ran.
        if label == "Signal Analysis Review" and "schematic" not in envs:
            continue
        out.append((label, aliases, "base"))

    for stem, (label, aliases) in ANALYZER_SECTIONS.items():
        if stem in envs and not any(o[0] == label for o in out):
            out.append((label, aliases, f"{stem}.json present"))

    sch = envs.get("schematic", {})
    for key, label, aliases in SCHEMATIC_KEY_SECTIONS:
        val = sch.get(key)
        if val:  # present and non-empty
            out.append((label, aliases, f"schematic.{key} present"))

    # Deep Review slot: required when the durable
    # findings file exists (flat, sibling of manifest.json).
    if analysis_dir and os.path.isfile(os.path.join(analysis_dir, "deep_review.json")):
        out.append(("Deep Review",
                    ["deep review", "unverified claims", "usage-vs-datasheet"],
                    "deep_review.json present"))
    return out


# Aliases that count only when they are the whole header: as a substring they
# would also match other sections ("Gerber Verification").
_WHOLE_HEADER_ALIASES = {"verification"}


def _alias_matches(alias: str, header: str) -> bool:
    if not alias:
        return False
    if alias in _WHOLE_HEADER_ALIASES:
        return header == alias
    return alias in header


def check_report(report_path: str, sections) -> list[str]:
    """Return labels of required sections with no matching header in the report.

    Each header satisfies at most one section (a maximum matching), so one
    combined header cannot stand in for two required sections.
    """
    with open(report_path, encoding="utf-8") as f:
        text = f.read()
    headers = [_normalize(m.group(1))
               for m in re.finditer(r"^#{1,6}\s+(.*)$", text, re.MULTILINE)]
    candidates = []
    for _label, aliases, _ in sections:
        norm_aliases = [_normalize(a) for a in aliases]
        candidates.append([i for i, h in enumerate(headers)
                           if any(_alias_matches(na, h) for na in norm_aliases)])

    owner = {}  # header index -> section index

    def assign(sec, seen):
        for h in candidates[sec]:
            if h in seen:
                continue
            seen.add(h)
            if h not in owner or assign(owner[h], seen):
                owner[h] = sec
                return True
        return False

    matched = {sec for sec in range(len(sections)) if assign(sec, set())}
    return [label for n, (label, _a, _r) in enumerate(sections) if n not in matched]


def main() -> int:
    p = argparse.ArgumentParser(description="Report completeness gate for full design reviews.")
    p.add_argument("--analysis-dir", help="analysis/ dir (current run resolved via manifest)")
    p.add_argument("--run-dir", help="Directory directly containing schematic.json etc.")
    p.add_argument("--report", help="Markdown report to check for required section headers")
    args = p.parse_args()

    run_dir = _resolve_run_dir(args.analysis_dir, args.run_dir)
    envs = _load_envelopes(run_dir)
    if not envs:
        print(f"No analyzer JSON found under {run_dir!r}. "
              f"Pass --analysis-dir or --run-dir pointing at a completed run.",
              file=sys.stderr)
        return 2

    # Determine the flat analysis dir (sibling of manifest.json) for conditional
    # section triggers (e.g. deep_review.json). When --analysis-dir is given use
    # it directly; when only --run-dir is given, derive it as the parent.
    if args.analysis_dir:
        analysis_dir = args.analysis_dir
    elif args.run_dir:
        analysis_dir = os.path.dirname(os.path.abspath(args.run_dir))
    else:
        analysis_dir = "analysis"

    sections = required_sections(envs, analysis_dir=analysis_dir)
    print(f"Analyzers present: {', '.join(sorted(envs))}")
    print(f"Required report sections ({len(sections)}):")
    for label, _, trigger in sections:
        print(f"  - {label}   [{trigger}]")

    if args.report:
        if not os.path.isfile(args.report):
            print(f"\nReport not found: {args.report}", file=sys.stderr)
            return 2
        missing = check_report(args.report, sections)
        if missing:
            print(f"\nMISSING {len(missing)} required section(s) in {args.report}:")
            for m in missing:
                print(f"  - {m}")
            print("\nA full review must cover these. Add the section (with data) or, "
                  "if genuinely N/A, a one-line 'not applicable: <reason>' header.")
            return 1
        print(f"\nOK: all {len(sections)} required sections present in {args.report}.")
    return 0


if __name__ == "__main__":
    from kicad_core.cli import utf8_stdio
    utf8_stdio()
    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: 321kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 321kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 321kUpdated 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: 197kUpdated Claude CodeCodexVerifiedInstall