.claude/skills/component/SKILL.md
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.
npx skillsauth add Cantara/lib-electronic-components componentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides guidance for working with electronic components in the lib-electronic-components library.
Components are classified using ComponentType enum with two levels:
RESISTOR, CAPACITOR, MOSFET, OPAMP, etc.MOSFET_INFINEON, CAPACITOR_CERAMIC_MURATA, etc.Use getBaseType() to map specific types to their base type.
| Class | Purpose |
|-------|---------|
| ComponentType | Enum of ~200 component types with passive/semiconductor flags |
| ComponentManufacturer | Enum of manufacturers with regex patterns |
| ManufacturerHandler | Interface for manufacturer-specific MPN parsing |
| MPNUtils | Static utilities for MPN normalization, similarity, type detection |
| BOMEntry | Component entry in a bill of materials |
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);
}
}
ComponentManufacturer enum:NEW_MFR("(?:NMF)[0-9]", "New Manufacturer", new NewMfrHandler()),
ComponentType enum with passive/semiconductor flags:NEW_TYPE(false, true), // (isPassive, isSemiconductor)
NEW_TYPE_MANUFACTURER(false, true),
getBaseType() switch to map specific types to base:case NEW_TYPE_INFINEON, NEW_TYPE_ST -> NEW_TYPE;
// 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
MPNUtils now supports manufacturer-specific package suffixes:
+ (lead-free) - e.g., MAX3483EESA+#PBF, #TR (RoHS, Tape & Reel) - e.g., LTC2053HMS8#PBF/CM,118 (ordering codes) - e.g., TJA1050T/CM,118,315 (ordering codes) - e.g., NC7WZ04,315Use cases:
Each component type can have a dedicated similarity calculator in componentsimilaritycalculators/:
ResistorSimilarityCalculator - compares resistance values, tolerances, packagesCapacitorSimilarityCalculator - compares capacitance, voltage, dielectricMosfetSimilarityCalculator - compares Vds, Rds(on), packageImplement ComponentSimilarityCalculator interface and add to list in MPNUtils.
Run component-related tests:
mvn test -Dtest=MPNUtilsTest
mvn test -Dtest=ComponentTypeDetectorTest
mvn test -Dtest=MPNExtractionTest
Use specialized skills for specific component types:
/resistor - Resistor patterns and value extraction/capacitor - Capacitor patterns and specifications/semiconductor - Diodes, transistors, MOSFETs/ic - Microcontrollers, op-amps, voltage regulators/connector - Connector manufacturer patterns/memory - Flash, EEPROM, RAM components/handler-pattern-design - Handler patterns, anti-patterns, and testing strategies/mpn-normalization - MPN suffix handling and normalization patterns/component-type-detection-hierarchy - Type hierarchy, specificity levels, getBaseType() mapping/component-spec-extraction - Spec extraction patterns and naming conventions/manufacturer-detection-from-mpn - Manufacturer regex patterns and detection orderingImportant: When you discover quirks, edge cases, or important patterns while working on components:
CLAUDE.md under "Learnings & Quirks"Examples of what to record:
registry.addPattern() not registry.registerPattern() - the latter requires a compiled Pattern objectComponentManufacturer enum affects detection priority for ambiguous MPNs43045-0212) vs decorative (e.g., LM358-N)RC0603FR-0710KL - the -07 is TCR code, not a separatordata-ai
Cost-effective task delegation strategy using Haiku model for straightforward work. Use when planning how to approach simple, pattern-following tasks to minimize costs.
tools
Use when working with component similarity calculations - comparing MPNs, finding equivalent parts, implementing new similarity calculators, or understanding how component matching works.
testing
Use when working with transistor similarity calculations - comparing BJT MPNs, understanding NPN/PNP polarity matching, equivalent groups like 2N2222/PN2222, or transistor-specific similarity logic.
testing
Use when working with sensor similarity calculations - comparing temperature/accelerometer/humidity sensor MPNs, understanding sensor families, equivalent parts, or sensor-specific similarity logic.