agentleFS
easyzoomeasyzoom/aix-skills/skills/embedded-buffer-queue-libs/SKILL.md

embedded-buffer-queue-libs

Skill36 starsChanged 5 months agoMITView on GitHub

Use when integrating, porting, configuring, or debugging embedded ring buffers, circular buffers, FIFO queues, Ring-Buffer, or QueueForMcu libraries

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for embedded ring buffers and lightweight queues.

    line 10
  2. Distinctive:

    Use this skill when:

    line 14
  3. Distinctive:

    Do not use this skill for RTOS-native queues unless the issue is about wrapping a custom buffer around them.

    line 19
  4. Very specific:

    Do not leave overwrite/drop/block behavior implicit.

    line 37
  5. Distinctive:

    Use interrupt masking, atomics, mutexes, or single-producer/single-consumer rules as appropriate.

    line 43
  6. Distinctive:

    Test writes and reads across the end of the buffer.

    line 46
  7. Distinctive:

    Before claiming buffer/queue works:

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Embedded Buffer Queue Libs

Overview

Use this skill for embedded ring buffers and lightweight queues. The core decision is ownership and concurrency: single producer/consumer, ISR-to-task, task-to-task, DMA-to-task, or multi-producer use.

When To Use

Use this skill when:

  • The user wants to integrate or debug Ring-Buffer, QueueForMcu, circular buffers, FIFOs, UART RX buffers, log queues, or event queues.
  • The issue involves overflow, data loss, race conditions, wraparound, off-by-one capacity, ISR safety, or DMA buffer handoff.

Do not use this skill for RTOS-native queues unless the issue is about wrapping a custom buffer around them.

First Questions

Ask for:

  • Buffer/queue library and intended data type.
  • Producer and consumer contexts: ISR, DMA, task, main loop, shell, or logger.
  • Required behavior on full/empty: drop, overwrite oldest, block, error, or backpressure.
  • Element size, capacity, maximum burst, and latency budget.
  • Whether operations must be lock-free or protected by critical sections.

Integration Checklist

  1. Define ownership. Specify exactly who writes, who reads, and whether there can be multiple producers or consumers.
  2. Define full/empty semantics. Do not leave overwrite/drop/block behavior implicit.
  3. Check capacity math. Many ring buffers hold N-1 items to distinguish full from empty.
  4. Protect concurrent access. Use interrupt masking, atomics, mutexes, or single-producer/single-consumer rules as appropriate.
  5. Verify wraparound. Test writes and reads across the end of the buffer.
  6. Add telemetry. Track high-water mark, overflow count, drop count, or queue full events.

Common Failures

  • Race between ISR producer and task consumer.
  • Off-by-one capacity causes one byte or one element to disappear.
  • DMA writes into a buffer while CPU reads stale cached data.
  • Full buffer silently overwrites critical data.
  • Queue stores pointers to stack objects that go out of scope.

Verification

Before claiming buffer/queue works:

  • State producer/consumer contexts and protection strategy.
  • Confirm full, empty, wraparound, and overflow behavior.
  • Confirm maximum burst fits capacity or drops are counted intentionally.
  • For DMA/cache systems, state cache maintenance or memory placement.

Example

User:

UART 中断收数据用 ring buffer,偶尔丢字节。

Agent:

  1. Asks for producer/consumer contexts, baud, buffer size, overflow policy, and critical sections.
  2. Checks N versus N-1 capacity and ISR/task race.
  3. Adds overflow counters and tests burst input across wraparound.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.