Official agent skill

Testing Message Queue

by microsoft in microsoft/bocpy

Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer.

OfficialMITAuto-check passedBackend & APIs

Install Testing Message Queue

skills CLI
$ npx skills add microsoft/bocpy --skill testing-message-queue -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/bocpy testing-message-queue --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/bocpy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/testing-message-queue .claude/skills/testing-message-queue && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
testing-message-queue
GitHub stars
200
Token cost
~2.3k tokens
SKILL.md length
685 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer.

  • : testing send/receive
  • SKILL.md covers Architecture Overview, Test File Location, Fixture: Resetting Queue State and Pattern 1 — Basic Send / Receive, plus 10 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Selective receive

What it does

Testing Message Queue is an agent skill from microsoft/bocpy, published by the product's own GitHub organization. Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer. Use when: testing send/receive, FIFO ordering, selective receive, timeouts, cross-thread messaging, multi-producer scenarios, tag capacity limits, settags behavior, or payload round-trip fidelity.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Event-driven systems and Test generation. The repository describes itself as: Behavior-Oriented Concurrency in Python. The licence is MIT.

When your agent uses it

  • : testing send/receive
  • Selective receive
  • Cross-thread messaging
  • Multi-producer scenarios

Example prompts

  • “/testing-message-queue”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit c8f3ceb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Testing Message Queue loads about 2.3k tokens when it runs. Until then it costs about 76 tokens; SKILL.md has 685 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~76
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/bocpy at commit c8f3ceb, republished under its MIT licence (© microsoft). 685 words, ~2,284 tokens.

