cpp-patterns
Modern C++ patterns and best practices for readable, safe, maintainable C++ code: RAII, ownership, error handling, API design, concurrency basics, and build/tooling hygiene. Use when writing or reviewing C++ (C++20+) code.
v2026.11.13-21cd5683 установки+3 за 7 дней39 ЗвездыMITсинхронизировано 10 часов назад
Установка
Ещё нет NotHoly CLI? Сначала установите её.
$ curl -fsSL https://notholy.com/install.sh | sh$ notholy skills install aeondave/cpp-patternsПишет в ~/.notholy/skills после проверки подписи и SHA-256.
ПодписьПодписано, ed25519
Пакетb827313c…dad248e4
b827313ca271…603ddad248e46 файлов · 6.4 KBПроверкаНизкий1 замечание
- Ссылки на внешние домены
Источникgithub.com/AeonDave/malskill/tree/main/coding/cpp-patterns@21cd568
Эта запись еще не переведена на русский, поэтому показан текст на другом языке: English.
На странице
Use this skill for day-to-day modern C++ (C++20+) with a bias for safety, clarity, and maintainable APIs.
If your primary task is test architecture/debugging, activate cpp-testing alongside this skill.
When to activate
- Writing new C++ modules/libraries/services
- Reviewing PRs for ownership, lifetime, and exception safety
- Refactoring for cleaner interfaces and fewer footguns
- Introducing RAII, smart pointers, and standard library algorithms
Outcome expectations
- APIs encode ownership and lifetime intent directly in types.
- Resource cleanup is deterministic (RAII) and exception-safe.
- Error behavior is consistent per layer (no mixed ad-hoc strategy).
- Concurrency code has explicit stop/cancellation and race-checking plan.
Core rules (high signal)
- Prefer RAII for resource ownership; avoid raw
new/delete. - Use value types by default; use references/pointers to express optionality and non-ownership.
- Use
std::unique_ptrfor exclusive ownership;std::shared_ptronly when shared ownership is required. - Prefer standard algorithms over hand-written loops when it improves clarity.
- Keep APIs small; make invalid states unrepresentable where feasible.
- Define clear error strategy: exceptions vs
std::expected-style returns vs status codes.
Recommended workflow
- Clarify ownership and lifetime boundaries first (handles, buffers, views, async captures).
- Design the public API around value semantics and explicit contracts.
- Implement with RAII wrappers and Rule-of-Zero defaults.
- Add warnings/sanitizers/static analysis early in the build.
- Review for footguns (dangling views, iterator invalidation, detached threads).
Quick review checklist
- Ownership is explicit (who allocates, who frees)
- No leaks or dangling refs (temporaries,
string_view, iterator invalidation) - Rule of Zero is used; special members defined only when needed
constcorrectness is consistent- No surprising implicit conversions; use
explicit - Concurrency code has a cancellation/stop strategy
- Error semantics and exception guarantees are documented
Common anti-patterns to reject
- Owning raw pointers in public APIs
- Returning/storing
std::string_viewtied to temporary storage - Detached threads that capture
thiswithout a lifetime model - Broad
catch (...)blocks that hide failure context - Exposing mutable shared state without synchronization policy
Resources
Load on demand:
references/ownership-raii.md— ownership rules, RAII patterns, smart pointers, lifetimereferences/core-guidelines.md— distilled C++ Core Guidelines pointersreferences/api-design.md— interface design, value semantics, error strategyreferences/concurrency.md— jthread, mutex, atomic, condition_variable, stop_token, race detectionreferences/tooling-build.md— compiler warnings, sanitizers, static analysis, binary inspection (MinGW/objdump, MSVC/dumpbin, Linux tools), CMake hygiene
Файлы этой версии
references/511.2 KB
- api-design.md1.6 KB
- concurrency.md3.5 KB
- core-guidelines.md832 B
- ownership-raii.md1.7 KB
- tooling-build.md3.6 KB
- SKILL.md3.5 KB
Права
| Право | Заявлено | Найдено проверкой |
|---|---|---|
| Читает файлы | Нет | Нет |
| Пишет файлы | Нет | Нет |
| Выполняет команды shell | Да | Да |
| Ходит в сеть | Да | Да |
| Использует коннекторы | Нет | Нет |
| Управляет браузером | Нет | Нет |
Замечания проверки
Проверено 13 нояб. 2026 г.
- ИнфоСсылка · Ссылки на внешние домены
Чистая проверка снижает риск, но не доказывает, что пакет безопасен. Читайте то, что ставите.
| Версия | Опубликована | Коммит | SHA-256 | Подпись | Изменение прав |
|---|---|---|---|---|---|
| v2026.11.13-21cd568 | 13 нояб. 2026 г. | 21cd568 | b827313c | Подписана | – |
Ещё от AeonDave
Всё от этого издателяЕще в категории «API, SaaS и идентификация»
Вся категория- testing-for-sensitive-data-exposuremukul975/testing-for-sensitive-data-exposure5
- performing-jwt-none-algorithm-attackmukul975/performing-jwt-none-algorithm-attack5
- sharp-edgestrailofbits/sharp-edges4
- hydraaeondave/hydra4
- implementing-google-workspace-admin-securitymukul975/implementing-google-workspace-admin-security4
- implementing-api-security-posture-managementmukul975/implementing-api-security-posture-management4
Спрашивайте обо всём, что позволяет ваш скоуп.
Создайте аккаунт, пополните баланс и задайте первый вопрос в чате или в терминале.
- 1/3
Создайте аккаунт
Личный или для компании. Позже можно перейти на аккаунт компании без потери баланса и ключей.
ЛичныйКомпания - 2/3
Пополните баланс
Картой. Оплата за токены, без подписки.
$5.00минимальное пополнение - 3/3
Спрашивайте
В чате, или установите CLI и выполните notholy login в терминале.
$ notholy login