Boost.Asio / standalone Asio
This skill guides writing or reviewing asynchronous C++ networking code with Boost.Asio or standalone Asio, covering TCP/UDP, SSL/TLS, timers, strands, and coroutines. It emphasizes matching the code style to the user's Boost version and C++ standard, providing version floors, common pitfalls, and CI-verified examples.
✨ What it does
- Determines the correct Asio style (coroutines, callbacks, or classic) based on Boost version and C++ standard.
- Enforces version floors for features like awaitable_operators, as_tuple, and any_io_executor.
- Highlights common mistakes: buffer lifetime, strand serialization, composed reads, and executor types.
- Provides anti-pattern table with fixes for typical Asio errors.
- Includes a pre-completion checklist covering style, buffers, strands, framing, error handling, and build settings.
- Offers three CI-verified worked examples for different styles.
🎯 When to use it
- Writing or reviewing async C++ networking code using Boost.Asio or standalone Asio.
- Targeting an older Boost version where modern coroutine examples may not compile.
- Implementing TCP/UDP servers or clients with SSL/TLS, timers, or strands.
- Debugging issues like buffer lifetime, strand serialization, or interleaved writes.
- Choosing between coroutine, callback, or classic io_service styles based on the toolchain.
🚀 How to use
Trigger by asking to write or review async C++ networking code with Boost.Asio or standalone Asio. Provide the target Boost version and C++ standard, or the code to review. The skill will guide style selection and best practices. Example prompts:
Write a TCP echo server using Boost.Asio with C++20 coroutines, targeting Boost 1.80.
Review this async client code for buffer lifetime issues.
📄 Output: Guidance and code examples that follow the correct Asio style for the target toolchain.
📦 Add this skill to Claude Code
# 1. Get the skills repo
git clone --depth 1 https://github.com/alirezarezvani/claude-skills /tmp/claude-skills
# 2. Copy this skill into your project (or ~/.claude/skills for all projects)
mkdir -p .claude/skills
cp -r /tmp/claude-skills/engineering/boost-asio-pro .claude/skills/boost-asio-proSkill source: engineering/boost-asio-pro/SKILL.md
⚠️ Good to know
Requires knowing the exact Boost/Asio version and C++ standard; the skill does not automatically detect them.
❓ FAQ
What is the most common mistake with strands?
Assuming a strand serializes writes; it only serializes handler execution, so concurrent async_writes can still interleave bytes. Use a write queue with an in-flight flag.
Why does my code fail to compile on older Boost?
You may be using features with version floors, like awaitable_operators (Boost 1.77+) or any_io_executor (Boost 1.74+). Check the version floors table and adjust your code style.
How do I support both Boost.Asio and standalone Asio?
Use a shim with conditional includes and namespace aliases, as shown in the skill, to switch between boost::asio and asio.
🤖 Overview, features, install steps and FAQ were generated from the project's SKILL.md on Sep 4, 2026. Always check the original source before running commands.