xiaohongshu
xiaohongshu
manufacturer-agent
Web-augmented agent for creating manufacturer skills and comprehensive tests. Use when adding or improving support for a manufacturer handler.
Full skill instructions
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)xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience