.claude/skills/similarity-logic/SKILL.md
Use when working with logic IC similarity calculations - comparing 74xx series, CD4000 CMOS, technology families (LS, HC, HCT), function groups (NAND, NOR, flip-flops), or logic IC-specific similarity logic.
npx skillsauth add Cantara/lib-electronic-components similarity-logicInstall 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 LogicICSimilarityCalculator in the lib-electronic-components library.
For metadata-driven similarity architecture, see /similarity-metadata:
The LogicICSimilarityCalculator compares logic ICs based on:
ComponentType.LOGIC_IC
ComponentType.LOGIC_IC_NEXPERIA
ComponentType.LOGIC_IC_DIODES
ComponentType.IC // Generic IC type also supported
Returns false for null type.
HIGH_SIMILARITY = 0.9; // Same function, compatible technology
MEDIUM_SIMILARITY = 0.5; // Related parts
LOW_SIMILARITY = 0.3; // Different functions
| Family | Speed | Power | Compatible With | |--------|-------|-------|-----------------| | LS | Fast | Low | ALS, F, HC, HCT | | ALS | Faster | Lower | LS, F, HC, HCT | | F | Fast | Medium | LS, ALS, HC, HCT | | HC | Fast | Very Low | LS, ALS, F, HCT | | HCT | Fast | Very Low | LS, ALS, F, HC |
// Compatible technologies = HIGH
calculator.calculateSimilarity("74LS00", "74HC00", registry);
// Returns 0.9
calculator.calculateSimilarity("74LS04", "74ALS04", registry);
// Returns 0.9
| Function | Part Numbers | |----------|--------------| | NAND Gates | 00, 10, 20, 30, 40 | | NOR Gates | 02, 12, 22, 32, 42 | | Inverters | 04, 14, 24, 34, 44 | | AND Gates | 08, 18, 28, 38, 48 | | OR Gates | 32, 42 | | Flip-Flops | 73, 74, 75, 76, 77, 78 | | Multiplexers | 151, 153, 157, 158 | | Decoders | 138, 139, 154, 155 |
// Different functions = LOW
calculator.calculateSimilarity("74LS00", "74LS74", registry);
// Returns 0.3 (NAND vs Flip-Flop)
| Part | Function | |------|----------| | CD4001 | Quad 2-input NOR | | CD4011 | Quad 2-input NAND | | CD4013 | Dual D flip-flop | | CD4017 | Decade counter | | CD4040 | 12-bit binary counter | | CD4051 | 8-channel mux | | CD4066 | Quad bilateral switch |
| Suffix | Package | |--------|---------| | BE | PDIP (plastic) | | BM | SOIC | | UBE | Unbuffered PDIP | | N, P | DIP variants | | DG, PW, DR | SMD variants |
// Same CD4000 IC, different package = HIGH
calculator.calculateSimilarity("CD4001BE", "CD4001BM", registry);
// Returns 0.9
// Different CD4000 ICs = LOW
calculator.calculateSimilarity("CD4001BE", "CD4011BE", registry);
// Returns 0.3
74xx and CD4000 are generally not interchangeable:
// 74xx vs CD4000 with same function
calculator.calculateSimilarity("74HC00", "CD4011BE", registry);
// Returns LOW (different series, even if same function)
// Same 74xx, compatible technologies
calculator.calculateSimilarity("74LS00", "74HC00", registry);
// Returns 0.9
// Same CD4000 IC, different package
calculator.calculateSimilarity("CD4001BE", "CD4001BM", registry);
// Returns 0.9
// Same function group in 74xx
calculator.calculateSimilarity("74LS04", "74ALS04", registry);
// Returns 0.9
// Different functions
calculator.calculateSimilarity("74LS00", "74LS74", registry);
// Returns 0.3
74 LS 04 N
│ │ │ │
│ │ │ └── Package (N=DIP)
│ │ └───── Function (04=Inverter)
│ └──────── Technology (LS=Low-power Schottky)
└─────────── Series prefix
CD 4001 BE
│ │ │
│ │ └── Package (BE=Plastic DIP)
│ └─────── Function number
└────────── Series prefix
Status: ✅ Converted (PR #119)
The LogicICSimilarityCalculator now uses a metadata-driven approach with spec-based comparison.
| Spec | Importance | Tolerance Rule | Description | |------|-----------|----------------|-------------| | function | CRITICAL | exactMatch | NAND, NOR, NOT, AND, OR, flip-flop, etc. | | series | HIGH | exactMatch | 74xx vs CD4000 | | technology | MEDIUM | exactMatch | LS, HC, HCT, ALS, F, etc. | | package | LOW | exactMatch | N, D, P, PW, etc. |
// Short-circuit check for CRITICAL incompatibility
if (!function1.isEmpty() && !function2.isEmpty() && !areSameFunction(mpn1, mpn2)) {
return LOW_SIMILARITY;
}
// Short-circuit for series incompatibility (74xx vs CD4000)
if (!series1.isEmpty() && !series2.isEmpty() && !series1.equals(series2)) {
return 0.0;
}
// Extract function from both 74xx and CD4000 series
private String extractFunction(String mpn) {
if (mpn.matches("^CD4.*")) {
// CD4001 → "001", CD4011 → "011"
return cmosPatternMatcher.group(1);
}
// 74LS00 → "00", 74HC138 → "138"
return ttlPatternMatcher.group(3);
}
| Comparison | Legacy Result | Metadata Result | Notes | |-----------|--------------|-----------------|-------| | 74LS00 vs 74HC00 | 0.9 | 0.88 | Compatible technologies | | CD4001BE vs CD4001BM | 0.9 | 0.96 | Same IC, different package | | CD4001 vs CD4011 | 0.3 | 0.3 | Short-circuit on function | | 74LS00 vs CD4001 | undefined | 0.0 | Short-circuit on series |
Why more accurate: Metadata approach correctly handles both 74xx and CD4000 series, with series check preventing false matches.
data-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.