.claude/skills/similarity-led/SKILL.md
Use when working with LED similarity calculations - comparing LED MPNs, understanding color bins, brightness bins, families, or LED-specific similarity logic.
npx skillsauth add Cantara/lib-electronic-components similarity-ledInstall 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 LEDSimilarityCalculator in the lib-electronic-components library.
For metadata-driven similarity architecture, see /similarity-metadata:
The LEDSimilarityCalculator compares LEDs based on:
ComponentType.LED
// Any type starting with "LED_"
// Uses getBaseType() == ComponentType.LED
Returns false for null type.
HIGH_SIMILARITY = 0.9; // Same LED, same color temp
MEDIUM_SIMILARITY = 0.7; // Different families but valid LEDs
LOW_SIMILARITY = 0.3; // Different color temperatures
| Group | Members | |-------|---------| | TLHR5400 (Red) | TLHR5400, TLHR5401, TLHR5402, TLHR5403 | | TLHG5800 (Green) | TLHG5800, TLHG5801, TLHG5802, TLHG5803 | | TLHB5800 (Blue) | TLHB5800, TLHB5801, TLHB5802, TLHB5803 |
| Group | Members | |-------|---------| | LG R971 (Red) | LG R971, LG R971-KN, LG R971-PK | | LG B971 (Blue) | LG B971, LG B971-KN, LG B971-PK | | LG G971 (Green) | LG G971, LG G971-KN, LG G971-PK |
| Group | Members | |-------|---------| | LM301B | LM301B, LM301B-K, LM301B-V2 | | LM281B | LM281B, LM281B-K, LM281B-V2 |
| Group | Members | |-------|---------| | NCSW (White) | NCSW170, NCSW170T, NCSW170AT | | NCSR (Red) | NCSR170, NCSR170T, NCSR170AT |
LEDs use bin codes for brightness and color sorting:
K, L, M, N - Brightness gradesFK* - One color temperatureFC* - Different color temperature// Same color temperature = HIGH
calculator.calculateSimilarity("XPERED-L1-FKA", "XPERED-L1-FKB", registry);
// Returns 0.9
// Different color temperatures = LOW
calculator.calculateSimilarity("XPERED-L1-FKA", "XPERED-L1-FCA", registry);
// Returns 0.3
| Prefix | Manufacturer | Family | |--------|--------------|--------| | TLHR | TI | Red LED | | TLHG | TI | Green LED | | TLHB | TI | Blue LED | | TLW | TI | White LED | | LG R/B/G | LG | Color LEDs | | LW, LR, LS | Osram | Standard LEDs | | XP, XB, XQ | Cree | High-power LEDs | | L130, L135 | Lumileds | LUXEON series | | LM | Samsung | LM series | | NCS | Nichia | Standard series |
| Package Type | Compatible Packages | |--------------|---------------------| | SMD | SMD, PLCC, 3528, 5050, 2835, 3030, 5630, 0603, 0805, 1206 | | Through-Hole | TH, DIP, 5MM, 3MM, 8MM, 10MM, T-1, T-1¾ | | High-Power | STAR, MCE, XPE, XPG, XML, LUXEON, REBEL |
// Same LED
calculator.calculateSimilarity("TLHR5400", "TLHR5400", registry);
// Returns 0.9
// Same family, different bin
calculator.calculateSimilarity("TLHR5400", "TLHR5401", registry);
// Returns 0.9
// LG variants with suffix
calculator.calculateSimilarity("LG R971", "LG R971-KN", registry);
// Returns 0.9
// Different color temps
calculator.calculateSimilarity("XPERED-L1-FKA", "XPERED-L1-FCA", registry);
// Returns 0.3
Status: ✅ Converted (PR #118)
The LEDSimilarityCalculator now uses a metadata-driven approach with spec-based comparison.
| Spec | Importance | Tolerance Rule | Description | |------|-----------|----------------|-------------| | color | CRITICAL | exactMatch | Red, Green, Blue, White, etc. | | family | HIGH | exactMatch | TLHR, LG R, LM301, XP-E, etc. | | brightness | HIGH | exactMatch | Brightness bin code | | package | LOW | exactMatch | 0603, 0805, 5mm, SMD, etc. |
// Short-circuit check for CRITICAL incompatibility
if (!color1.isEmpty() && !color2.isEmpty() && !color1.equals(color2)) {
return LOW_SIMILARITY;
}
// Weighted spec scoring
// color: CRITICAL (1.0 weight)
// family: HIGH (0.7 weight)
// brightness: HIGH (0.7 weight)
// package: LOW (0.2 weight)
// Family boost for known equivalent groups
if (areSameFamily(mpn1, mpn2)) {
similarity = Math.max(similarity, HIGH_SIMILARITY);
}
| Comparison | Legacy Result | Metadata Result | Notes | |-----------|--------------|-----------------|-------| | TLHR5400 vs TLHR5401 | 0.9 | 0.96 | Same family, different bins | | LG R971 vs LG R971-KN | 0.9 | 1.0 | Exact family + color match | | TLHR5400 vs LCW E6SF | 0.7 | 0.66 | Different families, same color | | XPERED-L1-FKA vs XPERED-L1-FCA | 0.3 | 0.3 | Short-circuit on color temp |
Why more accurate: Metadata approach prioritizes color matching (CRITICAL) and separates family from brightness considerations.
FK/FC in bin codes to indicate color tempLG R971-KN where -KN is the suffix variant-RL, -RT = Tape and reel packaging-TUBE = Tube packagingdata-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.