kicad-mcp: Instructions file for Claude Code

CLAUDE.md

kicad-mcp CLAUDE.md is an instructions file for Claude Code from antonmadto/kicad-mcp. It costs 4,197 tokens per session, scanned A, original, MIT.

A set of Claude Code instructions that acts as the project constitution for kicad-mcp, a KiCad integration project.

In plain words
What is it for?
It helps Claude Code plan and implement kicad-mcp while following its project plan, review rules, tests, and session handoff notes.
Why use it?
It gives each coding session a shared starting point, current project status, required documents, and architectural rules to follow.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is antonmadto/kicad-mcp's own configuration. It tells Claude Code how to work on kicad-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kicad-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to antonmadto/kicad-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/antonmadto/kicad-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/antonmadto/kicad-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kicad-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/antonmadto/kicad-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/antonmadto/kicad-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/antonmadto/kicad-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/antonmadto/kicad-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kicad-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/antonmadto/kicad-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/antonmadto/kicad-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,197 This file is loaded in full into every session.
When invoked 4,197 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04197 $0.04197
Opus 5.5 $0.01679 $0.01679
Sonnet 5.5 $0.00839 $0.00839
Haiku 4.5 $0.00420 $0.00420

Measured 2mo ago against content hash e776aba0ea97, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kicad-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 84 lines

How it starts

The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md — kicad-mcp project constitution

This file is the durable operating agreement for building kicad-mcp. Read it every session. It is a distilled rulebook; the full spec is in PLAN.md. When the two conflict, PLAN.md wins and you should flag the conflict.

Read first, every session

  1. HANDOFF.md — START HERE. The current goal, what's done, and what to do next (making the MCP genuinely usable on real boards). Session-to-session baton.
  2. PLAN.md — master execution plan (architecture, pinned stack, repo layout §4, phases §8).
  3. docs/rules/hartley-rules.md, docs/rules/philslab-rules.md — the rule catalogs the review engine encodes.
  4. docs/rules/CHANGES.md — corrections verified against the source videos; severity and sourcing fixes you MUST honor.

Current status

  • Phase: ALL PHASES 0–6 complete and green (2026-07-04). Lint (ruff) + 179 pytest pass (2 GUI tests auto-skip without a GUI; they PASSED against live KiCad 9.0.8). 45 tools + 4 router tools, 4 prompts, 23 review rules across 10 families. Three adversarial multi-agent reviews run (Phase 0/1, Phase 2, Phase 4–6): 6 + 12 + 20 = 38 confirmed findings, ALL fixed. Highlights fixed: path-traversal guard, UTF-8 encoding, span-based plane detection (L-shaped boards), DEC-1 connector FP, R5 abutting-zone tolerance; and Phase 4–6: diff-pair bare-P/N mis-pairing (VIN/VIP false pair + USB_DP/DM miss), atomic schematic write (temp+os.replace — a failed edit now leaves the original byte-identical), C4 cross-segment overlap accumulation, microstrip prop delay 5.8→6.1 ps/mm, TaskStore locked snapshots + atexit shutdown, sqlite URI escaping, router double-wrap unwrap.
    • Phase 0: repo scaffold, pyproject.toml (hatchling, pinned stack), FastMCP bootstrap (kicad_mcp/server.py), config.py (KICAD_MCP_*), backend factory + capability router with graceful degradation (backends/{base,cli,sexpr,ipc,factory}.py), kicad-cli discovery (mac/win/linux + override), path confinement + shell=False subprocess helpers, CI (.github/workflows/ci.yml, 3 OSes × py3.10–3.13), get_server_status diagnostics tool.
    • Phase 1: project discovery/info/create (tools/project.py), S-expr read layer — components (kicad-skip), stackup + board info (sexpdata) — cli wrappers for ERC/DRC (normalized JSON), netlist, BOM, gerbers, drill, STEP, pos, SVG, 3D render, and export_fab_package (gerbers+drill+BOM+CPL zip). 17 tools registered. Nets via cli kicadxml netlist + trace_net.
    • Phase 2 — review engine v1 (kicad_mcp/review_engine/): normalized DesignModel (stackup + copper-layer role inference from zones, footprints/pads with absolute positions, tracks/vias/zones, net classification, geometry helpers), Rule/Finding/registry/report framework, and 11 cited rules across 5 families — stackup (K1/K2/K5/K6), grounding (G1/G2), return_path (R5, geometric trace-over-gap via point-in-polygon), decoupling (DEC-1 proximity), dfm (RTE-2/RTE-3/DFM-4). Tools review_design/review_topic/set_design_context + review_board prompt. 20 tools total. Golden fixtures in tests/fixtures/review/ (generator generate_review_fixtures.py) with must-trigger + must-not-trigger + anti-myth (90° corners → 0 findings) tests. Heuristic rules (G2, DEC-1) softened to WARNING to limit false positives, documented inline.
    • Phase 3 — live editing via IPC (backends/ipc.py, tools/board_edit.py, tools/routing.py): kipy connection mgmt with per-PID socket discovery (each KiCad process serves its own /tmp/kicad/api-<pid>.sock; we probe all and prefer one with an open board), commit() context manager (begin→push, drop on exception = single undo step), move/rotate footprint (rotate must assign via the orientation setter — the getter returns a copy), route_trace (polyline), add_via, route_differential_pair (mitered offset_polyline), add_zone (PolygonWithHoles), refill_zones, save_board. 30 tools total. Verified live against KiCad 9.0.8: moved/rotated R2, routed traces + diff pair, via, GND zone, refill, save → re-parsed the saved file (all edits present) → rendered headless (edits visible). Graceful errors when GUI down (all non-GUI tests still pass headless). NOT yet done (deferred to Phase 6 polish): place NEW footprint from a library via IPC (needs the symbol/footprint definition pipeline), netclass management tools.
    • Phase 4 — review engine v2: +5 families, 23 rules total. transmission (F2 critical-length keyed off set_design_context rise time, F4 intra-pair skew in picoseconds), crosstalk (C4 aggressor-near-diff-pair via segment proximity + 3×H), smps (PWR-3 FB-near-SW), subcircuits (XTL-1, STM-1 NRST=WARNING, STM-2, STM-6, USB-2, MIX-2 — schematic-connectivity via model.schematic from the netlist), connectors (CON-1, ESD-1). Explicit anti-myth test (test_antimyth.py) asserts no rule mentions a myth term. New golden fixtures highspeed_4layer {F2,F4,C4}, smps_4layer {PWR-3}.
    • Phase 5 — schematic edit + libraries: transactional write pipeline in sexpr.py (edit_schematic: flag gate + lock check → mutate → re-parse rollback on corruption → ERC report with delta), set_symbol_property/duplicate_symbol (clone, not lib injection — safer). backends/library.py: ranked symbol/footprint search over installed KiCad libs (exact>prefix>substring), JLCPCB SQLite search (jlcparts schema, actionable error when KICAD_MCP_JLCPCB_DB unset).
    • Phase 6 — advanced + polish: async TaskStore (tasks.py, thread pool) + get_task_status/list_tasks/cleanup_tasks; tool router (tools/router.py, 14 categories, list_tool_categories/get_category_tools/search_tools/execute_tool, completeness enforced by test); review/DRC history (history.py, .kicad-mcp/history.jsonl); Freerouting (backends/freerouting.py, async via task queue); prompts plan_stackup/debug_emi/prepare_fab; docs/architecture.md.
    • Rip-up / delete routing (2026-07-24): added rip_up_nets(nets) and rip_up_footprint(reference) to backends/ipc.py + tools/routing.py. Closes the delete-copper gap: the server could create tracks/vias but never remove them, and move_footprint stranded old copper. rip_up_nets validates names against board.get_nets(), collects get_tracks()+get_vias() on those nets (tracks/vias ONLY — never pads/zones), board.remove_items(victims) inside one commit() (single undo, rollback on error). rip_up_footprint scopes to the part's local pad nets (fanout ≤ 2 footprints), skipping shared GND/power nets so a plane is never torn up (include_shared=True to override). Both use KiCad-9-safe get_tracks()/get_vias() — NOT get_items_by_net/get_connected_items, which are kipy 0.7 / KiCad 10.0.1+ only (verified via versionadded annotations). 8 new fake-board unit tests + 1 requires_kicad_gui route-then-rip-up test. router.py routing category now lists both. 49 tools now.
    • v1.0 release prep + deferred gaps (2026-07-04): closed two gaps — duplicate_footprint (IPC proto-copy of a placed footprint; KiCad 9 IPC has NO library-instantiation API, verified) and get_netclasses (IPC read of netclass constraints), both verified live against KiCad 9.0.8. 47 tools at that point. Release: version → 0.1.0 (pyproject + __init__ + server.json in sync), CHANGELOG.md, docs/example.md (STM32 review→fix→export walkthrough), .github/workflows/release.yml (PyPI Trusted Publishing on tag), server.json (MCP registry manifest), PUBLISHING.md. Built + twine-checked the wheel/sdist and smoke-installed the wheel in a clean venv (version 0.1.0, 47 tools, kicad-mcp console entry point present). NOT published (outward-facing, needs the maintainer's PyPI/registry credentials — see PUBLISHING.md).
  • Remaining honest gaps (documented, not blockers): placing a NEW footprint/symbol from a LIBRARY — KiCad 9 IPC exposes no library-instantiation API and there is no schematic IPC at all, so duplicate_footprint/duplicate_symbol clone existing parts instead; DSN export is not available via kicad-cli in KiCad 9 so autoroute_board needs a GUI-exported .dsn; the tool router does not hide routed tools — a deliberate NON-goal (true hiding needs a FastMCP tool-visibility feature and 47 tools is manageable; forcing a dispatch-registry would add fragility for marginal benefit); JLCPCB/Freerouting exercised against a synthetic DB / interface only; cross-OS (uvx on Linux/Windows) only via CI so far, not a live KiCad smoke on those OSes.
  • Next action: publish (maintainer runs PUBLISHING.md: tag v0.1.0 → PyPI Trusted Publishing, then mcp-publisher for the registry) and do a live uvx kicad-mcp + KiCad 9 smoke on Linux and Windows. The project is feature-complete against PLAN §8 and meets the §11 v1.0 definition of done.
  • Machine note: ~/Library/Preferences/kicad/9.0/kicad_common.json had api.enable_server flipped to true for the live smoke (backup: kicad_common.json.kicad-mcp.bak). Leave enabled for IPC work.
  • Smoke test: KICAD_MCP_SEARCH_PATHS=$(pwd)/tests/fixtures ./.venv/bin/python -m kicad_mcp then call get_server_status; or run ./.venv/bin/python -m pytest -q.
  • Keep this section current. Update it at the end of every session with the phase reached and what is left.

Read the full file on GitHub · 84 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 84 lines · 4,197 tokens per session scan A e776aba0ea97

Subscribe to this mod's changes

kicad-mcp CLAUDE.md is an instructions file published in the GitHub repository antonmadto/kicad-mcp (1 stars, last pushed 2mo ago), licensed MIT. It adds 4,197 tokens to every session, about $0.0168 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 9,715 tokens

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,461 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).

microsoft/vscode · 5,262 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,680 tokens

vscode copilot-instructions.md

Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).

microsoft/vscode · 2,750 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 4,261 tokens