Claude-skill-registry component
Base skill for working with electronic components in this library. Use when adding new component types, manufacturer handlers, or working with MPN (Manufacturer Part Number) operations, BOM entries, or component classification.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/component" ~/.claude/skills/majiayu000-claude-skill-registry-component && rm -rf "$T"
manifest:
skills/data/component/SKILL.mdsource content
Electronic Component Skill
This skill provides guidance for working with electronic components in the lib-electronic-components library.
Core Concepts
Component Type Hierarchy
Components are classified using
ComponentType enum with two levels:
- Base types:
,RESISTOR
,CAPACITOR
,MOSFET
, etc.OPAMP - Manufacturer-specific types:
,MOSFET_INFINEON
, etc.CAPACITOR_CERAMIC_MURATA
Use
getBaseType() to map specific types to their base type.
Key Classes
| Class | Purpose |
|---|---|
| Enum of ~200 component types with passive/semiconductor flags |
| Enum of manufacturers with regex patterns |
| Interface for manufacturer-specific MPN parsing |
| Static utilities for MPN normalization, similarity, type detection |
| Component entry in a bill of materials |
Adding a New Manufacturer Handler
- Create handler in
:src/main/java/no/cantara/electronic/component/lib/manufacturers/
public class NewMfrHandler implements ManufacturerHandler { @Override public void initializePatterns(PatternRegistry registry) { registry.registerPattern(ComponentType.RESISTOR, Pattern.compile("^NMF[0-9]{4}.*", Pattern.CASE_INSENSITIVE)); } @Override public String extractPackageCode(String mpn) { /* ... */ } @Override public String extractSeries(String mpn) { /* ... */ } @Override public boolean isOfficialReplacement(String mpn1, String mpn2) { return false; } @Override public Set<ManufacturerComponentType> getManufacturerTypes() { return Set.of(); } @Override public Set<ComponentType> getSupportedTypes() { return Set.of(ComponentType.RESISTOR); } }
- Add entry to
enum:ComponentManufacturer
NEW_MFR("(?:NMF)[0-9]", "New Manufacturer", new NewMfrHandler()),
Adding a New Component Type
- Add to
enum with passive/semiconductor flags:ComponentType
NEW_TYPE(false, true), // (isPassive, isSemiconductor) NEW_TYPE_MANUFACTURER(false, true),
- Update
switch to map specific types to base:getBaseType()
case NEW_TYPE_INFINEON, NEW_TYPE_ST -> NEW_TYPE;
- Add patterns in relevant manufacturer handlers
MPN Operations
// Normalize MPN (removes special characters) String normalized = MPNUtils.normalize("LM358-N"); // "LM358N" // Strip package suffix to get base part number String base = MPNUtils.stripPackageSuffix("MAX3483EESA+"); // "MAX3483EESA" String base2 = MPNUtils.stripPackageSuffix("LTC2053HMS8#PBF"); // "LTC2053HMS8" // Generate search variations (for datasheet/component searches) List<String> vars = MPNUtils.getSearchVariations("TJA1050T/CM,118"); // ["TJA1050T/CM,118", "TJA1050T"] // Check component equivalence (ignoring package suffixes) boolean equiv = MPNUtils.isEquivalentMPN("LTC2053HMS8#PBF", "LTC2053HMS8#TR"); // true // Extract package suffix Optional<String> suffix = MPNUtils.getPackageSuffix("MAX3483EESA+"); // Optional.of("+") // Detect manufacturer ComponentManufacturer mfr = ComponentManufacturer.fromMPN("STM32F103C8T6"); // Detect component type ComponentType type = ComponentType.fromMPN("IRF540N"); // MOSFET // Calculate similarity double sim = MPNUtils.calculateSimilarity("LM358", "MC1458"); // 0.9
Package Suffix Support
MPNUtils now supports manufacturer-specific package suffixes:
- Maxim/AD:
(lead-free) - e.g.,+MAX3483EESA+ - Linear Tech:
,#PBF
(RoHS, Tape & Reel) - e.g.,#TRLTC2053HMS8#PBF - NXP:
(ordering codes) - e.g.,/CM,118TJA1050T/CM,118 - Various:
(ordering codes) - e.g.,,315NC7WZ04,315
Use cases:
- Datasheet searches: Try both original and base MPN
- Component deduplication: Same base = same component
- BOM validation: Match supplier MPNs to design MPNs
- Inventory matching: Ignore packaging differences
Similarity Calculators
Each component type can have a dedicated similarity calculator in
componentsimilaritycalculators/:
- compares resistance values, tolerances, packagesResistorSimilarityCalculator
- compares capacitance, voltage, dielectricCapacitorSimilarityCalculator
- compares Vds, Rds(on), packageMosfetSimilarityCalculator- etc.
Implement
ComponentSimilarityCalculator interface and add to list in MPNUtils.
Testing
Run component-related tests:
mvn test -Dtest=MPNUtilsTest mvn test -Dtest=ComponentTypeDetectorTest mvn test -Dtest=MPNExtractionTest
Related Skills
Use specialized skills for specific component types:
- Resistor patterns and value extraction/resistor
- Capacitor patterns and specifications/capacitor
- Diodes, transistors, MOSFETs/semiconductor
- Microcontrollers, op-amps, voltage regulators/ic
- Connector manufacturer patterns/connector
- Flash, EEPROM, RAM components/memory
See Also
Advanced Skills
- Handler patterns, anti-patterns, and testing strategies/handler-pattern-design
- MPN suffix handling and normalization patterns/mpn-normalization
- Type hierarchy, specificity levels, getBaseType() mapping/component-type-detection-hierarchy
- Spec extraction patterns and naming conventions/component-spec-extraction
- Manufacturer regex patterns and detection ordering/manufacturer-detection-from-mpn
Documentation
- HISTORY.md - Handler bug patterns and fixes (PR #89, handler cleanup PRs #73-88)
- .docs/history/HANDLER_IMPLEMENTATION_PATTERNS.md - Detailed handler development patterns
- .docs/history/BUG_FIX_ANALYSIS.md - Critical bugs and prevention strategies
Recording Learnings
Important: When you discover quirks, edge cases, or important patterns while working on components:
- General/cross-cutting learnings → Add to
under "Learnings & Quirks"CLAUDE.md - Component-specific learnings → Add to the relevant skill file below
Examples of what to record:
- MPN patterns that don't follow expected conventions
- Manufacturer-specific quirks in part numbering
- Edge cases in similarity calculation
- Test failures that revealed unexpected behavior
- Regex patterns that needed adjustment
Learnings & Quirks
Handler Patterns
- Use
notregistry.addPattern()
- the latter requires a compiled Pattern objectregistry.registerPattern() - Handler order in
enum affects detection priority for ambiguous MPNsComponentManufacturer
MPN Edge Cases
- Some MPNs contain hyphens that are significant (e.g., Molex
) vs decorative (e.g.,43045-0212
)LM358-N - Yageo resistors:
- theRC0603FR-0710KL
is TCR code, not a separator-07