.claude/skills/manufacturer-agent/SKILL.md
Web-augmented agent for creating manufacturer skills and comprehensive tests. Use when adding or improving support for a manufacturer handler.
npx skillsauth add Cantara/lib-electronic-components manufacturer-agentInstall 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.
Automated agent for creating detailed manufacturer skills and comprehensive test coverage.
/manufacturer-agent <manufacturer-name>
Examples:
/manufacturer-agent ST - STMicroelectronics/manufacturer-agent NXP - NXP Semiconductors/manufacturer-agent Infineon - Infineon Technologies/manufacturer-agent Microchip - Microchip TechnologyExecute these phases in order:
Find the handler file:
Glob: src/main/java/**/manufacturers/*Handler.java
Read the handler and extract:
initializePatterns()getSupportedTypes()extractPackageCode()extractSeries()matches()Identify issues:
HashSet instead of Set.of()?matches() with multi-pattern types?Search for manufacturer documentation using these queries:
WebSearch: "{manufacturer} part number naming convention"
WebSearch: "{manufacturer} ordering information guide"
WebSearch: "{manufacturer} package marking code"
WebSearch: "{manufacturer} product selector guide filetype:pdf"
For each relevant result, fetch and analyze:
WebFetch: <url>
Prompt: "Extract the MPN structure, package codes, temperature grades, and family prefixes from this page"
Key information to gather:
Search for real part numbers to use in tests:
WebSearch: "{manufacturer} {product-type} datasheet"
Product types to search based on handler's supported types:
Collect 5-10 real MPNs for each supported ComponentType.
Create .claude/skills/manufacturers/{manufacturer}/SKILL.md following this template:
---
name: {manufacturer-lowercase}
description: {Manufacturer} MPN encoding patterns, suffix decoding, and handler guidance.
---
# {Manufacturer} Manufacturer Skill
## MPN Structure
{Diagram showing MPN breakdown}
### Example Decoding
{2-3 annotated examples}
---
## Package Codes
### Through-Hole Packages
| Code | Package | Notes |
|------|---------|-------|
### Surface Mount Packages
| Code | Package | Notes |
|------|---------|-------|
---
## Family Prefixes
| Prefix | Category | Examples |
|--------|----------|----------|
---
## Temperature Grades
| Suffix | Range | Application |
|--------|-------|-------------|
---
## Common Series Reference
{Tables of common product series}
---
## Handler Implementation Notes
### Package Code Extraction
{Code examples and gotchas}
### Series Extraction
{Code examples}
### Known Issues
{Any bugs or limitations found}
---
## Related Files
- Handler: `manufacturers/{Handler}.java`
- Component types: {list types}
- Test: `handlers/{Handler}Test.java`
---
## Learnings & Edge Cases
{Bullet points of discoveries}
<!-- Add new learnings above this line -->
Create src/test/java/no/cantara/electronic/component/lib/handlers/{Handler}Test.java:
CRITICAL: Test Design Principles
Test Categories:
| Category | Assertion Type | When to Use |
|----------|---------------|-------------|
| Stable behavior | assertTrue/assertFalse | Handler behavior is consistent |
| Flaky behavior | System.out.println only | Behavior varies by test order |
| Bug documentation | Comments + SKILL.md | Document in files, not tests |
Structure:
package no.cantara.electronic.component.lib.handlers;
import no.cantara.electronic.component.lib.ComponentType;
import no.cantara.electronic.component.lib.PatternRegistry;
import no.cantara.electronic.component.lib.manufacturers.{Handler};
import org.junit.jupiter.api.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;
import static org.junit.jupiter.api.Assertions.*;
class {Handler}Test {
private static {Handler} handler;
private static PatternRegistry registry;
@BeforeAll
static void setUp() {
// Direct instantiation - avoids MPNUtils.getManufacturerHandler bug
handler = new {Handler}();
registry = new PatternRegistry();
handler.initializePatterns(registry);
}
// === STABLE TESTS (use assertions) ===
@Nested
@DisplayName("{ProductType} Detection - Stable")
class {ProductType}StableTests {
@ParameterizedTest
@ValueSource(strings = {"{real-mpn-1}", "{real-mpn-2}"})
void shouldDetect{ProductType}(String mpn) {
// Only assert if behavior is ALWAYS consistent
assertTrue(handler.matches(mpn, ComponentType.{TYPE}, registry),
mpn + " should match {TYPE}");
}
}
// === DOCUMENTATION TESTS (no assertions) ===
@Nested
@DisplayName("Behavior Documentation")
class BehaviorDocumentation {
@ParameterizedTest
@ValueSource(strings = {"{potentially-flaky-mpn-1}", "{potentially-flaky-mpn-2}"})
void documentDetectionBehavior(String mpn) {
// Document actual behavior without assertions
boolean matches = handler.matches(mpn, ComponentType.IC, registry);
System.out.println(mpn + " matches IC = " + matches);
}
}
// === EXTRACTION TESTS (usually stable) ===
@Nested
@DisplayName("Package Code Extraction")
class PackageCodeTests {
@ParameterizedTest
@CsvSource({
"{mpn1}, {expected-package1}",
"{mpn2}, {expected-package2}"
})
void shouldExtractPackageCodes(String mpn, String expected) {
assertEquals(expected, handler.extractPackageCode(mpn));
}
}
// === EDGE CASES ===
@Nested
@DisplayName("Edge Cases")
class EdgeCaseTests {
@Test
void shouldHandleNull() {
assertFalse(handler.matches(null, ComponentType.IC, registry));
assertEquals("", handler.extractPackageCode(null));
}
@Test
void shouldBeCaseInsensitive() {
// Test lowercase handling
}
}
}
Run the new tests:
mvn test -Dtest={Handler}Test
If single-test fails with initialization error, run full suite:
mvn test
Analyze failures:
registry.matches() instead of defaultCreate summary report:
From previous work on TI, Atmel, and ST handlers:
Set.of()matches() to use registry.matches()toUpperCase() is calledPackageCodeRegistrypatterns.matches() for base types (MICROCONTROLLER, MOSFET, etc.)System.out.println debug code// PROBLEM: MPNUtils.getManufacturerHandler can return wrong handler
// due to alphabetical ordering (AtmelHandler < STHandler)
ManufacturerHandler h = MPNUtils.getManufacturerHandler("STM32F103C8T6");
// Returns AtmelHandler instead of STHandler!
// SOLUTION: Use direct instantiation for handler tests
handler = new STHandler();
registry = new PatternRegistry();
handler.initializePatterns(registry);
When a handler's matches() method falls through to patterns.matches(mpn, type), it can accidentally match patterns registered by OTHER handlers because the PatternRegistry is shared.
Example: AtmelHandler checking STM32F103C8T6 for MICROCONTROLLER type:
patterns.matches(mpn, MICROCONTROLLER)Fix: For base types like MICROCONTROLLER, MOSFET, VOLTAGE_REGULATOR, handlers should:
true only if their prefix check passesfalse if prefix check fails (don't fall through)patterns.matches() for manufacturer-specific typesDifferent component families encode package info differently:
| Component | Package Location | Example | |-----------|-----------------|---------| | STM32 MCU | Second-to-last char | STM32F103C8T6 → T=LQFP | | ST MOSFET | Prefix | STF5N52U → STF=TO-220FP | | L78xx Regulator | Grade + Suffix | L7805CV → CV=TO-220 | | Atmel MCU | After hyphen | ATMEGA328P-PU → PU=PDIP |
When fixing package extraction, existing tests may expect the OLD (wrong) behavior:
MPNExtractionTest expected "T6" for STM32F103C8T6Problem discovered: Handler matches() behavior can vary based on:
Symptoms:
assertTrue and assertFalse for same MPN both failSolution:
matches() calls that may varyExample - DO THIS:
// Document behavior without assertions
void documentDetectionBehavior(String mpn) {
boolean matches = handler.matches(mpn, ComponentType.IC, registry);
System.out.println(mpn + " matches IC = " + matches);
// BUG documented in SKILL.md: MAX485 pattern missing
}
Example - DON'T DO THIS:
// WRONG: Creates flaky tests
void bugMAX485NotDetected(String mpn) {
assertFalse(handler.matches(mpn, ComponentType.IC, registry),
"BUG: MAX485 should match but doesn't"); // May pass or fail randomly!
}
After running this agent, you should have:
.claude/skills/manufacturers/{manufacturer}/SKILL.mdsrc/test/java/.../handlers/{Handler}Test.javamvn test)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.