C Cpp Dev logo

C Cpp Dev

Community
AmethystLuna
c-cpp-dev

Use when writing, reviewing, or refactoring C/C++ code, especially on 32-bit ARM embedded targets. NOT for formatting-only changes, simple file reads, non-embedded C/C++ (desktop/server), or C#/Java despite the 'C' in the name.

Overview

PublisherAmethystLuna
Repositoryembedded-workbench
Skill namec-cpp-dev
Stars
32
Forks
3
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by AmethystLuna on GitHub. Read the source before you install it.

Installation

Install the C Cpp Dev AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AmethystLuna/embedded-workbench/tree/master/skills/c-cpp-dev
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AmethystLuna/embedded-workbench.git /tmp/embedded-workbench
mkdir -p .claude/skills
cp -r /tmp/embedded-workbench/skills/c-cpp-dev .claude/skills/c-cpp-dev
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable C Cpp Dev in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads C Cpp Dev on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so C Cpp Dev is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

C/C++ Development

Language baseline is project-specific: check the project's CLAUDE.md, build system (-std= flags), or compiler configuration. All rules assume 32-bit ARM target unless otherwise noted.

Code Generation

  • Respect the project's configured language standard. Don't assume a default.
  • When a header is shared between C and C++ translation units, never define variables in the header — not even with static. Use extern in the header and exactly one definition in a single .c file.
  • Allow goto when it simplifies cleanup or reduces complexity, but use it as a maintenance tool, not a first choice.
  • Place Doxygen comments in header files. Keep implementation files focused on behavior.
  • Avoid inline functions in header files. Keep function definitions in source files so the interface stays small.
  • In C, lightweight macros or helper wrappers are acceptable if simple, local, and clearly named.

Memory Layout

  • Watch local variable bursts inside functions. Large automatic arrays, structs, or many temporaries are stack budget items.
  • Design structures with both semantics and byte alignment in mind. For protocol parsing, byte streams, and wire formats, make packing and endianness explicit.
  • Use pragma or packing attributes only when they match a wire-format requirement and are documented clearly.
  • Use double precision and 64-bit integers with caution on 32-bit targets. Operations on 64-bit objects create performance, compatibility, and atomicity problems unless the wider width is clearly required.
  • When a 64-bit value crosses a task, interrupt, or module boundary, make its access pattern explicit: copied, split, guarded, or protected from tearing.

Heap and Pointer Ownership

  • Treat heap objects and pointer-owned state as lifetime-sensitive resources.
  • Make ownership, release point, and invalidation rules explicit.
  • Avoid retaining borrowed pointers longer than the lifetime that guarantees validity.
  • For heap-backed or pointer-rich code, document invalidation conditions so future changes don't accidentally reuse stale objects.

Embedded C Specifics

Hardware Register Access

Memory-mapped peripheral registers must be volatile to prevent the compiler from optimizing away repeated reads or writes. Use a volatile struct pointer (the CMSIS/HAL pattern) rather than bare casts.

c
// CORRECT: volatile pointer to peripheral struct
typedef struct {
    volatile uint32_t SR;   // Status  @ offset 0x00
    volatile uint32_t DR;   // Data    @ offset 0x04
    volatile uint32_t BRR;  // Baud    @ offset 0x08
    volatile uint32_t CR1;  // Control @ offset 0x0C
} UART_Regs;
#define UART2 ((UART_Regs *)0x40004400)

// BAD: missing volatile — compiler may optimize away repeated reads
#define UART_SR (*(uint32_t *)0x40001000)
while (UART_SR & TX_BUSY);  // May become infinite loop under optimization

Linker Section Placement

Use __attribute__((section(...))) to place data and code in specific memory regions.

c
// .noinit: value preserved across watchdog/system reset (not power-on reset)
uint32_t reset_reason __attribute__((section(".noinit")));

// .ramfunc: function kept in RAM for execution during flash programming
__attribute__((section(".ramfunc")))
void flash_program_word(uint32_t addr, uint32_t data) { /* ... */ }

// DMA-accessible buffer: must not be placed in CCM (tightly-coupled memory)
uint8_t dma_buffer[1024] __attribute__((section(".dma_ram")));

ISR-Safe vs Non-ISR-Safe Path Separation

Keep the ISR path minimal and use separate wrapper functions for task-context work. Never call blocking APIs from an ISR.

c
// ISR path: minimal, no blocking, use ISR-safe RTOS primitives
static void uart_rx_isr(void) {
    BaseType_t xHigherPriorityWoken = pdFALSE;
    xSemaphoreGiveFromISR(xUartSem, &xHigherPriorityWoken);
    portYIELD_FROM_ISR(xHigherPriorityWoken);
}

// Task path: can block, log, allocate, parse
void uart_rx_process_task(void) {
    if (xSemaphoreTake(xUartSem, portMAX_DELAY) == pdTRUE) {
        parse_and_dispatch(uart_rx_buf);
    }
}

Cortex-M Fault Handler (naked)

The HardFault handler must be __attribute__((naked)) to prevent the compiler's prologue from corrupting the stack pointer before the exception frame can be captured.

c
// naked: no prologue — SP is the exact exception frame. Required for fault handlers.
__attribute__((naked)) void HardFault_Handler(void) {
    __asm volatile(
        "tst lr, #4\n"          // Check EXC_RETURN bit 2: MSP vs PSP
        "ite eq\n"
        "mrseq r0, msp\n"       // Thread used MSP → read from MSP
        "mrsne r0, psp\n"       // Thread used PSP (RTOS) → read from PSP
        "b HardFault_HandlerC\n"
    );
}

Refactoring

  • Keep the intent of the original code clear while changing structure. A refactor should improve cohesion, readability, or maintainability without quietly changing behavior.
  • Skip smell-only changes that don't materially improve correctness, risk, maintainability, or clarity.
  • Prefer small, focused extractions over broad rewrites. Split one responsibility at a time.
  • Move a helper into shared code only when reuse is real and the dependency surface stays simple.
  • If a block is short but semantically clear and reused in multiple places, extract it into an interface named by meaning, not implementation detail.
  • If a C module has become difficult to keep readable without fighting the language, consider C++ refactoring — but ask the user before switching languages.
  • When reshaping APIs or control flow, keep the normal, failure, and recovery paths intact. Re-validate all three after the change.
  • If a refactor touches ownership, lifetime, or allocation, consult memory-layout guidance.

Frequently asked questions

What does the C Cpp Dev AI skill do?

Use when writing, reviewing, or refactoring C/C++ code, especially on 32-bit ARM embedded targets. NOT for formatting-only changes, simple file reads, non-embedded C/C++ (desktop/server), or C#/Java despite the 'C' in the name.

Why use C Cpp Dev on TypingMind?

Because you install it once and use it with any model. C Cpp Dev is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install C Cpp Dev in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AmethystLuna/embedded-workbench/tree/master/skills/c-cpp-dev. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use C Cpp Dev?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with C Cpp Dev?

As many as you like. As long as a model supports skills, you can use C Cpp Dev with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the C Cpp Dev AI skill free?

Yes. It is published on GitHub by AmethystLuna under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