electronic-mcp-server: Skill for Claude Code

.github/skills/mermaid-diagram-generator/SKILL.md

mermaid-diagram-generator is a skill for Claude Code, Codex from wedsamuel1230/electronic-mcp-server. It costs 0 tokens per session (3,414 once invoked), scanned A, original, MIT.

A tool that creates Mermaid diagrams from Arduino code. Mermaid is a text-based format for diagrams such as flowcharts, state machines, and timing diagrams.

In plain words
What is it for?
Use it to document Arduino state machines, I2C, SPI, or UART timing, task relationships, control flows, and sequence diagrams.
Why use it?
It makes embedded-program behavior and communication sequences easier to inspect and document than source code alone.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

This is wedsamuel1230/electronic-mcp-server's own configuration. It tells Claude Code and Codex how to work on electronic-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything electronic-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to wedsamuel1230/electronic-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/wedsamuel1230/electronic-mcp-server/main/.github/skills/mermaid-diagram-generator/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/wedsamuel1230/electronic-mcp-server

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mermaid-diagram-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator/github.svg)](https://agentmods.dev/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator)
Your own site
<a href="https://agentmods.dev/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator"><img src="https://agentmods.dev/badge/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for mermaid-diagram-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator"><img src="https://agentmods.dev/badge/skills/wedsamuel1230/electronic-mcp-server/mermaid-diagram-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,414 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.03414
Opus 5 $0.00000 $0.01707
Sonnet 5 $0.00000 $0.00683
Haiku 4.5 $0.00000 $0.00341

Measured 12d ago against content hash 4415e4d8fb00, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

mermaid-diagram-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/generate_diagram.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/mermaid-diagram-generator/SKILL.md · 510 lines

How it starts

The opening of the file, as written. The whole thing — 510 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mermaid Diagram Generator

Generates Mermaid diagrams from Arduino code to visualize state machines, timing, architecture, and workflows.

Resources

  • scripts/generate_diagram.py - Python script with PEP 723 inline dependencies
  • references/diagram-templates.md - Mermaid templates for common patterns
  • assets/examples/ - Example diagrams for reference

Quick Start

# Generate state machine diagram from Arduino code
uv run mermaid-diagram-generator/scripts/generate_diagram.py \
    --input src/main.ino \
    --type state-machine \
    --output docs/state-machine.mmd

# Generate timing diagram for I2C communication
uv run mermaid-diagram-generator/scripts/generate_diagram.py \
    --type timing \
    --signals "SDA,SCL,START,DATA,STOP" \
    --output docs/i2c-timing.mmd

# Interactive mode
uv run mermaid-diagram-generator/scripts/generate_diagram.py --interactive

When to Use

Use this skill when:

  • Visualizing state machines - FSM from switch/case or enum states
  • Documenting timing - I2C, SPI, UART protocol sequences
  • Architecture diagrams - Show task relationships in FreeRTOS
  • Flowcharts - Visualize control flow for complex logic
  • Sequence diagrams - Inter-task communication patterns

Don't use when:

  • ❌ Simple code (3-5 lines) doesn't need visualization
  • ❌ No state/timing complexity to illustrate

Core Principles

  1. Code Analysis - Parse Arduino code to extract states, transitions, timing
  2. Template Selection - Choose appropriate Mermaid diagram type
  3. Auto-Generation - Produce valid Mermaid syntax from code patterns
  4. Validation - Check diagram syntax before output
  5. Integration - Embed diagrams in README.md or documentation

Implementation

Pattern 1: State Machine Extraction

#!/usr/bin/env python3
# /// script
# requires-python = ">=3.8"
# dependencies = ["re"]
# ///

"""Extract state machine from Arduino code."""

import re

def extract_states(code):
    """Find enum states or #define constants."""
    states = []
    
    # Pattern 1: enum StateType { STATE_A, STATE_B, ... }
    enum_pattern = r'enum\s+\w+\s*\{([^}]+)\}'
    enum_match = re.search(enum_pattern, code)
    if enum_match:
        states_str = enum_match.group(1)
        states = [s.strip().split('=')[0].strip() 
                 for s in states_str.split(',') if s.strip()]
    
    # Pattern 2: #define STATE_A 0
    define_pattern = r'#define\s+(STATE_\w+)\s+\d+'
    states += re.findall(define_pattern, code)
    
    return list(set(states))

def extract_transitions(code, states):
    """Find state transitions in code."""
    transitions = []
    
    for i, state in enumerate(states):
        # Look for assignments: currentState = NEXT_STATE
        pattern = rf'{state}.*?=\s*(\w+)'
        matches = re.findall(pattern, code)
        
        for next_state in matches:
            if next_state in states and next_state != state:
                transitions.append((state, next_state))
    
    return transitions

# Example usage
arduino_code = '''
enum State {
    STATE_IDLE,
    STATE_READING,
    STATE_PROCESSING,
    STATE_DONE
};

State currentState = STATE_IDLE;

void loop() {
    switch(currentState) {
        case STATE_IDLE:
            if (buttonPressed()) {
                currentState = STATE_READING;
            }
            break;
        case STATE_READING:
            readSensor();
            currentState = STATE_PROCESSING;
            break;
        case STATE_PROCESSING:
            processData();
            currentState = STATE_DONE;
            break;
        case STATE_DONE:
            currentState = STATE_IDLE;
            break;
    }
}
'''

states = extract_states(arduino_code)
transitions = extract_transitions(arduino_code, states)

print("States:", states)
print("Transitions:", transitions)

Read the full file on GitHub · 510 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 510 lines · 0 tokens per session scan A 4415e4d8fb00

Subscribe to this mod's changes

mermaid-diagram-generator is a skill published in the GitHub repository wedsamuel1230/electronic-mcp-server (1 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,414 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

readme-generator

Auto-generates professional README.md files for Arduino/ESP32/RP2040 projects following open-source best practices. Use when user wants to document their project for GitHub, needs help writing a README, or says "make my project shareable". Follows awesome-readme standards with sections for Overview, Hardware…

wedsamuel1230/arduino-skills · 80 tokens

battery-selector

Helps choose the right battery type and charging solution for Arduino/ESP32/RP2040 projects. Use when user asks about battery options, charging circuits, power source selection, or says "what battery should I use". Covers chemistry selection, safety, voltage regulation, and charging circuits.

wedsamuel1230/arduino-skills · 61 tokens

bom-generator

Generates Bill of Materials (BOM) from project descriptions for Arduino/ESP32/RP2040 projects. Use when user needs component lists, parts shopping lists, cost estimates, or asks "what parts do I need". Outputs formatted BOMs with part numbers, quantities, suppliers (DigiKey, Mouser, Amazon, AliExpress), and…

wedsamuel1230/arduino-skills · 91 tokens

code-review-facilitator

Automated code review for Arduino/ESP32/RP2040 projects focusing on best practices, memory safety, and common pitfalls. Use when user wants code feedback, says "review my code", needs help improving code quality, or before finalizing a project. Generates actionable checklists and specific improvement suggestions.

wedsamuel1230/arduino-skills · 68 tokens

datasheet-interpreter

Extracts key specifications from component datasheet PDFs for maker projects. Use when user shares a datasheet PDF URL, asks about component specs, needs pin assignments, I2C addresses, timing requirements, or register maps. Downloads and parses PDF to extract essentials. Complements datasheet-parser for quick lookups.

wedsamuel1230/arduino-skills · 67 tokens

error-message-explainer

Explain Arduino and embedded compiler, upload, boot, power, and runtime errors in plain English. Use when a user shares an error or failure from Arduino IDE, Arduino CLI, PlatformIO, or a vendor-specific tool. Separate build, upload, hardware, and system evidence and give a board-specific recovery path without…

wedsamuel1230/arduino-skills · 80 tokens