kicad-sch-api: Command for Claude Code

.claude/commands/user/troubleshoot-library.md

troubleshoot-library is a command for Claude Code from circuit-synth/kicad-sch-api. It costs 15 tokens per session (1,034 once invoked), scanned A, original, MIT.

A troubleshooting command for finding KiCad symbol libraries, which are files containing the standard electronic components used in schematics. It helps locate those files and configure the environment variable the library needs.

In plain words
What is it for?
Use it when kicad-sch-api cannot locate KiCad symbols, when a component is missing, or when setting up KiCad library paths on macOS, Linux, or Windows.
Why use it?
It addresses errors such as missing libraries or components that cannot be found when creating a schematic.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is circuit-synth/kicad-sch-api's own configuration. It tells Claude Code how to work on kicad-sch-api 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-sch-api configures →

Reuse

Borrowing it

Nothing to install: this file belongs to circuit-synth/kicad-sch-api. 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/circuit-synth/kicad-sch-api/main/.claude/commands/user/troubleshoot-library.md
Clone the repo
git clone --depth 1 https://github.com/circuit-synth/kicad-sch-api

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 troubleshoot-library

README.md
[![agentmods](https://agentmods.dev/badge/commands/circuit-synth/kicad-sch-api/troubleshoot-library/github.svg)](https://agentmods.dev/commands/circuit-synth/kicad-sch-api/troubleshoot-library)
Your own site
<a href="https://agentmods.dev/commands/circuit-synth/kicad-sch-api/troubleshoot-library"><img src="https://agentmods.dev/badge/commands/circuit-synth/kicad-sch-api/troubleshoot-library/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 troubleshoot-library

Your own site · 80×15
<a href="https://agentmods.dev/commands/circuit-synth/kicad-sch-api/troubleshoot-library"><img src="https://agentmods.dev/badge/commands/circuit-synth/kicad-sch-api/troubleshoot-library.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,034 The whole file, excluding the scripts and references it only reads on demand.
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.00015 $0.01034
Opus 5 $0.00008 $0.00517
Sonnet 5 $0.00003 $0.00207
Haiku 4.5 $0.00002 $0.00103

Measured 9d ago against content hash f0af965a0968, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

troubleshoot-library 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 9d 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/commands/user/troubleshoot-library.md · 173 lines

How it starts

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

Troubleshoot KiCAD Symbol Library Issues

Common Symptom

User reports errors like:

  • "Library not found"
  • "Symbol X:Y not found"
  • "Cannot load component from library"
  • Components fail to create with library errors

Root Cause

The kicad-sch-api library cannot find KiCAD symbol libraries (.kicad_sym files).

Solution: Configure Library Paths

Step 1: Find Your KiCAD Installation

✨ NEW: Automatic Library Finder

The easiest way to find your KiCAD libraries:

ksa-find-libraries

This command automatically searches your system and provides setup instructions.

Manual Search (if needed):

macOS:

ls /Applications/KiCad*.app/Contents/SharedSupport/symbols/

Linux:

ls /usr/share/kicad/symbols/
ls ~/.local/share/kicad/*/symbols/

Windows:

dir "C:\Program Files\KiCad\*\share\kicad\symbols"

Step 2: Set Environment Variable

macOS/Linux:

# Generic (works for any version)
export KICAD_SYMBOL_DIR=/Applications/KiCad/KiCad.app/Contents/SharedSupport/symbols

# Version-specific (if you have KiCAD 8)
export KICAD8_SYMBOL_DIR=/Applications/KiCad806/KiCad.app/Contents/SharedSupport/symbols/

# Add to ~/.bashrc or ~/.zshrc to make permanent
echo 'export KICAD8_SYMBOL_DIR=/Applications/KiCad806/KiCad.app/Contents/SharedSupport/symbols/' >> ~/.zshrc

Windows PowerShell:

$env:KICAD8_SYMBOL_DIR="C:\Program Files\KiCad\8.0\share\kicad\symbols"

# Make permanent:
[System.Environment]::SetEnvironmentVariable('KICAD8_SYMBOL_DIR', 'C:\Program Files\KiCad\8.0\share\kicad\symbols', 'User')

Step 3: Verify Configuration

Create a test script:

#!/usr/bin/env python3
import kicad_sch_api as ksa

# Test library discovery
cache = ksa.SymbolLibraryCache(enable_persistence=False)
lib_count = cache.discover_libraries()

print(f"Discovered {lib_count} libraries")

# Test loading a symbol
symbol = cache.get_symbol("Device:R")
if symbol:
    print("✓ Successfully loaded Device:R")
else:
    print("✗ Failed to load symbol")

Read the full file on GitHub · 173 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. 9d ago First seen · 173 lines · 15 tokens per session scan A f0af965a0968

Subscribe to this mod's changes

troubleshoot-library is a command published in the GitHub repository circuit-synth/kicad-sch-api (52 stars, last pushed 9mo ago), licensed MIT. It adds 15 tokens to every session and 1,034 once invoked, about $0.0001 per session on Opus 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-30.