bos_skill

This skill helps you write correct, efficient concurrent Rust code by applying Mara Bos-inspired memory-ordering guidance and safe patterns.
  • Python

3

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill copyleftdev/sk1llz --skill bos

  • SKILL.md7.8 KB

Overview

This skill produces Rust code in the style of Mara Bos, Rust library team lead and author of "Rust Atomics and Locks." It emphasizes provable correctness, careful use of atomics and memory orderings, and clear synchronization strategy. Use it when you need low-level concurrency, lock-free structures, or rigorous reasoning about happens-before relations.

How this skill works

The skill emits idiomatic Rust focused on atomic primitives, ordering choices, and safe synchronization patterns. It prefers high-level primitives first (channels, Mutex, Arc) and only uses atomics or unsafe when formally reasoned. It also generates documentation comments that explain the synchronization protocol and suggests testing approaches (loom, Miri).

When to use it

  • Implementing lock-free data structures or synchronization primitives
  • Optimizing hot concurrent paths where locks are a bottleneck
  • Teaching or documenting memory-order reasoning and happens-before guarantees
  • Reviewing or refactoring concurrent code for correctness and performance
  • Writing tests that exercise interleavings with loom or Miri

Best practices

  • Prefer channels or Mutex over raw atomics unless necessary
  • Document the synchronization strategy and invariants next to the code
  • Choose the weakest ordering that preserves correctness; default to SeqCst if unsure
  • Minimize shared mutable state and prefer ownership transfer via Arc/Weak
  • Use loom/Miri for exhaustive concurrency tests and assert invariants in tests

Example use cases

  • A spinlock implementation with clear Acquire/Release semantics and safety comments
  • A lock-free counter using Ordering::Relaxed where ordering is irrelevant
  • An Arc/Weak tree structure with documented ownership and upgrade semantics
  • A producer-consumer pipeline using crossbeam or mpsc with backpressure
  • A loom-based test that exhaustively verifies a concurrent invariant

FAQ

Use SeqCst when you need a global total order across threads or when reasoning is unclear. Use Acquire/Release for producer/consumer patterns where you only need to establish happens-before between specific stores and loads.

Is Ordering::Relaxed ever safe?

Yes. Use Relaxed for counters or statistics where atomicity matters but cross-thread ordering does not. Never use Relaxed when you need to synchronize access to non-atomic data.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
bos skill by copyleftdev/sk1llz | VeilStrat