Skip to content

andrewle8/claude-code-partdb-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Part-DB Inventory Skill for Claude Code

A Claude Code slash command for managing electronic parts inventory through the Part-DB API. Add parts, attach datasheets, update quantities from your terminal.

What This Is

A .md file you drop into your project's .claude/commands/ directory. Once installed, typing /partdb-update in Claude Code gives it full context on how to interact with your Part-DB instance via its JSON-LD API.

It encodes API knowledge that isn't obvious from Part-DB's docs:

  • The _type discriminator required for attachment uploads (undocumented, causes 400 errors without it)
  • Two-step part creation (Part-DB rejects nested objects, so you create the part first, then the lot)
  • Datasheet sourcing table (which CDN mirrors work, since many manufacturer sites block downloads)
  • Common error patterns and fixes

Installation

# Copy the skill into your project
mkdir -p .claude/commands
cp partdb-update.md .claude/commands/

Then open the file and replace the placeholder values:

Placeholder Replace with
YOUR_PARTDB_HOST Your Part-DB server IP/hostname (e.g. 192.168.1.100)
YOUR_PARTDB_PORT Your Part-DB port (default: 8080)
YOUR_API_TOKEN Your Part-DB API token (or a reference to where you store it)

Usage

In Claude Code:

/partdb-update add 10x 100nF ceramic capacitors from Mouser order
/partdb-update attach datasheets to all parts missing them
/partdb-update update quantity of ESP32-S3 to 5
/partdb-update show current inventory

Getting a Part-DB API Token

  1. Log into your Part-DB instance
  2. Go to your user settings
  3. Under "API Tokens", create a new token with full permissions
  4. Copy the token into the skill file or store it in a secure location the skill references

Customization

The skill is just markdown. Edit it freely:

  • Add your categories. Replace the generic category lookup with your actual category IDs.
  • Add supplier-specific notes. If you always order from certain suppliers, add their conventions.
  • Adjust the datasheet sourcing table. Add or remove CDN mirrors based on what works for your parts.
  • Add your own error patterns. As you hit new API quirks, document them in the error table.

How It Works

Claude Code slash commands are markdown files in .claude/commands/. When invoked, the file content becomes part of Claude's context. No code execution, no plugins. Just structured knowledge that tells Claude how to call the API correctly.

This pattern works for any API-driven tool. The key sections:

  1. Access info. URL, auth, content types.
  2. Step-by-step workflows. The happy path for common operations.
  3. Gotchas and error tables. The stuff that wastes hours when you don't know it.
  4. Verification steps. How to confirm the operation worked.

Background

Built for managing an electronics inventory on an Unraid homelab. The original had hardcoded IPs and paths. This version replaces those with placeholders but keeps all the API knowledge intact.

License

MIT

About

Claude Code slash command for managing Part-DB electronics inventory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors