.claude/skills/similarity-opamp/SKILL.md
Use when working with op-amp similarity calculations - comparing op-amp MPNs, understanding single/dual/quad configurations, equivalent families like LM358/MC1458, or op-amp-specific similarity logic.
npx skillsauth add Cantara/lib-electronic-components similarity-opampInstall 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.
Guidance for working with OpAmpSimilarityCalculator in the lib-electronic-components library.
For metadata-driven similarity architecture, see /similarity-metadata:
The OpAmpSimilarityCalculator compares operational amplifiers based on:
ComponentType.OPAMP
ComponentType.OPAMP_TI
ComponentType.OPAMP_ANALOG_DEVICES
ComponentType.OPAMP_ST
// Any type starting with "OPAMP_"
HIGH_SIMILARITY = 0.9; // Equivalent parts
MEDIUM_SIMILARITY = 0.7; // Same family, compatible
LOW_SIMILARITY = 0.3; // Different family
| Family | Members | |--------|---------| | LM358 family | LM358, LM358A, LM358B, MC1458, RC1458 | | TL072 family | TL072, TL072A, TL072B, TL072C | | NE5532 family | NE5532, NE5532A, SA5532, SE5532 |
| Family | Members | |--------|---------| | LM324 family | LM324, LM324A, LM324N, MC3403, RC3403 | | TL074 family | TL074, TL074A, TL074B, TL074C |
| Family | Members | |--------|---------| | LM741 family | LM741, UA741, MC741, RC741 |
The calculator considers channel count when comparing:
| Comparison | Result | |------------|--------| | LM358 (dual) vs MC1458 (dual) | 0.9 (equivalent) | | LM358 (dual) vs LM324 (quad) | 0.7 (same family, different count) | | LM358 (dual) vs LM741 (single) | 0.7 (same technology, different count) |
Common suffixes are normalized:
N, P - DIP packagesD, DR - SOIC packagesPW, PWR - TSSOP packagesA, B - Grade variantscalculator.calculateSimilarity("LM358N", "LM358D", registry);
// Returns 0.9 (same op-amp, different package)
// Equivalent dual op-amps
calculator.calculateSimilarity("LM358", "MC1458", registry);
// Returns 0.9
// Same family, different grades
calculator.calculateSimilarity("LM324", "LM324A", registry);
// Returns 0.9
// Dual vs quad (different channel count)
calculator.calculateSimilarity("TL072", "TL074", registry);
// Returns 0.7
// Non-op-amp parts
calculator.calculateSimilarity("IRF530", "2N2222", registry);
// Returns 0.0
The calculator may also consider:
Status: ✅ Converted (PR #116)
The OpAmpSimilarityCalculator now uses a metadata-driven approach with spec-based comparison.
| Spec | Importance | Tolerance Rule | Description | |------|-----------|----------------|-------------| | configuration | CRITICAL | exactMatch | Single, dual, quad channel count | | family | HIGH | exactMatch | LM358, TL072, NE5532, etc. | | package | MEDIUM | exactMatch | DIP, SOIC, TSSOP, etc. |
@Override
public double calculateSimilarity(String mpn1, String mpn2, PatternRegistry registry) {
// Try metadata-driven approach first
Optional<ComponentTypeMetadata> metadataOpt = metadataRegistry.getMetadata(ComponentType.OPAMP);
if (metadataOpt.isPresent()) {
return calculateMetadataDrivenSimilarity(mpn1, mpn2, metadataOpt.get());
}
// Fallback to legacy family-based approach
return calculateFamilyBasedSimilarity(mpn1, mpn2);
}
Key Features:
totalScore / maxPossibleScore formula for precise comparison// Extract configuration from MPN
private String extractConfiguration(String mpn) {
if (matchesDualOpAmp(mpn)) return "dual";
if (matchesQuadOpAmp(mpn)) return "quad";
if (matchesSingleOpAmp(mpn)) return "single";
return "";
}
// Extract family from MPN
private String extractFamily(String mpn) {
// Returns: LM358, LM324, TL072, TL074, NE5532, etc.
}
// Extract package from MPN
private String extractPackageCode(String mpn) {
// Returns: N, D, DR, PW, P, etc.
}
Before (Legacy): Hardcoded equivalent family checks After (Metadata): Configurable specs with weighted importance
| Comparison | Legacy Result | Metadata Result | Notes | |-----------|--------------|-----------------|-------| | LM358 vs MC1458 | 0.9 | 1.0 | Exact configuration + family match | | LM358N vs LM358D | 0.9 | 0.958 | Same op-amp, different package | | LM358 vs LM324 | 0.7 | LOW_SIMILARITY | Short-circuit on configuration mismatch | | TL072 vs TL074 | 0.7 | LOW_SIMILARITY | Different channel count |
Why more accurate: Metadata approach clearly separates configuration (CRITICAL) from package (MEDIUM), providing more precise scoring.
LM prefix: National Semiconductor (now TI)MC prefix: Motorola (now ON Semi)TL prefix: TI JFET-inputNE/SA/SE prefix: Signetics (now TI)UA/RC prefix: Various second sourcesdata-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.