cpp-coroutines

cpp-coroutines is a skill for Codex from OutlineDriven/outline-driven-development. It costs 51 tokens per session (2,142 once invoked), scanned A, original, Apache-2.0.

A guide to C++20 coroutines, which are functions that can pause and resume while keeping their state. It covers the keywords that create coroutines, the promise object that defines their behaviour, and suspended state in the debugger.

In plain words
What is it for?
Use it to write or review co_await, co_yield, and co_return code, implement promise types, understand coroutine storage, and debug suspended coroutines in GDB.
Why use it?
It helps explain coroutine mechanics and investigate problems involving suspension, resumption, or coroutine state.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to write or review co_await, co_yield, and co_return code, implement promise types, understand coroutine storage, and debug suspended coroutines in GDB.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/outlinedriven/outline-driven-development/cpp-coroutines
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add OutlineDriven/outline-driven-development --skill cpp-coroutines
Clone the repo
git clone --depth 1 https://github.com/OutlineDriven/outline-driven-development

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cpp-coroutines

README.md
[![agentmods](https://agentmods.dev/badge/skills/outlinedriven/outline-driven-development/cpp-coroutines.svg)](https://agentmods.dev/skills/outlinedriven/outline-driven-development/cpp-coroutines)
Your own site
<a href="https://agentmods.dev/skills/outlinedriven/outline-driven-development/cpp-coroutines"><img src="https://agentmods.dev/badge/skills/outlinedriven/outline-driven-development/cpp-coroutines.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.02142
Opus 5 $0.00026 $0.01071
Sonnet 5 $0.00010 $0.00428
Haiku 4.5 $0.00005 $0.00214

Measured 2d ago against content hash 7d7cb6fd641e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cpp-coroutines scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.devin/skills/cpp-coroutines/SKILL.md · 188 lines

How it starts

The opening of the file, as written. The whole thing — 188 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C++20 coroutines

A coroutine is a function whose execution suspends and resumes while its frame survives on the heap. The language provides the keywords; the library author provides promise_type, which decides what suspension and return mean.

Contract

Field Bound contract
Trigger The task writes or reviews co_await, co_yield, or co_return code, implements a promise_type, explains the coroutine frame, or debugs a suspended coroutine.
Authority Read-only. The skill explains mechanics and drafts coroutine types; edits land through the normal coding path. No remote mutation.
Side effect None.
Done The drafted coroutine type compiles against the project standard, or the coroutine under debug is located and its promise state read.

Inputs

  • The coroutine code or the behavior wanted: required.
  • The toolchain and standard level: required. C++20 keywords with a C++23 library where <generator> is wanted; current GCC and Clang ship both.
  • A debugger session: required only for the debugging path.

Procedure

  1. Recognize the three keywords and what they demand. A function containing any of them is a coroutine, and its return type must carry a promise_type. Done when: every coroutine in the source has a coroutine-shaped return type.
co_return value;               // return and finish
co_yield value;                // produce a value, suspend
auto r = co_await awaitable;   // suspend until awaitable completes
  1. Draft a lazy Task when only the final result matters. initial_suspend returns suspend_always so the body runs only on resume(), and final_suspend is noexcept by rule. The owner destroys the handle exactly once. Done when: the type owns its handle, destroys it in the destructor, and propagates the exception.
#include <coroutine>
#include <exception>
#include <optional>
#include <utility>

template <typename T>
struct Task {
    struct promise_type {
        std::optional<T> value;
        std::exception_ptr exception;

        Task get_return_object() {
            return Task{std::coroutine_handle<promise_type>::from_promise(*this)};
        }
        std::suspend_always initial_suspend() { return {}; }            // lazy start
        std::suspend_always final_suspend() noexcept { return {}; }     // must be noexcept
        void return_value(T v) { value = std::move(v); }
        void unhandled_exception() { exception = std::current_exception(); }
    };

    std::coroutine_handle<promise_type> handle;

    explicit Task(std::coroutine_handle<promise_type> h) : handle(h) {}
    Task(Task&&) = default;
    Task& operator=(Task&&) = default;
    ~Task() { if (handle) handle.destroy(); }

    T get() {
        handle.resume();
        if (handle.promise().exception)
            std::rethrow_exception(handle.promise().exception);
        return std::move(*handle.promise().value);
    }
};

Read the full file on GitHub · 188 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 188 lines · 51 tokens per session scan A 7d7cb6fd641e

Subscribe to this mod's changes

cpp-coroutines is a skill published in the GitHub repository OutlineDriven/outline-driven-development (52 stars, last pushed 2d ago), licensed Apache-2.0. It adds 51 tokens to every session and 2,142 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-06.

Related

Other skills, from other repositories

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens

memory-safety-patterns

Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, managing resources, or preventing memory bugs.

rmyndharis/antigravity-skills · 45 tokens

cpp

Comprehensive C/C++ programming reference covering everything from C11-C23 and C++11-C++23, system programming, CUDA GPU computing, debugging tools, Rust interop, and advanced topics. Use for: C/C++ questions, C/C++ interview preparation, modern language features, RAII/memory management, templates/generics, CUDA…

crazyguitar/cppcheatsheet · 0 tokens

cpp-debugging

Use when a C++ failure involves memory lifetime, undefined behavior, native crashes, or debugger-only state — debug with symbols, sanitizers, and platform-native debuggers before patching symptoms.

drvoss/everything-copilot-cli · 42 tokens

memory-safety-patterns

Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, managing resources, or preventing memory bugs.

RudyCity/superagent · 45 tokens

ia-c-systems

C patterns for systems code, libraries, and native extensions: module layout, function decomposition, status-enum errors, memory safety, undefined behavior, and performance measurement. Use when writing, reviewing, refactoring, or debugging C, working with malloc lifetimes, buffer overflows, sanitizers, or Valgrind…

iliaal/whetstone · 84 tokens