- Home
- Skills
- Copyleftdev
- Sk1llz
- Stroustrup
stroustrup_skill
- Python
3
GitHub Stars
3
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 stroustrup- philosophy.md3.6 KB
- references.md2.6 KB
- SKILL.md5.0 KB
Overview
This skill writes C++ code in the style of Bjarne Stroustrup, emphasizing type safety, RAII-based resource management, and zero-overhead abstractions. It helps design APIs and systems where clarity and predictable performance must coexist. Use it to produce idiomatic, modern C++ that maps directly to hardware and expresses intent clearly.
How this skill works
The skill transforms design intent into C++ that favors compile-time guarantees, clear ownership, and minimal runtime cost. It prefers smart pointers, constexpr, concepts, std::span/string_view, and standard algorithms over manual, error-prone patterns. Code emitted follows RAII for resources, prefers strong types to primitives, and avoids hidden costs or clever obfuscation.
When to use it
- Designing systems or libraries where performance and clarity are both critical
- Creating public APIs that must make illegal states unrepresentable
- Refactoring legacy C++ to modern, safer idioms (RAII, smart pointers, constexpr)
- Writing code that must be predictable in performance and resource usage
- Teaching or documenting C++ best practices grounded in language philosophy
Best practices
- Prefer RAII: tie resource lifetime to object lifetime (use std::ifstream, locks, unique_ptr)
- Make illegal states unrepresentable using strong types and class invariants
- Favor compile-time checks: constexpr, concepts, and type-safe interfaces over runtime assertions
- Avoid raw new/delete and C-style casts; use smart pointers and C++ cast operators
- Use standard library algorithms, views, and ranges instead of hand-rolled loops when appropriate
Example use cases
- Implementing a low-latency networking API that must avoid hidden allocations and preserve ownership semantics
- Designing a configuration subsystem where invalid combinations are prevented by types
- Refactoring file and socket handling to RAII-based wrappers with clear ownership
- Writing a high-performance numeric kernel where zero-overhead abstractions and constexpr optimize hot paths
- Authoring library interfaces that use std::span and string_view for efficient non-owning parameters
FAQ
Yes — prefer unique_ptr by default and only use shared_ptr when shared ownership is explicitly required.
When should I use concepts instead of SFINAE?
Use concepts for clearer, compile-time constraints on templates in C++20 and later; they make intent and diagnostics much better.