Download SKILL.mdSave it as .claude/skills/testing-message-queue/SKILL.md (or your agent's skills folder).
name
testing-message-queue
description
Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer. Use when: testing send/receive, FIFO ordering, selective receive, timeouts, cross-thread messaging, multi-producer scenarios, tag capacity limits, set_tags behavior, or payload round-trip fidelity.

Testing the Message Queue

This skill describes how to write tests for the bocpy message queue — the lock-free, tag-based MPSC ring buffer implemented in C that underlies send()/receive().

Architecture Overview

ComponentDetail
Queues16 statically allocated ring buffers (BOC_QUEUE_COUNT = 16), each with capacity 16 384.
TagsString labels that map 1:1 to queues. Each unique tag occupies one queue slot.
Assignment modesAutomatic (default): tags claim a queue on first send/receive. Explicit: set_tags() pre-assigns tags, clears all messages, and resets queues.
set_tags([])Drains every queue, frees all tag associations, and sets all queues to UNASSIGNED — effectively restoring auto-assign mode.
Thread safetyEnqueue is lock-free (atomic CAS on tail). Multiple threads can send to the same tag concurrently. receive spins on the queue with a sleep until a message is available or a timeout elapses.

Test File Location

Message queue tests live in test/test_message_queue.py.

Fixture: Resetting Queue State

Every test must start with a clean slate. Use an autouse fixture that calls set_tags([]) before and after each test. This drains all queues and returns them to auto-assign mode — no set_tags call is needed inside individual tests unless the test is specifically exercising set_tags behavior.

python
MAX_QUEUES = 16

@pytest.fixture(autouse=True)
def reset_queues():
    set_tags([])
    yield
    set_tags([])
Why set_tags([]) instead of set_tags([...16 tags...])?

Calling set_tags is optional. The system auto-assigns tags to queues on first use. The purpose of the fixture is to clear stale state, not to pre-allocate tags. Using set_tags([]) resets all 16 queues to UNASSIGNED so every test starts fresh, and most tests can exercise the auto-assignment path naturally.

Pattern 1 — Basic Send / Receive

The simplest test: send a message, receive it, assert on the result. No set_tags needed — the tag auto-assigns.

python
def test_basic():
    send("my_tag", "hello")
    tag, val = receive("my_tag", 1)
    assert tag == "my_tag"
    assert val == "hello"

Always pass a timeout to receive so tests fail fast rather than hanging.

Pattern 2 — Verifying FIFO Order

Messages on the same tag are delivered in FIFO order. Send a sequence, then receive and compare element-by-element.

python
def test_fifo():
    for i in range(10):
        send("fifo", i)
    for i in range(10):
        _, val = receive("fifo", 1)
        assert val == i

Pattern 3 — Selective Receive Across Multiple Tags

receive accepts a list or tuple of tags and returns the first available match. Messages on non-matching tags remain in their queues.

python
def test_selective():
    send("skip", "no")
    send("want", "yes")
    _, val = receive("want", 1)
    assert val == "yes"
    # "skip" message is still there
    _, val = receive("skip", 1)
    assert val == "no"

def test_multi_tag_receive():
    send("b", "found")
    tag, val = receive(["a", "b", "c"], 1)
    assert tag == "b"
    assert val == "found"

Pattern 4 — Timeout Behavior

Timeout valueBehavior
0Return immediately — delivers a queued message or (TIMEOUT, None).
Positive floatWait up to that many seconds.
Negative (default)Block indefinitely until a message arrives.

The optional after callback fires only on timeout and replaces the default (TIMEOUT, None) return value.

python
def test_zero_timeout():
    tag, val = receive("empty", 0)
    assert tag == TIMEOUT
    assert val is None

def test_after_callback():
    tag, val = receive("miss", 0.05, lambda: ("fallback", 99))
    assert tag == "fallback"
    assert val == 99

def test_after_not_called_on_success():
    called = []
    send("ok", "payload")
    tag, val = receive(
        "ok", 1,
        lambda: (called.append(True), ("fb", -1))[-1],
    )
    assert tag == "ok"
    assert called == []

Pattern 5 — Cross-Thread Messaging

send and receive are thread-safe. Use threading.Thread to test cross-thread delivery.

python
def test_cross_thread():
    def sender():
        send("ct", "from_thread")

    t = threading.Thread(target=sender)
    t.start()
    tag, val = receive("ct", 5)
    t.join()
    assert tag == "ct"
    assert val == "from_thread"

def test_bidirectional():
    def echo():
        _, val = receive("ping", 5)
        send("pong", val * 2)

    t = threading.Thread(target=echo)
    t.start()
    send("ping", 21)
    _, val = receive("pong", 5)
    t.join()
    assert val == 42
Show full SKILL.md (285 more words)Show less

Pattern 6 — Multiple Concurrent Producers

Multiple threads sending to the same tag exercises the lock-free MPSC enqueue. Collect all messages and verify completeness. Per-producer FIFO ordering is guaranteed (messages from a single thread arrive in send order).

python
def test_multi_producer():
    n_producers = 8
    msgs_per = 200

    def producer(pid):
        for i in range(msgs_per):
            send("mp", (pid, i))

    threads = [threading.Thread(target=producer, args=(p,))
               for p in range(n_producers)]
    for t in threads:
        t.start()

    received = []
    for _ in range(n_producers * msgs_per):
        _, val = receive("mp", 10)
        received.append(val)

    for t in threads:
        t.join()

    # Every (pid, seq) pair delivered exactly once
    assert sorted(received) == sorted(
        (p, i) for p in range(n_producers) for i in range(msgs_per)
    )

Pattern 7 — Tag Capacity Limits

There are exactly 16 queue slots. Exceeding them raises KeyError.

python
def test_capacity_exceeded():
    for i in range(MAX_QUEUES):
        send(f"tag{i}", "fill")
    with pytest.raises(KeyError, match="tag capacity exceeded"):
        send("one_too_many", "boom")

Pattern 8 — Testing set_tags Explicitly

Use set_tags tests to verify pre-assignment, clearing, overflow, and reset behavior. These tests call set_tags directly inside the test body.

python
def test_set_tags_clears():
    send("old", "stale")
    set_tags(["new"])
    # Old messages are gone; "new" starts empty.
    tag, val = receive("new", 0)
    assert tag == TIMEOUT

def test_set_tags_resets_to_auto():
    set_tags(["pre"])
    send("pre", "msg")
    set_tags([])  # back to auto-assign
    send("fresh", "works")
    tag, val = receive("fresh", 1)
    assert val == "works"

def test_set_tags_overflow():
    set_tags([f"t{i}" for i in range(MAX_QUEUES)])
    with pytest.raises(KeyError, match="tag capacity exceeded"):
        send("extra", "x")

def test_set_tags_rejects_too_many():
    with pytest.raises(IndexError):
        set_tags([f"t{i}" for i in range(MAX_QUEUES + 1)])

Pattern 9 — Payload Round-Trip Fidelity

Messages cross interpreter boundaries via cross-interpreter data (XIData) or pickle. Use @pytest.mark.parametrize to sweep payload types.

python
@pytest.mark.parametrize("payload", [
    0, -1, 2**31, 3.14, float("inf"),
    True, False, None,
    "", "hello",
    (), (1,), (1, (2, (3,))),
])
def test_roundtrip(payload):
    send("rt", payload)
    _, val = receive("rt", 1)
    assert val == payload

Error Handling Tests

ErrorHow to triggerExpected exception
Non-string tag in sendsend(123, "x")TypeError
Empty tag list in receivereceive([], 0)RuntimeError
Non-string in tag listreceive([123], 0)TypeError
Tag capacity exceededsend on 17th unique tagKeyError
Too many tags in set_tagsset_tags([...17 items...])IndexError
Non-str in set_tagsset_tags([123])TypeError
Non-sequence in set_tagsset_tags(42)TypeError

Common Pitfalls

PitfallFix
Calling receive without a timeoutTests hang forever if no message arrives. Always pass a timeout.
Using too many unique tags across testsEach unique tag consumes a queue slot. The fixture must reset queues between tests via set_tags([]).
Forgetting the fixture resets queuesWithout the autouse fixture, stale messages or tag assignments leak between tests, causing flaky failures.
Assuming set_tags is requiredIt isn't. Tags auto-assign on first use. Only call set_tags when you need to pre-assign or clear queues.
Not joining threads before assertingA thread may still hold the GIL or be mid-send. Always t.join() before final assertions.
Sending from more threads than queue capacityIf threads use distinct tags, you'll hit the 16-queue limit. Have concurrent threads share a single tag.

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/testing-message-queue of microsoft/bocpy.

Open the folder on GitHubat commit c8f3ceb

Compare with similar skills

Testing Message Queue next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Testing Message Queue compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Testing Message Queue this skillmicrosoft/bocpy200—~2.3kAutomated safety check: PassMIT
Ak Dev New Queue Transportyaalalabs/agent-kernel191—~2.7kAutomated safety check: PassApache-2.0
Stripe Projectsfossasia/eventyay1.7k5 repos~2kAutomated safety check: NotesApache-2.0
MQTTX CLIemqx/MQTTX5.1k—~1.9kAutomated safety check: PassApache-2.0
AWS Serverless Edazxkane/aws-skills3674 repos~3.2kAutomated safety check: PassMIT
Windmill Trigger Type Checklistwindmill-labs/windmill18k—~4.7kAutomated safety check: PassCustom licence

Similar skills

  • Ak Dev New Queue Transport

    yaalalabs/agent-kernel

    Step-by-step guide for adding a new queue transport to Agent Kernel's execution pipeline.

    191 GitHub stars~2.7k tokensUpdated today
    Backend & APIsAuto-check passed
  • Stripe Projects

    fossasia/eventyay

    A skill your agent uses when the user wants to provision infrastructure or third-party services using Stripe Projects.

    1.7k GitHub starsUsed in 5 repos~2k tokens
    Backend & APIsAuto-check: notes
  • MQTTX CLI

    emqx/MQTTX

    Operates the `mqttx` command line client to connect, publish, subscribe, benchmark and simulate data against an MQTT broker, with TLS and MQTT 5 support.

    5.1k GitHub stars~1.9k tokensUpdated 6 days ago
    Backend & APIsAuto-check passed
  • AWS Serverless Eda

    zxkane/aws-skills

    AWS serverless and event-driven architecture expert based on Well-Architected Framework.

    367 GitHub starsUsed in 4 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • Windmill Trigger Type Checklist

    windmill-labs/windmill

    Checklist of every backend, frontend, CLI and capture change needed to add a new TriggerCrud-based trigger type, such as Azure, GCP or Kafka, to Windmill.

    18k GitHub stars~4.7k tokensUpdated today
    Backend & APIsAuto-check passed
  • Foundatio

    FoundatioFx/Foundatio

    A skill your agent uses when working with Foundatio infrastructure abstractions for .NET -- caching, queuing, messaging, file storage, distributed locking, or background jobs.

    2.1k GitHub stars~3.9k tokensUpdated today
    Backend & APIsAuto-check passed

More from microsoft/bocpy

All 9 skills in this repo
  • Branch Review

    microsoft/bocpy

    Official

    Multi-perspective code review for a branch before merging. An agent skill from microsoft/bocpy.

    200 GitHub stars~3.2k tokensUpdated 9 days ago
    Auto-check passed
  • Official

    Write a C extension whose custom types can live inside a bocpy Cown and travel between worker sub-interpreters.

    200 GitHub stars~5.1k tokensUpdated 9 days ago
    Auto-check passed
  • Official

    Follow bocpy commenting and documentation conventions. An agent skill from microsoft/bocpy.

    200 GitHub stars~3.3k tokensUpdated 9 days ago
    Auto-check passed
  • Finalize PR

    microsoft/bocpy

    Official

    Finalize a feature branch for merge. An agent skill from microsoft/bocpy.

    200 GitHub stars~3.5k tokensUpdated 9 days ago
    Auto-check passed
  • Multi Perspective Plan

    microsoft/bocpy

    Official

    Multi-perspective planning with rebuttal rounds and adversarial review loop.

    200 GitHub stars~2.8k tokensUpdated 9 days ago
    Auto-check passed
  • Thinking In Boc

    microsoft/bocpy

    Official

    Think in Behavior-Oriented Concurrency, not threads-and-locks.

    200 GitHub stars~2.6k tokensUpdated 9 days ago
    Auto-check passed

Categories

Questions about Testing Message Queue

What does Testing Message Queue do?

Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer. Testing Message Queue is an agent skill from microsoft/bocpy, published by the product's own GitHub organization. Write tests for the bocpy message queue — the lock-free tag-based MPSC ring buffer.

When should I use Testing Message Queue?

Testing Message Queue fits situations like: : testing send/receive; selective receive; cross-thread messaging; multi-producer scenarios.

How do I install Testing Message Queue in Claude Code?

Run `npx skills add microsoft/bocpy --skill testing-message-queue -a claude-code`. Or copy the skill folder (.github/skills/testing-message-queue in microsoft/bocpy) into .claude/skills/testing-message-queue in your project. Claude Code loads it when a task matches its description.

How do I install Testing Message Queue in Codex?

Run `npx skills add microsoft/bocpy --skill testing-message-queue -a codex`. Or copy the skill folder (.github/skills/testing-message-queue in microsoft/bocpy) into .agents/skills/testing-message-queue in your project. Codex loads it when a task matches its description.

Can I use Testing Message Queue in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/bocpy --skill testing-message-queue -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-message-queue, .gemini/skills/testing-message-queue, .github/skills/testing-message-queue and .opencode/skills/testing-message-queue in your project.

What does Testing Message Queue need to run?

SKILL.md names no scripts, command-line tools or credentials: Testing Message Queue is instructions for the agent only. Our summary lists: Python 3.

Does Testing Message Queue access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Testing Message Queue safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Testing Message Queue use?

Testing Message Queue is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Testing Message Queue use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Testing Message Queue?

Skills that share tags, products or a category with Testing Message Queue: Ak Dev New Queue Transport (yaalalabs/agent-kernel, 191 stars), Stripe Projects (fossasia/eventyay, 1.7k stars), MQTTX CLI (emqx/MQTTX, 5.1k stars) and AWS Serverless Eda (zxkane/aws-skills, 367 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Testing Message Queue?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/bocpy, which has 200 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on September 28, 2026.

Source: microsoft/bocpy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.